• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OOP Examples and Exercises

 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have been asked to train some resources in my client company in OOP (they are mainframe programmers).

I am trying to gather material to

1. Order the OOP concepts such that the concepts are unravelled gradually.
2. Exercises and examples that can help them practice what I preach.

I have been Googling for quite some time but would appreciate it very much if you could share your favorite bookmarks/references/books in this regard.

Thanks.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might consider using OOP Demystified to back up your training.
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. The review looks good. I will check it out.

Anything else, fellows?
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like reading the "How my Dog learned Polymorphism" story in JavaRanch's Campfire Stories section, everytime I read it. I wish they had some more like them.

http://www.javaranch.com/campfire.jsp
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look to the gurus like Robert Martin's Agile Software Development for OO principles. If you are comfortable with the ideas, you'll be able to find examples that apply to your class in real life. That's how I wound up making this for my team: The DIP (Sorry, I hate the way I converted PowerPoint to HTML.)

Also (intended to be) fun: Knight's Principles and Law of Demeter
[ September 11, 2004: Message edited by: Stan James ]
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the links..

I am currently reading the Martin book as a part of Design Pattern Study Group of NY. I surely will be trying to incorporate the concepts in the training.

I am looking more for a good explanation of the basics and some simple examples/exercises that I can give to the attendees. This is where I cannot find much data.

I looked at the "OOP Demystified" book and found one issue with the intro (which I find common in almost all other books).

The book begins with a valid question - Why bother changing to OOP? Then it says that OOP is better because it is modelled after nature and that it can adapt to changes better than other methodologies.

But it does not say how other models cannot adapt as much as OOP. I am sure I will be asked this question by my audience, who are rooted in Structured Programming (AS/400, COBOL, and alike).

With such structured programming languages showing signs of OOP (like Object COBOL and RPG IV), how can I convince them that a pure OOP language (like Java, Smalltalk, etc.) is better suited than them?

As OOP techniques have become more and more commonplace, most of the books assume implicitly that OOP is the best option, but never bother explaining how.

Any explanation in this regard would be most welcome.
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's different about OO? Great question from a good procedural crowd! I've seen OO taught as "everything you know is wrong, here's the only right and good thing" and it turned people off, so treat the question with respect.

With procedural stuff, you most often have data structures and a collection of routines that work on the structs. With functional decomposition you can wind up with a bunch of modules that work on the same structure. The first version of such a system may be a thing of beauty, but it is likely to be fragile to change. For example, a change to a structure may impact many modules and every mod is an opportunity to mess up and introduce bugs.

OO is just a different way to organize code. If your procedural folks are into sophisticated information hiding and modularity they might claim the only thing really new to them is inheritance. But when you "get" OO it leads to very different decisions about what code belongs together and what does not.

One way to see OO is taking a structure and wrapping it in code. Only the code in that class can ever touch the structure. It's impossible for some new module to muck up the data. The protective layer of code simply won't allow that kind of change. If your guys got information hiding, they'll get encapsulation pretty fast.

Another way is to see OO is to focus on behavior. An object can offer the rest of the world a certain set of behavior and other objects can use it. In this view you never think about the structure the object might (or might not) be hiding, only what it can do for you.

A fun aspect is you can anthropomorphise objects - talk about them as if they were people. Try message passing between people. Hand somebody a card that says "Turn off the light". Give somebody else another task. Talk about what they are able to do and what they know. Get some tasks that involve several people. And let us know what you come up with, cause I want to try it too!
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stan,

Thanks for the great ideas! I will definitely try them out. I will definitely be posting my experiences and some materials that I come up with in the Ranch once this is over.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sathya,

"Object Oriented Thought process" is an excellent book covering the fundamentals.

You may like it too...

Regards
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I browsed through the OOTP book in the friendly neighborhood B&N, but to be honest, I was not impressed with the organization of the book.

The couple of chapters that I went through (mainly about abstraction, composition) did not seem to cover the concepts clearly. Maybe I was having a high expectation on the book looking at the title. The title suggested to me that it would tell me how to think in terms of objects, but ended up to be another book explaining the standard concepts (not that it's bad though).

I also looked at

Object Thinking, Dave West
Object Technology: A Manager's Guide, David A Taylor

without much success.

Let me also mention here that the books mentioned above probably have a difference audience and may satisfy them quite nicely. So don't take my comments as putting down these books.

I am currently eyeing


Object Design: Roles Responsibilities, and Collaborations
by Rebecca Wirfs-Brock,
Alan McKean



Designing Object-Oriented Software
by Rebecca Wirfs-Brock, Brian Wilkerson, Lauren Wiener


and


Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process (2nd Edition)
by Craig Larman


I have the third book and it looks at OOP mostly from UML perspective.

Has anyone read or used the first two books? If so, can you please let me know if it's good?

Thanks.
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sujatha Kumar:
"Object Oriented Thought process" is an excellent book covering the fundamentals.



Mmm, I feel like the explanation of association, aggregation and composition topics in the book is a bit difficult to understand... Those topics are well-explained in Fowler's UML Distilled book as well... As for me, I prefer Fowler's book much more than "Object Oriented Thought process"...

Just my 2 cents...
 
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recommend Chapter 2 of [i]The C++ Programming Language{/i] by Stroustrup. It's as applicable to Java as C++, and it will start with things your audience is familiar with, and build up to and through object oriented programming, showing how OO will help make their jobs easier.
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic