This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line! See this thread for details.
Im fairly new to Java, in fact my background is some light programming using Ruby, which although is conceptually OO, I have never really fully utilised its OO capabilities. Hold on, before you slap me down, I understand polymorphism, method overloading, overriding, inheritance etc, but when I write a program, I want to think more OO, I want to plan out, as has been suggested to me a class diagram, understand how objects communicate, their responsibilities etc.
Can anyone recommend a good book? Online articles?
You know I remember at uni, we covered UML, but I never really took it seriously, I just wanted to hack some code together to reach the end objective. I still seem to be in this mindset, its so frustrating.
For instance, a simple program.
2 sets of traffic lights at a crossing, 4 lights in total.
These are all controlled by a central controller.
The lights start off Red, Red, Green, Green.
The Greens revert to Orange, then back to Red, then the other pair move to Orange and Green, And so on... a simple transition.
But looking at this with OO spectacles, this is my conclusion.
We have 4 light objects from a light class.
Each light has a state.
The state can be one of 3, red, orange or green.
The controller runs the sequences above for n times.
We have a controller class.
It sends messages to the lights to change to their next state.
See this all makes perfect sense to me, but the lights also have a starting state, two as green, two as red.
How does this tie in with the OO thinking...
Can any of you gurus out their explain how you would approach this in a full OO way.?
And again, any good books, articles which tie OO thinking with programming examples would be great, I really need to move into a OO mind trance.
1) the c++ code was kinda bad. ie: there is a routine where a temporary string is created, set to a value, a pointer to that string is returned, then it exits. Which means that the memory was recovered and only worked if you didn't call another method/function prior to using the string. (note: this is a really good reason why for the most part we are writing java not c++).
2) to this point in time, this was the finest example of pure OOP in smalltalk i have seen.
3) it appears that i taught one of the first OOP courses (for credit) at the university level and this was the text that i used.
** yes i am partial, but at this point in history we were still talking pure OOP not OOP in this or that language.
4) yes i have met pete road and he is a very great person.
** if again i am partial, so be it, my interaction with him have only been positive. He was much more interested in promoting the cause (OOP) or others than himself.
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad: