wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Java-programme Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java-programme "Mise en Place"" Watch "Java-programme "Mise en Place"" New topic
Author

Java-programme "Mise en Place"

Wolfgang Obi
Ranch Hand

Joined: Dec 05, 2005
Posts: 134
i've noticed that my programming is pretty chaotic...i.e. with reference to naming conventions, and communication between my methods and classes etc.
i've noticed that i spend almost as much time reorganising my work as i spend programming (not to speak of debugging )

...ergo my (probably very silly question)...

how do you start off writing a java programme?
(e.g: what individual steps do i need to take to ensure a fast and structured solution which avoids having to rename variables, or parameters(after the actual programming has been taken care of etc...
)

maybe someone could give me a short, step by step guide using a simple example....for example:

problem:
write a method which computes the number people who have resided in one of many hotel rooms (received as a parameter) from 1999 till any given date(received as a parameter) based on a guest list sorted according to any given criteria.

i hope my question is clear.

thanx, i'd appreciate any help i get...

-W.O.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
There is a great technique called Test Driven Development or TDD. It involves writing a test that defines what your code should do and then making the test pass. The trick is to start with the smallest possible thing you can think of and build more tests and more solutions until you're done.

Here are two exercises that let you watch over Robert Martin's shoulder. This is a pretty amazing experience.

http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata
http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata

Try those a couple times each and let us know how it goes. Oh, he's using JUnit for the tests. Download it from http://junit.org/index.htm. Give a holler if you need help setting it up.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
mohit bahl
Ranch Hand

Joined: Mar 22, 2006
Posts: 48
hi Wolfgang
The question that you have asked here is very general rather than java based. And lot of programmers can speak at lengths when asked this question.

The very basic principle of software development is
the more you sweat in peace, the less you bleed in war


Putting it to software line, it translates to that as much time you spend designing your program, the lesser problems/reorganization you face while coding.

For designing you can use top down or bottom up approach. And then write (on paper) the entire skeleton of your program. (Now coming to java) Like the classes that you will require. That can be classes that will have the functionality and ones which will only hold the data used by your program in a structured way. Then you plan your methods in the classes having the functional logic. Then you can decide upon the variables and getter and setter methods of the classes which will hold your data. And last but not the least the class which will create objects and call the methods from your classes to run the functionality which you have implemented, yeah you guessed it right, the class with the main method.

I hope it helps.

Cheers!


to err is human, but the company policy doesn't allow it!
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Putting it to software line, it translates to that as much time you spend designing your program, the lesser problems/reorganization you face while coding.


Be aware that this is a controversial point of view. Some projects like the Space Shuttle get fabulous results with lots of design up front (at fabulous cost) but others get by quite nicely (and very quickly) designing one test at a time.

I'd suggest you practice both ways for a bit and learn to travel as light as works for you.
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
Originally posted by Stan James:


Be aware that this is a controversial point of view. Some projects like the Space Shuttle get fabulous results with lots of design up front (at fabulous cost) but others get by quite nicely (and very quickly) designing one test at a time.

I'd suggest you practice both ways for a bit and learn to travel as light as works for you.


Which probably has at least something to do with their ability to have well-defined and precise requirements. What happens when a client needs something, but they can't precisely define what it is? What if those requirements are changing in unforseeable and significant ways at a rapid pace? Spending too much time in design in that kind of scenario leads to nothing getting done because by the time the design can be worked out the requirements have changed, if they were ever truly defined to begin with.
mohit bahl
Ranch Hand

Joined: Mar 22, 2006
Posts: 48
Which probably has at least something to do with their ability to have well-defined and precise requirements. What happens when a client needs something, but they can't precisely define what it is? What if those requirements are changing in unforseeable and significant ways at a rapid pace? Spending too much time in design in that kind of scenario leads to nothing getting done because by the time the design can be worked out the requirements have changed, if they were ever truly defined to begin with.


I totally agree with it but I think you will agree that developing on requirements which are not signed off will never do you any good. And when you develop like this you are spending more time reorganizing rather then delivering.
If you really foresee that the client needs are bound to change, then evolutionary development will be better. That is you take a round of the development lifecycle with one particular requirement rather then developing the full blown system at once.

But I think we are driving away from the topic of this thread and for that what I will suggest is when the requirements are frozen, you design. While designing pick up/mention as many reusable components as possible and then go ahead with development.

cheers!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java-programme "Mise en Place"
 
Similar Threads
Access scanner from tomcat?
Advice on file directory needed.
TV Networks resisting change?
Interview Experiences
What is the best way to create GUI components- in-line, methods, inner classes or separate classes