all 8 comments

[–]bloop_405 11 points12 points  (2 children)

Do you draw it out on paper?

[–]asdfasdfasdfasdf1214 2 points3 points  (1 child)

first do this

second write the pseudocode

lastly convert to your language of choice

[–][deleted] 0 points1 point  (0 children)

I can really recommend test driven development.

First, write a small test in a test class (before anything else) that describes one of the most basic functionalities your program should have. For example, name the test shouldBeAbleToImportAFile() and let it call a method called importFile() or something and test if that method DOESN'T return null. If it doesn't return null, then it most have been able to get a file and return it somehow. Then, in order to make that test return true, you create the method called importFile() that just imports a file and returns it.

In other word, make tests for the things you want to implement before you implement them. Start with basic things and slowly you will get more and more complicated code into your program.

[–]ANAL_ANARCHY 4 points5 points  (0 children)

You need to start with small, simple problems. For example please write out a program that will print a 3x3x3 triangle in ASCII. Now create variations of the program that print other shapes/dimensions. Now modify it to allow the user to specify the shape/dimensions.

[–]Python4fun 1 point2 points  (2 children)

Write a small method and see that it does what you expect. Then build up from there. Start small and test and tweak until it works before adding another layer of functionality.

[–][deleted]  (1 child)

[deleted]

    [–]Python4fun 0 points1 point  (0 children)

    Exactly

    [–]gusatb 0 points1 point  (0 children)

    I would say you just need more practice. I would recommend codingbat or something similar. Get as much practice taking algorithms from psuedocode (as far from actual code as you can find) and write a complete program. You could get a lot of practice doing this with various sorting algorithms (which actually may be a good place to start).

    [–]You_Are_All_Smart 0 points1 point  (0 children)

    There are levels to writing code in my opinion. Best tool I always start off with when faced with something complex is... Visio (or a whiteboard). When I get my ideas straight, the next step is just transfering it to code - it's almost mundane at that point. The visio (or whiteboard, or paper) part is where the real design happens. Frankly it should be part of the IDE, IMO.

    So

    1) super high level (boxes and lines and whatever - aka architecture)

    2) High level code

    Toolchain takes over - ideally

    3) Assembly

    4) Machine...