cyborgzombieninjapirate


The first rule of Abstraction.

Posted on 31.01.2010 07:49 pm

Someone asked for a blog post on a more basic programming concept.

Abstraction is the bolt that holds the sanity of programmers together, and lack of it is the loose brick that will in the end make your whole project come tumbling down onto your head.

What is abstraction?

It's the transistors within a NAND gate.
It's the NAND gates within a flip-flop.
It's the flip-flops within an SRAM.

The makers of the SRAM chip were not deeply involved with the creation of the flip-flops, the makers of the flip-flops were not deeply involved with the creation of the NAND gates and so on.

They had the tools and made of it something great. Did they care how it worked exactly? No, they only cared about the output.

That is why Abstraction is so great, specially within the programming world. We create a complex machine to be used later by someone that does not care about it's inner workings.

While programming, we do not care about the amazing process that is taking place within our computers. We should be stunned at the fact that a movement of a mouse on the desk corresponds to a movement of an imaginary item on a screen. But we rarely do.

When creating a piece of software, abstraction allows you to build a single serving function. A collection of single serving functions allows for simple debugging, fast programming and unlimited reuse.

We move the problem into an isolated room and deal with it there. After it is dealt with, we do not talk about it again.

It's not like the code behind the movement of a mouse on a screen comes to mind every time we program. It's abstracted away from us, so we can evolve.

4 13    Like it or hate it?  -  Comment (5)


Brian

1 4  / Posted on 01.02.2010 01:10 pm

You seem to have left out the rule part of this "bit o fluff"

Ólafur Waage

2 3  / Posted on 01.02.2010 01:45 pm

It's an off shot reference to Fight Club. You do not talk about abstractions, you just do them and "forget" about them.

Edward Kmett

1 4  / Posted on 01.02.2010 07:29 pm

Which is all well and good until they leak - and all non-trivial abstractions leak.

http://www.joelonsoftware.com/articles/LeakyAbstractions.html

That said, this is good advice in general.

Kata

1 1  / Posted on 10.02.2010 01:13 pm

I decided I was reading about cute kittens...

Lucas McCoy

0 1  / Posted on 18.02.2010 02:26 am

@Edward Kmett: +1 for a very great article! Joel has a way of explaining things so simple that an 8 year old could understand them.

(Used for gravatar only, never displayed)

What is 2 + 6


Memory allocated for your request: 188.19 Kb
Process time: 0.0082190000000001 seconds