• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

How to plan and design your programs

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Sheriff
Posts: 17665
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 83
Netbeans IDE MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Would you like to try a free sample? Today we are featuring tiny ads:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic