This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
im currently teaching java, but having some difficulty on how to share OOP concepts with my students, can you help me on some analogy or resources that i can use. thanks. i wish to buy head first java, but im currently here at the philippines, and it will take 2 months before the products gets here.
Maybe step away from programming languages and work on the basic concepts of object responsibilities and message passing. Have some people "play object" and hand them messages on 3x5 cards. See if you can get several to collaborate on a simple task by message passing. Switch to speaking a simple request and tossing a ball for message passing. Introduce data late in the game!
Here are a couple papers I really liked ... the funny stories might inspire you in this game playing direction ...
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
Joined: Sep 29, 2003
thank you for replying, i enjoyed some of the links especially on Law OF Demeter, sir i didn't understand much of Knights Principle, can you shed some light to my mind. thanks again.
I will try to play with BlueJ, thanks..
Joined: Jan 29, 2003
Knight's stories were fun ways to explain some serious ideas. For example "Never do any work that you can get someone else to do for you" is a neat object concept. In other languages, say COBOL or C or Perl, it's tempting to write a program that solves an entire problem. It knows everything, does everything. (It's certainly possible to modularize into smaller chunks but easy to forget to.)
In good OO it's nice for a program to say exactly what it wants to do with minimal exposure of details about how it gets done. Push the tricky bits of the job off to another object. Focus on behavior - what you want that other object to do for you. And when you look inside that object you find it is doing the very same thing ... expressing its purpose or objective as clearly as possible and pushing the details off to another object.
I think one of those two papers mentions that you can carry this to absurd extremes and wind up with a cloud of little objects that appear to do nothing but call one another. I've been there - neck deep in Smalltalk code with thousands of 3-line methods that all seemed to do absolutely nothing.
thousands of 3-line methods that all seemed to do absolutely nothing Where I've worked we've called this "ravioli code", a spin on the well-known problems of "spaghetti code". I can only assume that this a fairly widespread term.
Man, I remember first trying to learn OO programming. It was quite possibly the most frustrating this I've ever had to do in my short time programming. I just "didn't get it" until my Eureka! moment (which happened to be in the shower of my girlfriend's dorm - funny how you remember such things, isn't it) and then everything just made sense. I have a feeling, for most people, it's probably similar. Until you "get" OO principles, programming using them is like finding your way through a maze in the dark - you can do it, but it's more random luck than skill.
One of my most valuable examples has been to start with "real life" constructs and try to have your students describe them as objects. What data might a student have (Name, SSN, GPA, etc.) and what methods might a student perform (getName, updateGPA, takeExam, skipClass, etc.)? Then, try making a program using those objects - it can be quite contrived, if need be:
Yeah, maybe I'm just spouting useless garbage, but it makes sense to me. In addition, when it comes to inheritance and polymoprhism, I love to use animals. A Cat is an Animal and a Dog is an Animal, but a Cat is not a Dog and vice-versa. You get the idea. Animals just seem to work really well for that principle.
Anyway, maybe that helped and maybe it didn't. Best of luck.
thank you for the knowledge that you have shared, its worth it. Anyway i decided to use BlueJ, next semester. Im currently the senior instructor on teaching Java here at STI College Caloocan. And planning to expand it by the coming semester. Do you think BlueJ is good, to help my student learn OOP and Java. Do you have any sites that i can visit for more samples, though i got a copy of Head First Java, from a friend here in the Phillipines, he allowed me to have it upto late August this year, YAHOO!!
thanks again, corey.
PS. its really fun to read that book.
Joined: Jan 08, 2004
BlueJ is good. I was a part time lecturer at a computer institute.So when u generally teach someone OOP concepts using java at the start itself you dont want to explain static and the use of the main method.One thing i liked about using BlueJ is the fact you can put these concepts a bit later after explaining the key concepts.(You dont need a static void main method to begin a program in BlueJ)
Joined: Jan 29, 2003
Teaching tools for Java ... I've given a few seconds thought to something like:
The instructor passes out unit tests. The assignment is to make them run.
Students submit solutions - maybe a zip of a directory tree
Instructor can put solutions in a set of directories named by student id and select one at a time to run or maybe all of them.
Would need a little framework in which students run their classes (no main()!) and a variation on that for the instructor. Or maybe exactly the same code. Anybody know anything like that? Would it sound fun to build together?
I was a student in Java class, and my first impression was this: "I hate this language! I just want to learn C#!"
But now look at me! I'm an addicted FREAK lol. Ok not freak but you know what I mean! (I hope!)
But you see I didn't know the importance, this is what you need to do as a teacher: 1) Brainwash your kids into thinking that Java is the best language. 2) Tell them it's the best paying job 3) Tell them it's where all or most of the jobs are 4) And if they want to learn C# instead of Java, tell them that's Ok, then they'll probably come back crawling because they've figured out that they need to learn Java first.
One thing that I did that seemed to work out okay is I brought some aluminum cookie cutters to class and a bunch of cookies that had been cut from them then baked and decorated. I explained that the cookie cutter is like the 'class' and each cookie that it cuts is like an 'object'. Cookies inherit traits from the cutter (shape) but they can also have their own unique state (frosting color, sprinkles, etc.).
I don't know if they learned anything, but we had fun eating the objects when I was done.