[1]Diagram of how to create a running program logically:
Remember the last post i explained inheritance really well?(I hope). Well now i am going to go into encapsulation. The hiding of data and procedures(methods) inside a class is achieved through encapsulation. Visualize the class as a capsule around its data and procedures. The usually words to create this feature is to use "Private" or "Public" keywords (programming code) in code. Example diagram i made in Visio (graphical flowchart-design software by Microsoft):
Next in line is abstraction. It is a general model of something that includes only the general characteristics of an object. For example, the term dog is an abstraction. It defines a general type of animal. The term captures the essence of what all dogs are without specifying the detailed characteristics of any particular breed of dog or any individual animal. In real life there are specific dogs, each sharing common characteristics such as paws and fur. Lets say Dan owns a rooweiler named Menance and Jimmy owned a poodle named Fluffy. In this analogy, the abstraction (dog), is like a data type and the specific dogs(Menance, and Fluffy) are instances of the type. Here is a good site for another way to explain abstraction--site
Lastly i want to talk about polymorphism. No its not morphing time Power Rangers! Polymorphism is defining some common behavior for multiple types of objects and having a common code-base, which may or may not care about the different variation of a type. For example, a dog kennel takes domesticated dogs. There are many breeds of dogs, but the kennel knows it can take any 4 legged dog and be compatible. Dog in general is polymorphic in a way. This site explains polymorphism in more detail--site
Overall, don't expect you the reader to grasp this concept right away. It is very high-level programming, and i am still trying to master it as well, but once mastered, your programs will become exquisite. These explainations are just part of what can be done with OOP.
[1]Programming Logic and Design, Introductory, Fourth Edition
[2]Starting out with Visual Basics 2008 fourth edition
No comments:
Post a Comment