Object Oriented Programming Concepts |
Search [ihhjjice] |
||
Previous Next Xoc Software Training RVBA Conventions Maya Calendar Program Company Information Tools ASP.NET and Other Tips Articles Architecting, Writing, and Maintaining Large Programs in Visual Basic MiscellaneousConstructing a 404 Handler for IIS Constructing a Links Page using XML Differences between XHTML 1.0 and HTML 4.0 ECMA, ISO, IETF RFCs, and Other Standards Home Automation Cataloging a Library Implementing a Privacy Policy Using P3P Mining Web Server Logs Object Oriented Programming Concepts Recommended Computer Books Recommended Internet Explorer Settings Review of the Compaq iPaq 3800 Series: H3830, H3835, H3850, H3870, H3875 Things to Consider when Internationalizing an Application Understanding the Internet Jigsaw Puzzle Using the Localization Toolkit Xoc Scale Search Engine Ratings Foldit Temporary Download Site Downloads Links Search Other Xoc managed sites: http://grr.xoc.net http://www.986faq.com http://www.mayainfo.org https://mayacalendar.xoc.net http://www.yachtslog.com |
From a posting I made on http://www.webmasterworld.com.
Object oriented programming (OOP) takes a different mindset than procedural programming, or even event-driven programming. I think it really took me six months after I was exposed to the features that I really got the philosophy of object oriented programming. One of the problems with OOP is that the terminology is intimidating. In the Visual Basic courses I teach, I like the use an analogy: Library: Box of cookie cutters Class: Cookie cutter Object: Cookie Memory: Cookie dough Instantiate: Cut a cookie with the cutter Object Variable: a single minded 3-year old; i.e. a cookie pointer..."look, daddy, a cookie", pointing at the cookie, and can only point at one cookie at a time. Now that is Visual Basic terminology, but other languages have similar terms. This analogy holds up pretty well and helped me understand how it all works. The thing that took a while form me to get, is that I started by treating the objects as somewhat sophisticated structs. But as time went on, I realized that any time you want to pull information from a property to do a calculation on it, should probably be turned into a method. Another analogy that helped: Object: Noun (specifically a direct object) Property: Adjective Method: Transitive Verb For example: Class: Book Object: chris pointing at a specific Book Property: cover is black Property: title is Emphyrio Property: author is Jack Vance Method: Open Method: Read(Page 12) Method: Close As in Dim chris As Book Set chris = New Book chris.cover = vbBlack chris.title = "Emphyrio" chris.author = "Jack Vance" Call chris.Open() Call chris.Read(Page:=12) Call chris.Close() which would be valid VB syntax. The Read method basically is a command that tells VB "You read the book pointed at by my 3 year old named chris (and you'll want page 12)" Or If chris.Title = "Emphyrio" Then Which asks if the book that chris is pointing has a title of Emphyrio. |
||
Top |
[www.xoc.net] Copyright © 1997-2023 by Gregory Reddick . All Rights Reserved. 02/20/09 01:28 |