Frameworks And Abstraction

You’ll have to excuse me, I’m an engineer at heart. I like designing things—over-designing things, even. I also like big, smart sounding titles.

What I want to talk about today has to deal with web development; this is what I was hired to do here at Anchor, and it’s also something I’m passionate about. The title is not as complicated as it sounds, though, and it’s something you might want to know about if you ever have to work with programmers as this comes up a lot with larger projects.

First, I’d like to give some background about my field. Programming is mostly a problem-solving job. It involves varying levels of science and math, and the ability to reason and break down complex problems into smaller ones. The parallels between it and structural engineering mean it sometimes shares a few terms and concepts.

You could say this is where we stole the term framework from. A framework is the foundation that we build on. They come in different shapes and sizes, but are usually a sturdy, reusable base that lets us build onto—and more importantly add onto—web applications quickly. This lets us make consistent, healthy and more secure web apps. This consistency becomes especially critical for us years later when changes are still being made to the application.

There are always multiple solutions to the same problem, and so it’s common that repeated solutions and patterns can be scattered throughout an application. Interestingly, this often poses a problem. When you begin to duplicate your work in multiple areas, you have a higher chance for error, and it becomes increasingly cumbersome to make changes. This happens so often that it can become a painfully messy situation. Multiple programmers and challenging deadlines can compound the problem.

Using a framework is a proactive solution to these issues of repetition. Frameworks will force you to conform to different rules and patterns to prevent this (via abstraction, which I explain next.) Essentially, it will make it easier to conform to the DRY method, or Don’t Repeat Yourself.

Now we come to abstraction. This word probably looks a bit more foreign, but it’s used frequently in a lot of different areas of computer science. For the lack of better terms, it’s a way to break down a complex set of instructions into more humanistic terms. Abstraction is the difference between just saying “hi” and consciously thinking about all of the muscles, neurons and movement of the molecules in the air involved. With the former, I don’t have to describe all of the low-level actions involved in speech, but you will still understand it when I speak to you.

The same is true for programming. Through a layer of abstraction we can repeat highly complex, common actions that are adapted to our specific task. This makes it easier for us to say more with less from a programming standpoint. To sum this up, frameworks use abstraction to provide easy solutions to monotonous problems.

Practical Applications

After working on so many web sites from start to finish, you begin to realize that a lot of them have the same basic components. Registration forms and contact forms are two very common things to have on a web site. Rather than doing them over and over again, why not have a framework that generates them for you? Frameworks like Codeigniter or Kohana will help you rapidly make forms in a fraction of the time, and with tighter security.

Caveats

As I mentioned earlier on, frameworks can force a programmer into a new method of thinking and doing things. However, sometimes the inherent design of the selected framework will slow you down rather than help. There’s also an overwhelming number of frameworks out there, which makes it difficult for a programmer to know which one to specialize in. Some of the more popular ones include Kohana, CakePHP, Codeigniter and jQuery.

At Anchor, we use frameworks to rapidly deploy more secure sites. This is a huge benefit to both us and our clients because it shortens the overall site construction timeline and ensures that the site remains secure and easy to maintain in the future.