This post is part of a series aimed at bringing people up to speed in what’s going on today in application development.

 

In this post I just want to talk about some basic terminology that may be confusing if you are new to programming, or particularly if you are new to object-oriented programming.  When I first was getting into more advanced programming from my early VB days I didn’t know a lot of this stuff, and I had to learn a lot of it as I went, and do a lot of reading as well.  This was before blogs and wikipedia, so it was a little more difficult to get the information in an easy to digest package.  I had a lot of questions, and not a lot of answers.  So I’m going to try to help out anyone who is looking for the same guidance I was several years ago.

 

Object-oriented programming (OOP) – Object-oriented programming, or OOP, is a method of software development that is used to design systems by grouping conceptually related code into “objects”, often these objects are representations of corresponding real-world entities, such as an Employee or a Car.

 

Procedural programming – Procedural programming is likely the first “real” or structured programming you have done, where sequential statements of code are grouped in procedures (functions) which are called when needed.

 

Modular programming – Modular programming is often one of the first steps to bridging the gap between Procedural and Object Oriented programming.  In modular programming, related procedures are extracted into separate “modules” rather than being left in the main program.  In this way you can create “libraries” and reuse code.

 

Class – A class is a structural representation of a thing that defines data and behaviors.  In simple terms, a class is the code that represents an object.  Something being a “class” is not reliant on file structure, which is a common question I get.  Depending on the language of course, you can put many classes into one file, and you can even have a single class definition span multiple physical files.

 

Object – An object is an instance of a class that exists in memory and is actionable.  An object is a class at run-time.

 

Interface – An interface is similar to a class in that it defines behaviors and data, but it does not implement the behaviors directly, and an interface is not meant to be instantiated as an object.  Instead, a class can be said to implement and interface, in which case the interface becomes a contract for an expected set of behaviors and data that the implementing class will handle itself.

 

Cohesion – A measure of the relatedness of the code in a given class.  In OOP we like to strive for a high level of cohesion, meaning that a good class will represent one responsibility and perform all the tasks for that responsibility. 

 

Coupling – A measure of dependency.  Coupling is the degree to which one class will rely on another.  In a perfect system, we will have low coupling, which means that our objects are highly self-contained and don’t have to depend on other classes to do work (you can see how low (loose) coupling works in conjunction with high cohesion to make a good object).  This does not mean you should limit interaction between objects, it means you should try to avoid *requiring* it.

 

Constructor – The function of a class that is called when a class is instantiated.  Often this is an implicit function and doesn’t even exist in the code, called the default construtor.  However, the constructor can be defined explicitly so that certain behaviors and data can be set when the object is created.  The constructor can be recognized because it has the same name as the class and doesn’t define a return type.  ClassName().

 

Destructor – The other end of the object’s lifetime.  The destructor is called when the object is released and destroyed.  In some languages this is more important than others.  Particularly in a managed language, like any .Net language, you don’t often see destructors at work because the .net runtime handles the steps required to destroy your objects.  When you do see a destructor, it is usually defined the same as the constructor, except with a tilde in front like ~ClassName().

 

Garbage Collection – Garbage collection is the act of removing unused objects and data from memory.  Garbage Collection (GC) removes you from the ugly process of managing your application’s memory usage.

 

Managed Code – Managed code is a term describing code that runs in a Virtual Machine, compared to native or unmanaged code which runs directly as native binary code.  Managed code has the overhead of a runtime virtual machine, but brings benefits such as automatic memory management and an abstraction of the details of the underlying enviroment.  In windows development we talk about managed code being code that runs in the .net runtime, but outside of that anything that is non-native code, such as java, or interpreted languages, can be considered a type of “managed” code.

 

Design Pattern –  A design pattern is simply a defined and repeatable design solution to a common programming problem.  Design patterns aren’t code per se, but they define a proven recipe for creating the code to solve a given problem.  I’ll go over these in more detail in a later article.  Design patterns shouldn’t be confused with Algorithms, which are specific procedures for solving code problemns, whereas a design pattern is more like a blueprint for solving architecture problems.  Design patterns are so hot right now (even though they’ve been around for 20 years) and you probably use some of them without knowing it.

 

Strong Typing – This is going to be new to you if you come from a language background that supports weak typing, such as VB, Perl, JavaScript, and so on.  A strongly typed language places restrictions on the interactions of variables based on their types.  In a strongly typed language you have compile-time checking for type errors, you are required to explicitly do type conversion, and all data structures, including class instances, have a defined type which cannot be changed.

 

The next few posts will expand on the concepts of Object Oriented Programming and provide some more complete definitions there.  From there I plan to handle things like Patterns, Interfaces, and a few other things over the next couple of weeks.  If you are coming across this and would like to request a specific topic, drop me a line and let me know and I’ll see if I can put something together.


Tags: