
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
One guy's bold adventures in the world of computer programming
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
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
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
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
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.
As we saw previously, inheritance has a particularly crippling disadvantage -- once you
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.
Interfaces give you polymorphism that's unshackled from any inheritance hierarchy.
Now, polymorphism is one of those
Before we dive into OOP, let's think about interfaces in the real world.
This is an interface:
This is also an interface:
And, so is this:
These are all interfaces that allow me, an external consumer, to interact with the system behind it.
It's important to notice that,
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?"