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.
Win a flower (🌹) or copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java (📚) this week in the Agile and Other Processes forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
master stewards:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
stewards:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

how to think oop?

 
pioneer
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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.

Thanks again





 
steward
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,

Probably the best book of OOP thinking was done by Peter Coad and Nicole Nicola. The examples were in c++ and smalltalk, but they laid out the thinking needed to grok OOP.

you can find it on amazon for 15$ used. OOP

Just a few notes:

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.

-steve
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!