• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to plan and design your programs  RSS feed

 
justin smythhe
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some random ideas to convert into code. I form a rough mental picture in my mind in about 5-10 minutes and begin making the code. Thinking and revising as I make the code.
This approach has often frustrated me and I want to learn better ways to plan my work and design my programs.

I often make code to realize this is a bad design.
Finally, I make that code work.
Then I make some more code that uses old code. Now, I see that the old
code is a bad design, it does not "mix well" with the new code that uses it.

Now, I am back to square one. Hours wasted and little gained in the process.

How do I get out of this ?
 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Test-Driven Development. See the book "Growing Object-Oriented Software, Guided by Tests." You will also need to know about Refactoring as well as be familiar with SOLID design principles That, for me, is as good a place to start as any.

And you actually don't try to get out of what you're doing now as much as you try to improve it and make it more disciplined. Very rarely in your programming life will you come to the correct solution at the first try. Programming and design is about trial and error. With more discipline, a good foundation in principles, and constant testing and refactoring, you can make the process of learning from and correcting your mistakes as you go become very fast and iterative. This is the joy of Agile development.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
justin smythhe wrote:How do I get out of this ?

My suggestion: Turn your computer OFF. Or, at the very least, your IDE (if you use one).

Programming, in my experience, follows the 80/20 rule - 80% thought, 20% coding (perhaps a slightly more even split if you're using Agile techniques; but a large part of that will be writing tests, rather than actual code).
Simply put: You can't write a program until you understand the problem; and to do that you have to work it out in English (or your native language).

Design is an active process, and often involves thinking "outside the box", so if all your "box" consists of is a Java text editor, it's highly unlikely that you'll ever progress beyond the point of trying to bash your square Java code peg into its round hole.

One thing I would recommend is getting a book on Design patterns. The grandaddy of them all of course is this one; but there are plenty of others out there, some possibly more up-to-date.

The other: Get a copy of Effective Java. It is, bar none, the best practitioner's book I've ever read about any language.

HIH

Winston
 
vinayak jog
Ranch Hand
Posts: 83
MySQL Database Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brain storm your ideas write them on paper or type and print ..... then convert it into psuedo code..... do coding
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!