What do you think about Object Oriented programming?
Joined: Jan 12, 2001
Hello buddies, I've been learning java about 3 three months and I found java is a very powerful language, you can use this language to program whatever logic in your mind. To learn how to use a object, how to create a method, a class, an instance of a class, event hander, it is getting easier as long as you do more examples, but I start to doubt do i really know what i did, yup i know how to make my program works, but I found out most of my programs is not object oriented at all, my programs are more like structrue or top down program. I am not sure if any beginer experience the same feeling as I do. I think i need some good guidelines of how to start to write an object oriented program.
Thank you very much! I will greatly appreciate for your reply. Mindy An extra question: 1. how to call a method from another class? it is like that: classname.methodname(); Thank you again!
Joined: Sep 29, 2000
Excellant topic. So good that we have a WHOLE forum to talk about this. It is called OO, Patterns, UML and Refactoring. The Patterns that they talk about there are OO patterns that can be re-used. I think that studying up on those would be a good first step in thinking more OO like. The GoF book (Gang of Four)(Design Patterns by Gamma et al.) is the one that I am reading. See this page at the BunkHouse for other good references. http://www.javaranch.com/bunkhouse/bunkhouse_Design.jsp
"JavaRanch, where the deer and the Certified play" - David O'Meara
Mindy, I think we all have the same problem. It takes some time and-as I hear-not all so called OOP programmers are good at OOP'ing. Johannes wrote a lot about procedural languages and the bad habbits you inherit from using them. I think I'm having the same problems. The past three years, I've only though procedurally (FORTRAN77) . But I think we'll all get there --> OOP. Stuart.
Joined: Feb 03, 2001
I think to understand OOP you have to change the way you think. I did 2 years of C before getting a job in java. It took me 2 months (reading books and doing java at home) to do the 'paradigms switch'. The best way to make the switch is to read books about ooad. The Gof book might be a little too hard for a beginner. Maybe thinking in java by Bruce Eckel or some OOP introductory book would be best. later
Joined: Oct 21, 2000
Mindy, I also have the same "problem". I dont really think much about code reuseability partly because everything I have written so far is for my own sites. In fact I read a tutorial called "Dukes bookstore" before writing my "Magic Shop" and first thing I did was throw out the ShoppingCartItem and ShoppingCart classes and add everything straight into the session making it not directly reusable. I am just now starting to understand a little better. My rationalization is "Oh well if I want to use it again I will change it at that time". Top down procedural is just the way I am used to thinking I think the recommendation to read about patterns will help. One good thing about it is that I'm not concerned about sharing my code because they will have to copy, paste and edit to use it anyway which is fine with me [This message has been edited by Randall Twede (edited March 24, 2001).]