The day I fell in love with CSS

I can still remember how I celebrated Canada Day 4 years ago (July 1st, 2005).  I am not necessarily proud of how I spent my time but it was definitely memorable. I woke up around 9:30am that day, went outside and smelled the fresh air.  It was a warm 23 degree and the sun was shinning.  I read the first few pages of the newspaper, cracked open a Corona, said goodbye to the sunshine and retired to my computer in the basement not to see the light again until 8:00pm that night.

I spent the better part of 7 hours learning CSS (Cascading Style Sheets) that day.  If you are a follower of the Pragmatic Programmers (and I strongly suggest reading some of their work, namely The Pragmatic Programmer and Pragmatic Thinking and Learning) and the Dreyfus model of skill acquisition, I climbed from an advanced beginner to proficient that day.  In fact, I dare say I almost became an expert.

It was one of those times that you read about, when you are so engrossed in what you are doing that you loose track of time.  Eckhart Tolle would say that for a brief moment, my inner and outer purpose were connected and I experienced true presence, Deepak Chopra might say that I entered the timeless now and drew energy from the source of life itself to sustain myself that day.  My friends might say that I was a total looser for wasting one of the nicest days in recent years, in a cold dark basement learning a language that they learned in Grade 9 tech class.  Either way, something happened that day that has had a profound effect on my life as a programmer.  I fell in love with a language that is overlooked by so many.  I fell in love with CSS and have been hooked on making web sites ever since.

CSS does so many things right.  It is one of the purest forms of the MVC paradigm to date where your model, HTML, is decoupled from your view, CSS.  Granted you can easily couple them by using the <style> tag or even worse the style=” attribute,  for the most part it’s very easy to convince someone how beneficial it is to have your HTML and CSS in different files.  CSS, like HTML, is open source.  By its very nature it can be looked at and studied.  In fact, one of the most common things I do with the Developer Toolbar in FireFox is look at the CSS source to see how certain sites achieved fantastic effects, normally, the code is much simpler than it appears.  It also has such an intuitive way of cascading effects onto a page.  This kind of behavior is so simple but so powerful at the same time.  I am sure I can speak for all designers who love CSS when I say that there have been times programming in a desktop environment where you have wished for something as elegant.

My only beef with CSS is that even for the most seasoned professionals, you tend to repeat yourself a lot.  Unless you attach a class variable to every element, there will often be times, when you must duplicate selector code which is quite livable but does seem redundant.  However, no need to worry.  CSS has many smart people backing it up.  Putting aside the hundreds if not thousands who have influenced its design and standards through special interest groups and by the W3C itself, people like Chris Eppstein have created ground breaking CSS frameworks like Compass that gives developers unprecedented control over the style of a page.  Some of these frameworks, such as Compass are built on top of SASS (Super Awesome Style Sheets).  SASS is a domain specific language for writing CSS that allows for custom mixins, dryer code, variables, math and formulas plus a whole lot more.  There has never been a better time to be web developer.

As summer is approaching I am excited for this Canada Day.  July 1st, 2009 will mark a turning point in my career as a developer.  I am three months away from completing my Masters degree, I am working on one of the most exciting projects I have ever had the chance to be a part of, and each day more and more opportunities are arising where I get use an old friend to bring me joy and happiness in my work.  We are always learning new technologies and disregarding the ones that don’t stick, I am happy to remember the day that I fell in love with CSS, it has defined a chapter in my life and opened up my world to all kinds of great opportunities.  So… what language will you learn today?  At best it might change your life, at worst, you wont have to think of a title for your next blog post.