This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
If the power of object oriented based language development mocks that of real-world objects state and behavior and how objects interact with one another and are inherited from one another, why does Object Orientation in development seem not as intuitive as it should to me? That said, in 40 years for example, will OO development be much more intuitive? Or maybe is it that one or more languages still have yet to evolve? Or, is there a language not even yet developed that will be easier and more comprehensive that any that exist at this moment in time?
I am intrigued by the need and vital importance to learn fundamental concepts of object orientation before actually working in OO development for pay. I am steeped in learning Java at this point, and it does not seem to be sinking in as much as I would like it to (actually need it to). I am not that familiar with other OO languages. I was under the impression that the power of, say, Java is that it maps well to a given problem domain. And that, objects match up well to real world representation of automobiles, books, fish, houses, etc..
The evolution of the languages are intriguing. You can already see how class syntax has evolved in some small but meaningful ways. The concept of accessor methods (getters and setters) can be implemented in some languages as properties. It will be very interesting to see what O-O languages (or whatever supersedes them) look like in 5 years. I was confused by many of the O-O features that I was exposed to as I transitioned from a C programmer many years ago.
The real question is whether or not you start teaching programming with object concepts first or structured constructs like variables, loops, conditions, etc. I can see both side of the question. Often, many experienced Java programmers benefit by taking a step back and revisiting the concepts. Sometimes, people like to start first with questions like what is an object, what is inheritance, etc.
The intent of the Object-Oriented Though Process is to look at programming from a higher level and use the structured constructs to help teach the object concepts such as encapsulation, polymorphism, composition and inheritance.
Joined: Apr 08, 2013
Okay, this is interesting and has my attention.
Oftentimes, I seem to come to the conclusion that I need to understand more of the sequence of logic as a program is kicked off. I find myself doing debugging in the IDE step over step just to try and see where the flow of logic is going. And, then use that to validate the OO concepts and practice.
While I have not programmed in C or C++, my understanding is that they are more of procedural (sequential). With Java, for example, a program can jump all over the place. BUT/HOWEVER, the focus of this topic (Object Orientation) may lead me to get value out of taking a step back, so to speak, and believe that as I increasingly gain understanding in such things as polymorphism, inheritance, encapsulation, construction, and variable scope, it may make the logical sequence of program flow be easier to understand and less need to focus in that aspect by itself (without first seeking to really understand OO).
Joined: May 01, 2013
One of the really interesting projects I have been following for years now is the Alice project based at Carnegie Melon. I have made many presentations to high school and college kids about this. It is a graphical approach to learning to program - primarily using objects. Anyway, you may be interested in the approach: http://www.alice.org/index.php.
One thing when I try to teach intro to programming is that I want to get the students to get really interested - really quickly. If I start with the design stuff at the beginning I seem to lose many. Thus, over the years, I tend to start off with some structured code doing some loops, conditions, etc and then move into the objects in about week 3. Perhaps they still need to understand what a variable is first.
I am currently taking an online course in Python programming and I have to say it has been very interesting to see the different approaches people take in attempting to apply OO concepts. Last week's project, for example, was a game of Blackjack. The instructors had given three classes for students to start with: Card, Hand, and Deck. The Card and Hand classes had draw() methods that students had to implement, among others. One rule in Blackjack is that one of the dealer's cards (the "hole" card) must remain face down while the player(s) are given a chance to add cards to their hands. Once the player is satisfied with his hand (which is drawn with all cards face up), the dealer's hole card is revealed.
Just this one aspect of the game created a lot of discussion and confusion among the students. One approach for drawing the hole card was to just overlay an image of the card back on the image of the card face. I contended that while this was a workable solution, it was not OO. Others suggested a DealerHand vs a PlayerHand with logic in the DealerHand to specialize the draw() method to account for the hole card. Yet others suggested a BlackjackHand (vs a possible PokerHand or GinRummyHand).
This is the code skeleton in Java:
I came up with a different solution since the ones mentioned above had certain "smells" to them but I'd be interested to see how you would guide the thought process in coming up with a workable solution to this seemingly simple problem, Matt.
BTW, it seems to me that being able to create something that works in a short amount of time is a really good way to keep the students interested. The Python course I'm taking has students using a relatively simple online development environment, with program source being saved on the cloud. With this tool, you are able to write and run Python programs and see the results in a graphical UI immediately and it's all browser based. You might want to check it out and get some ideas from there. It's on http://coursera.org and it's the "Introduction to Interactive Programming with Python" offering from Rice University.