Showing posts with label object-oriented programming. Show all posts
Showing posts with label object-oriented programming. Show all posts

Thursday, August 8, 2013

Writing Small Methods... No, I Mean Really Small Methods

Mouse and Elephant

Like many programmers, I've typically aimed to keep my methods small. On average, my methods have been probably around 8-12 lines long. But lately, I've had a blast

Wednesday, June 26, 2013

Unit Testing: What's a Unit?

We all know that we should be writing unit tests, but have you ever thought about what a unit is, exactly? Most definitions out there, including the one on Wikipedia, describe it as the smallest piece of code that can be tested.

But what does that mean? The answer to that question will

Tuesday, May 21, 2013

3½ Ways to Reuse Code in ColdFusion Components

Programming languages give us a variety of options for sharing code among multiple classes. In this article, let's look at the 3½ ways that ColdFusion allows us to get code reuse in our components.

Let's start with a problem – we've got two

Thursday, January 17, 2013

How to Sell Them on Your Design

So, you've been tasked with restructuring your object model. After hours of thinking through the implications of each design decision, you've sketched up your new object model in a UML class diagram. You're ready to present it to your peers! Now, how are you going to sell them on it?

Take a look at

Wednesday, December 5, 2012

Inheritance, Interfaces, and Abstraction in Two Dimensions

Previously, we explored the benefits of using interfaces in object oriented programming, noting that the key benefit was polymorphism that's detached from inheritance trees. Today I wanted to take a quick look at the relationship of inheritance and interfaces from another angle.

Both inheritance and interfaces are ways to achieve abstraction, but they have different trade-offs, and it's good to know what they are, so that when you're designing your software, you use the right tool for the job.

The Disadvantage of Inheritance

As we saw previously, inheritance has a particularly crippling disadvantage -- once you

Wednesday, November 28, 2012

Why use Interfaces in Object-Oriented Programming (OOP)?

Previously, we looked at what interfaces are, and how some languages provide an Interface type, allowing you to formalize the exposed parts of your classes. Today we're going to consider the problems that an Interface type is designed to solve.

So, why would you want to use an Interface?

Interfaces give you polymorphism that's unshackled from any inheritance hierarchy.

Now, polymorphism is one of those

Wednesday, November 7, 2012

What are Interfaces in Object-Oriented Programming (OOP)?

Interfaces in the Real World

Before we dive into OOP, let's think about interfaces in the real world.

This is an interface:

Light Switch

This is also an interface:

Manual Transmission

And, so is this:

Door Knob with Keyhole

These are all interfaces that allow me, an external consumer, to interact with the system behind it.

  • The light switch is the interface that allows me to turn a light on or off.
  • The gear shift in my car is the interface that allows me to interact with the transmission. (Yes, I’m a manual transmission guy!)
  • The keyhole is my interface to the locking system of my door. It's what I interact with in order to lock or unlock my door.

It's important to notice that,

Wednesday, October 17, 2012

Is ColdFusion an Object-Oriented Language?

ColdFusion's been around for a long time now. Having over a dozen years of CF development under my belt, I suppose I'm a bit of a veteran, and I've seen it through a number of significant milestones. One question that I hear from time to time is this: "Is ColdFusion an Object-Oriented Language?"

Profile Picture
Dave Leeds
My Hobbies:
  • Programming
  • Cartooning
  • Music Writing
Full Profile