views:

171

answers:

6

I've read and understood the Head First OO books, including Design Patterns. I've read through the DP book a couple times now, and I really feel like I not only understand the patterns, but also have a pretty good "armchair-coder" grasp of why the patterns are the way they are...like why this pattern uses an interface or why that pattern uses inheritance, etc. Although when it comes to my own code, I don't really know when to use inheritance, or when to go with an interface. It still doesn't feel like I'm really OO-ing it in my own code. What's the next step?

So a little background might help. I'm a hardware designer, and all I've ever used (for almost 15 years) is procedural languages like VHDL, Verilog, Perl, Tcl, C, and whatever else I've had to pick up along the way.

With the latest verification and modeling languages like System Verilog and SystemC, we're getting large doses of OOP finally entering our world. The guys from SW backgrounds are able to pick this stuff up no problem, and have very firm grasps of best practices and how to really leverage all these new (to us) techniques. Of course, they suck at designing HW, so I'm not worried about my job security or anything.

However, I do want to learn and develop. I am comfortable using my OO languages at work (mostly System Verilog and some SystemC/C++), but I don't think I'm really getting how to best go about OO design. It always feels like either I'm just splitting up procedural code into classes, or I'm just using design patterns by rote instead of really designing.

Is the next step just to keep doing? Or are there more concepts to learn that will make all this kind of fall into place?

Other background that might help, I've started doing some Joomla/PHP/SQL stuff in my spare time, more as a hobby, although some folks have been paying me to do some stuff for them. I've been thinking about learning Javascript, or something like that to extend my knowledge in web development. Would it help to learn a more standard and widely adopted OO language?

A: 

You may have gotten yourself ready for the Real Thing -- the Gang of 4's Book. I think it's a step beyond the useful but introductory ones you've been studying.

Alex Martelli
+4  A: 

Design Patterns are useful after you are already good at using fundamental OO.

Would it help to learn a more standard and widely adopted OO language?

Yes it would.

Object-orientation is a little more difficult to do in Javascript, unless you're John Resig, and most people don't use Javascript that way anyway, unless they're using jQuery.

Use an interface when you want to define the way that users will interact with your class. The interface just contains definitions for methods and properties; you still have to implement them in a class.

Robert Harvey
+1 for "Design Patterns are useful after you are already good at using fundamental OO."
FrustratedWithFormsDesigner
If this is true, I've been putting the cart before the horse. I've got a personal project I've been thinking about doing that might be perfect to learn Java on. That seems to be the gold standard for OO languages, although it seems a little 90's.
SDGator
A: 

The best way to learn it is practice! :)

I would say start small, with C# or Java, and do some basic exercises (create some simple GUI forms or command-line apps, with a little user interaction maybe) until you're at least comfortable with the work environment. Then, pick a project that interests you (doesn't have to be work-related at all) and start working on it.

FrustratedWithFormsDesigner
A: 

You say that you "read through the DP book a couple of times". Did you really type (or download) and try out the examples, if not I would suggest to do so. Though you get a feeling that you have an idea of design patterns when you read through the book unless you write some code you won't "realize" usefulness of patterns.

sateesh
You're probably right. I just read the book. The examples were all Java-based. I could follow them pretty well, but I didn't know and wasn't interested in learning at the time. I might go back and learn Java, though, if it would help.
SDGator
A: 

I would recommend just picking something you want to do, and hacking away at it. Experience has always been my best teacher. Another thing you could do is read through some source code of an open source project in a language you are comfortable reading. This would give you some exposure to OOP and design patterns as applied to a domain problem.

If you are just learning OOP, Javascript is not the language you want to be using. Javascript implements a somewhat unique OOP model in prototypal inheritance. Combine that with Javascript takes more from functional programming languages than classical OO languages and you could set yourself up for some difficult learning. Javascript is a wonderful language but its not the ideal OO learning ground in my mind.

Mark Story
A: 

I agree with Robert Harvey that it sounds like you might want to study up on some basic object oriented principles before jumping straight into design patterns which requires a firm GRASP of OO-principles to be used effectively. If you don't have a solid domain model it's not going to be clear when a design pattern is appropriate. GRASP is an ancronym coined by Craig Larman in Applying UML and Patterns that stands for General Responsibility Assignment Patterns that he uses to describe the basic building blocks of OO design. I would highly recommend that book as a general introduction to both basic OO design and design patterns. I definitely feel like that book helped me make the leap from academic understanding to real world application.

MadMax1138