Geeks With Blogs
Codekiwi Just a the musings of a kiwi who loves to code...

My current contract is drawing to a close so I once again find myself in the unenvieable position of looking around for my next challenge (I hate interviewing).

One of the positions I applied for was with a recruitment firm called Super Coders (novel concept, IT recruitment by an outfit that, on the surface anyways, seem to understand coding). Whilst having a look around their site, I came upon this article on things you must know about OO. The upshot of the article is this list of 23 topics (which originally came from a Steve Yegge article):

  1. class, object (and the difference between the two)
  2. instantiation
  3. method (as opposed to, say, a C function)
  4. virtual method, pure virtual method
  5. class/static method
  6. static/class initializer
  7. constructor
  8. destructor/finalizer
  9. superclass or base class
  10. subclass or derived class
  11. inheritance
  12. encapsulation
  13. multiple inheritance (and give an example)
  14. delegation/forwarding
  15. composition/aggregation
  16. abstract class
  17. interface/protocol (and different from abstract class)
  18. method overriding
  19. method overloading (and difference from overriding)
  20. polymorphism (without resorting to examples)
  21. is-a versus has-a relationships (with examples)
  22. method signatures (what's included in one)
  23. method visibility (e.g. public/private/other)

So I thought as I am once more heading into the murky waters that is Contactor job hunting, I thought I would test myself. I surprised myself with the results,

It was more difficult than I anticipated.

Firstly I am primarily a VB developer so converting the concepts into VB friendly buzzwords first would have made it easier.

However for the most part I found it difficult, not because I didn't understand these concepts but more that even though I use most of them daily and read about them often, it is only during interviews that it is required to verbalise them.

I found this a great little exercise to get the grey matter churning again so I encourage you to give this a go, either in your own blog or in the comments. also any subjects that I have gotten wrong, please feel free to berate/teach me in the comments.

I treated this as a semi open book test, ie I attempted the topic but if I failed I resorted to google, however I only wanted to use google as a backup to my knowlege rather than to learn the topic.

class, object (and the difference between the two)
A class is a "blueprint" for an object. an object is an instance of a class

instantiation
instantiation is when a class is used to create an instance of an object, it is good practice to keep the instantiation responsibility for dependencies in a centrally managed location (DI and IOC)

method (as opposed to, say, a C function)
a method is a proceedure built into a class and can (assuming visibility) be called on an instance of an object. methods are split into two types, ones that produce a value and ones that don't

virtual method, pure virtual method (*Google only required because VB uses the term Overridable or MustOverride instead of virtual and pure virtual)
A virtual function is a method of a base class that can be overridden in a class that inherits from it, a pure virtual method must be overridden to be used

class/static method
a static method or class is one that can be accessed without instantiation, local methods or variables are not available in these

static/class initializer
used in the singleton pattern is a static method that returns an instance of its class

constructor
a special method (called new) that is used to create an instance of a class

destructor/finalizer
a special method that is called when an object is no longer required and its resources are to be freed up

superclass or base class
a base class in inheritance is the class that the child inherits from, with inheritance the derived class makes available the visible methods and properties of the base class

subclass or derived class
the derived class is the clild in the inheritance relationship, the relationship is one way a base class does not have access to a child classes methods or properties

inheritance
the technique of inheriting from a base class to create a derived class that is a combination of the child and parent classes

encapsulation (* One of the most basic OO concepts but I always foget the explanation of the buzzword)
encapsulation is the technique of only making available the infomation that the user (or coder) needs to see, internal methods should stay internal

multiple inheritance (and give an example) (* not an excuse but I haven't used this as it is not available in my chosen environment)
the ability for a derived class to inherit from multiple base classes, this feature is not available in C# or VB, instead chained inheritance is available, ie john inherits from male which inherits from person which inherits from mammal. whereas in languages supporting multiple inheritance John could inherit from male, person and mammal

delegation/forwarding
delegation is the technique of assigning a subroutine of work to be completed when an event occurs, this is instead of staticly defining programitic flow, this is done by assigning the location of the subroutine at runtime, an extension of this is annonymous delegates in which the entire method can be dynamically assigned.

composition/aggregation (*)
aggregation is when an object has a reference to another object but those objects have a life cycle of their own, composition is when an object is responsibile for the creation and lifecycle of a child object

abstract class
an abstact class is a class that must be inherited from before instantiation (ie cannot be directly instantiated)

interface/protocol (and different from abstract class)
an interface is a contract that an implementation must adhere to, an interface contains methods and properties that must exist in the implemented class to be valid, an abstract class may contain implementations of the methods whereas an interface is just a specificiation

method overriding
when a derived class overrides the behaviour of a method in its base class

method overloading (and difference from overriding)
the technique of creating multiple methods of the same name within a class varying by signatiure

polymorphism (without resorting to examples) (* I can never remember this)
Polymorphisim or subtype polymorphisim is the ability of one type to be used as another, this can be done using base classes or interfaces.

is-a versus has-a relationships (with examples)
the is-a/has-a rule is a simple test to decide weather two classes are related via inheritance or composition for example a boeing 747 is-a plane (747 inherits from plane) and a 747 has-a cockpit (747 contains a property of type cockpit)

method signatures (what's included in one)
A methods signature is the combination of arguments that are passed into a method

method visibility (e.g. public/private/other)
Method visiblity aka scope is the defining of who and what can see/access a method or property, this can be limited by class, inheritance or physical/library boundries.

*In the interest of full disclosure these topics are ones that I needed a little help (ie thanks google). also ctrl-c was not used in the production of these answers ;P

  1. class, object (and the difference between the two)
  2. instantiation
  3. method (as opposed to, say, a C function)
  4. virtual method, pure virtual method
  5. class/static method
  6. static/class initializer
  7. constructor
  8. destructor/finalizer
  9. superclass or base class
  10. subclass or derived class
  11. inheritance
  12. encapsulation
  13. multiple inheritance (and give an example)
  14. delegation/forwarding
  15. composition/aggregation
  16. abstract class
  17. interface/protocol (and different from abstract class)
  18. method overriding
  19. method overloading (and difference from overriding)
  20. polymorphism (without resorting to examples)
  21. is-a versus has-a relationships (with examples)
  22. method signatures (what's included in one)
  23. method visibility (e.g. public/private/other)

 

Posted on Sunday, June 27, 2010 11:19 PM Geek Interest , ASP.Net | Back to top


Comments on this post: OO Refresher Course

No comments posted yet.
Your comment:
 (will show your gravatar)
 


Copyright © Codekiwi | Powered by: GeeksWithBlogs.net | Join free