Tuesday, March 1, 2011

When Religion and Coding collide!

package inspired.flash.srp.angel

This is the type of idea that can get everyone angry at me.
For some reason, (ok, it's not really a mystery) people have a hard time following SRP.
I have been inspired by a sudden Flash of an idea to fix this problem.

Now, before I begin I must explain a simple concept in Jewish Mysticism:
  Some books about Judaism teach that the word מלך (Angel) is related to the work משלך (Messenger). From this connection (and a few other ideas) we are taught that an angel is only able to do one thing.

So, here is my suggestion.  Lets get rid of the names "Function" or "Method" and instead we should start programming Angels!  Our Angels can only do one thing, and we can anthropomorphize(sp?) our angels and teach new programmers that if we make a second angel do the same thing, or we force an angel to do more than one thing, then it will lose it's wings and become sad and perhaps even become a demon!  And one day, our beutiful angel will turn out to be our worst nightmare.

When you program angels, the SRP becomes obvious, and clean code becomes a necessity of cosmic importance!



  1. I'm an athiest. Compelling evidence that I should care about angels please?

    Meanwhile, the evidence for caring for my classes is prolific. I don't need no stinkin' angels :D

    (In other news, where's your discus/twitter comment-as profiles?)

  2. Last thing first...
    I'm not sure.. how do I set that up? I'm just using the default blogger settings for now.

    Now to the other point. If you already know the value of clean code then you are likely an experienced programmer. However, there is a point in everyone's life when the "trust me from experience" arguments don't work. It is those people who this idea is directed at.

    Now you might continue to argue that as an Athiest this is all just sillyness. Well, I'd argue that there are thousands of years of collective cultural associations with Angels and it isn't something that needs to be explicitly taught. Attached to angels is a whole lexicon of metaphors and design patterns that most English speakers can understand without requiring further explanation. We can talk about fallen angels (good code that has gone sour) and guardian angels (error handling code) with less words and time spent explaining why these things are needed, useful, or things we want to avoid.

    Also remember that as a minority, just because something doesn't apply well to yourself, doesn't mean its not good for the majority of others. (I speak from the position of being a minority myself)

  3. Dammit! I forgot I'm supposed to be inflammatory so I get more comments and boost my perception of popularity.

    Maybe this will do...
    The problem with using Atheist lenses is you have to re-adapt language and cultural history, making you sound like a snob to the masses, and an unlearned fool to non-atheists. Hope that works.

  4. Avi,

    The problem is, coding Angels is often more expensive than coding demons. It requires better planning, more time, everyone's buy-in, discipline, documentation, good memory of where the current Angels reside, and how to quickly find them, etc. More often than not, our bosses are Devils that preffer fast demons to slow and expensive Angels. Maybe with the comming of the programming Messiah, all that will change, but Neo died in The Matrix 3, so the wait for that messianic era continues.

  5. Like I said, try puppies, closer to more people. If that doesn't work, there's always Genitals, it's been too long since people were told that they're code is uglier than genital herpes.

    Hear me folks? Care for your code like it was your bits!

  6. Ok Rasheed...let's try it your way! If bad code is like genital herpes, does it mean that good code is like the balls of a virgin young boy? If that's true, then great coders will always code for the Catholic church. And here we are...back to religion. It's like an endless loop!

  7. Allen, you make a very good point. I'm going to write a blog post responding to that now.

    Rasheed: I don't think you put much thought into puppy or genitals idea. A puppy is more like a full program. Its got the legs the tongue, the cute eyes, the fuzzy fur. All this stuff breaks the SRP. Also, when you think of "a puppy" you internally feel that you are dealing with only "one thing" but as I just showed, its really very many things. Same thing with genitals. Pro-creation, or expunging? Not only does it break SRP, but they aren't even related tasks! Even genitals are comprised of many smaller pieces, each with a single responsibility which come together to make the gestalt.

    Angels on the other hand, are pure simple concepts, with the ability to do only one thing... even (as the link I provided) that one thing is complicated and has emergent behavior.