Categories
perspective

Pink Tickets

“To be permitted by your spouse to indulge in such activities that are normally banned in her absence”

Hah-roomphf. And so begins the battle for time and permission by The Spouse to be allowed to do things without him or her. Oh, the games! Listen to enough conversations and you get a glimpse into a lifetime of evolving strategy deployed on both “sides” of the union in order to achieve some kind of guilt-free, permissible indulgence. And that indulgence could be a race, an event, a night out with the girls or boys, a manicure, shopping trip, business adventure, training hour.. whatever. The battle for time away, the fight for that precious me-time just kind of happens and grows- and the memes and fauxy social circles don’t help either because then we end up not thinking that it is just the way it is and should be.

More hah-roomphf. Instead of cunningly working out your me-time, your precious away time, by paying cash or some penance (aka, planting landmines) why not fight for your spouse’s me-time? Yip. Go out of your way to make sure she/he can get to do the things that make him/her happy. Actively fight the schedule of busyness to make sure the person you love gets to be the best person they can be. The end.

Categories
programming Technology

Long Live the Desktop

No doubt about it, hardware is getting plain ridiculous in terms of throughput. Gone are the days of old where 64K RAM was *plenty*. That said, we still have this unyielding and biased fascination with RAM and processor speed when it comes to comparing computing devices on the market. Truth is, computing has changed sufficiently for us to largely ignore those specs and look elsewhere for performance gains, namely the hard drive.

“Hahaha”, I hear some tech enthusiasts saying. How does a hard drive speed up your computing? A bigger or even faster hard drive won’t make any difference to the speed of your processing: your processor does that, right? And the ability for you to multitask and have lots of applications open at once is directly dependent on how much RAM you have, right? Right? Computing 101. Well, no.

A regular hard drive can only spin so fast, at about 7200rpm. On a laptop, usually 5400rpm. In days of olde (when everybody learnt all there was to know about computers) the biggest bottlenecks were in fact processors and memory and out of memory errors were common place. To get past that, operating systems started using a technique called swopping which persisted some memory contents to the hard drive to make place for more memory. That way, every time you tabbed between applications, if the working memory for that application wasn’t immediately available, it would “restore” the working memory from the hard drive and swop out what was currently in memory. And by doing so, RAM now became a more pressing requirement. The more RAM you had, the less you had to regularly swop out.

But when you did need to swop out, you’d need more space on your hard drive to persist the swop because there was, simply put, more RAM needed to persist. Of course, the speed at which your device could handle that (directly related to the frequency of your personal requirements) also impacted on perceived performance. For most the time, adding more RAM and a better processor did increase performance. To a point. Memory speed and processor speeds are getting so fast now that in most devices, the RAM and processor are now waiting for the hard drive to spin fast enough and catch up with writing and reading from disk.

You want to give your computer real performance? Get an SSD. 3 years ago, I got an SSD for my MBP (Core 2 processor with 4GB RAM). At the time, it was on the edge of requiring an upgrade to a Core-i processor but the cost of getting a faster processor hardly justified the little-to-no benefit gains. I would still be stuck with 5400rpm of spinning hard drive. Not to mention that laptops are limited by design in their speed because they are less efficient at cooling themselves down, no matter what you have inside. Down the line, I’m still running that same SSD and my MBP still outperforms its more recent versions.

As a software developer though, working off a laptop has limitations, especially when you start running multiple virtual machines, each with their own development environments. Sure, you get the benefit of being able to work from anywhere but that’s very different to being hugely productive and efficient while you are actually coding.

Waiting 40 minutes for a build? Long enough to walk away but what if unexpected stops while you’re away. You could get on with something else, but then risk the interruption of a context switch. What about the performance of the machine while the build is taking place (and yes, automated builds and having a dedicated machine are all good- this is not that kind of situation).

Waiting 40 seconds for an environment to load before debugging? Enough time to almost forget what you’re doing. Code and test for 2 minutes and then make another change which triggers another reload. Wait another 40 seconds watching progress spinners. Add up the number of 40 second waits during the course of one day and you get a free lunch.

Now what if that same build went from 40 minutes to 8 minutes? And what if that massive productivity increase came at a ZERO cost to perceived performance working on other applications during the build?

Enter an All-In-One, aka the AIO, Core i5-4570 2.9GHz with 16GB RAM. On it’s own, a pretty decent spec but dished out with SSDs (yes, plural, something you can’t do with a laptop) and you have, quite simply, a beast of a workhorse. One SSD to keep up with the RAM and processor and service the primary operating system and another SSD to run VMs off. And the sweet part, it costs the same as a laptop but very clearly at N-times more horsepower, where N is a real integer > 5.

The cost difference between the SSD and traditional 7200rpm HDD has paid for itself inside month in billable hours alone not spent waiting. And that’s without factoring in productivity gains and general mood enhancement by being able to spend more time actually coding and not waiting for anything- ever.

I don’t wait for a system to boot up. I don’t wait for an IDE to load. I don’t wait for a compile. I don’t wait for a VM to get up and running. I don’t wait for a system to shutdown. I just simply don’t wait anymore. The only time I stop while coding now is when I stop to think and plan. I am back in control of all the subtle interrupts and can direct my attention more intentionally. Liberating.

Some say the desktop is dead- I disagree. Not for the kind of software development I do. Yes, I once tried to run everything off an iPad and Cloud and what a mistake learning experience that was. And I really don’t like desktops but the AIO is compelling. And it comes with a capacitive multi-touch screen so testing apps with gestures is dead easy. The laptop is still useful for some things, I guess, but less and less so.

The desktop computer is dead. Long live the desktop computer.

Categories
Life perspective

The New Religion Called Diet

Tele-evangelism like marketing leads the way with promises of a newfound you. These are backed up by powerful testimonies and anecdotal science (before and after photos). There’s also a strong altar call afterwards (buy these products, be they books or supplements) to all those wishing to change and converts go out into the world heralding enthusiastically the benefits of this new diet. New testimonies are born and shared around the dinner table and litter social media by the growing score of followers (yes, another loaded term). Books are written. Websites are dedicated. Courses are started. Markets boom. Industries grow. Even governments get involved and issue regulations. Naturally, not all of these assemblies are the same and they all use slightly different marketing methods to appeal to their flock, but the underlying hooks are the same. People haven’t changed in years.

How do you know if someone is following a new diet? They tell you. All the time. They will also be able to explain how the diet works and why it works in detail. And often the goal is aesthetics. Some will throw performance-related benefits into the mix but the benefits are still firmly entrenched in aesthetics. And, like all good religions, the core of that belief will get manipulated and ultimately misrepresented into bastard forms (either willfully or out of ignorance) that claim allegiance to the original but in reality have strayed so far down the garden path that anyone with small amount of patience can easily spot the hole. Of course, a lot see what they want to see. None so blind. But with the growing number of apologists (defenders of The Diet) it’s hard to sit outside in the cold wondering if you got it all wrong.

Followers of The Diet, be the goal aesthetic or performance, have one god in common: their own body. The promise of eternal youth, quality of living and longevity is such a strong pull that despite our self-proclaimed noble, scientific, rational or liberal outlooks, we fall for the silly so easily. We serve our body. We worship our body keeping it holy (which literally means set apart, or specially recognized) with an extensive list of thou-shall-not-eats (and or dos). Some more disciplined than others, there are still measures in place for those that slip up. Penance is usually paid by doing some extra “cardio” and followers rally to the help of their backsliding brother or sister with encouraging picture memes on their timeline to remind them of their purpose.

Detractors of The Diet are met with contempt if all attempts at proselytizing have failed. Ostracized or ignored, the scorned heathen will be left to their own nutritional habits. These detractors similarly start to develop a strong annoyance with anything related to The Diet on account of being endlessly battered by bullshit: current blog post as reference. Some detractors with a little more energy will engage in direct warfare thus creating the much needed tension which will help to keep The Diet alive. Because after the initial honeymoon is over, and all the longitudinal studies have been concluded, the lack of common sense will need a distraction.

But, at the end of the day, we all free to follow and serve and believe what we want. Ultimately, death will judge (if you even believe that). There are no medals in this lifetime that serve us in the grave and some will get there sooner than others (regardless of diet, lifestyle or otherwise). And in following, serving and believing, we are all free to enthusiastically share what we have on our hearts with others- it’s part of what makes us beautiful (and annoying). And in that beautiful journey we try cultivate a sophisticated sense of tolerance towards others with a different viewpoint- some more successfully than others. So if following The Diet works for you, that’s great and all, but maybe wearing a specially-recognized hat indicating you want to expound the mysteries of your diet on strangers is a good idea. That way, like the krishnas, Mormons and JWs, we know when we need to avoid eye contact and save everyone a world of awkwardness thus carefully preserving that politely veiled sense of tolerance we call world peace.

Categories
perspective

Do Patriots Love Their Country?

Patriot, a noun. A cursory look through some formal definitions reveals:

* A person who vigorously supports their country and is prepared to defend it against enemies or detractors.

* one who loves his or her country and supports its authority and interests.

And the rest are similar. Essentially, there are 3 parts in that which are interesting:

country, defend against enemies and support of authority.

Of that, the most interesting is country. Do real patriots really love their country? Well, what is a country?

Again, search to the rescue and we get something long the lines of:

A nation with its own government, occupying a particular territory. And others referring to a piece of land. There are other definitions of the word country, the most interesting in this context being

The people of a nation

The people of a nation. Now if we look at the origin of the patriot:

1590s, “compatriot,” from Middle French patriote (15c.) and directly from Late Latin patriota “fellow-countryman” [link]

Essentially, a patriot is a person who loves their fellow countrymen. Not the piece of land. The people.

It’s easy to be all patriotic about your country but then easily hate, dislike, despise, think-lowly-of, your fellow countrymen. That doesn’t make you a patriot. That makes you confused and irrational. You’re a patriot only once you start loving your fellow countrymen, regardless of their opinions.

And locally, we have many “Proudly South African” enterprises, groups and individuals. But how many only love the piece of land and find it too easy, even habitual, to denigrate their own countrymen?

Patriotism is a powerfully romantic ideal, but is there enough evidence to substantiate it’s reality?

Categories
Apps Business programming

BabyGroup Tech Journey

So here’s a little behind-the-scenes on one of SA’s newest e-commerce shops, BabyGroup. This has been a really great project to be involved with so it’s nice to be able to share a little on the journey. It’s also one of the few that are not “top-secret” so I can actually share some detail on it. Ha!

The journey:

BabyGroup started with the usual preliminary pre-project engagements and project proposals during August/September 2012. In that time, over a series of high-level discussions, the vision was explained with a view to understanding the technical requirements, all leading to the ultimate appointment of yours truly to head up the technical side of the project commencing October 2012.

We opened doors 1 May 2013, 8 months later (we did some soft launching before) with full ecommerce and online creditcard payments with 3D Secure (yes, there was some small delays, both real-world and technical with regards 3D Secure).

So what happened in that 8 months:

We designed the aesthetics of the site and put together the 60+ page template designs required for launch

We iterated through the site’s workflow, with a focus on the basket checkout process and making sales (ie, UX)

We picked out an ecommerce/cms platform to serve the base of our needs

We architected integration points and highlighted custom code requirements to meet some of BabyGroup’s unique requirements

We implemented all of the above

Outside of that, in the real world, offices need to be setup, with warehousing, and stock needed to be bought. Photos needed to happen, marketing needed to kick in, basically- a LOT needed to go down. I, however, focused on the site architecture, implementation and roll-out.

And to do that, I had 1 resource, me. But this is an area I thrive in. Full-stack development, with a handle on the full life-cycle.

I chose Kentico CMS as the base platform because:

it’s an ASP.NET solution and I prefer the predictability of strongly-typed systems where the complexity is expected to explode. There’s a lot that can be said about that, and it would stir up a debate, no doubt, but in the end, I needed to move on a platform I could do gymnastics on. And the trusty Windows Server, SQL, C#, ASP.NET is hard to beat in that regard.

But I didn’t have any Kentico experience at all. In fact, I had far more Magento experience at this point. Well, it was probably my experience with Magento (and PHP specifically) that motivated my decision to go Kentico/C#. Read what you will between the lines *wink*.

If you would like more information on Kentico CMS as a platform option, I would strongly encourage you to visit their site.

I also chose Azure as the hosting provider. Not because I had experience with it, in fact, my experience with Azure at the start was very limited, but I could see (and not from reading the headlines of pseudo-tech-journals) the promise it held along with some of the successes others were having.

Both were very steep learning curves. Again, something I love tackling.

Looking back, this was a perfect project for me really: I had 2 brand new technologies to master, I needed to code fluently in C#, integrate with several unknown APIs, do some HTML/CSS wizardry based on a PSD file, add in some funky Javascript in places (I even sliced some images in Photoshop.. oooo *hahaha*) and do all that asap, based on a Word document (with a lot of Visio diagrams). Love it!

We changed strategies en-route (several times) and stuck to the plan of planning to change when we need to. Again, something I absolutely love about programming and software. The environment is very fluid, the ideas are flowing thick and fast but budgets need to be honoured. A lot of this really was due to the sheer hard work and brilliance of Henri and James, the Jedi masters behind it all, who have taught me heaps about real-world business.

This is also something I love about programming in startup environments. The mind-share with and interaction with the business side adds a very real dynamic and pressure to the software side and keeps it real. Yes, you can get all fluffy about a lot things inside coding with design patterns and performance and unit testing and strict iterations and planned releases… but there’s a point where the bone meets flesh and the only thing that matters is what’s happening on the site, live, right now.

And this takes discipline. It doesn’t mean you throw out good practices and take shortcuts. If anything, you specifically avoid those oh-so-tempting shortcuts and don’t make decisions that’ll bite you in the ass later. It just means that at times, you put your foot down, drink a double espresso and make it happen. Even at 3am if you have to.

Yes, we have full unit testing on all custom code (and still running green). Yes, we have a development environment, a fully hosted quality-assurance environment, a pre-production environment and a live production environment running on the cloud. Oh yes, we do. Excuse me while I high-5 myself here quickly.

Since launch, we’ve had some great sales, the site has been acting nicely, the custom integration points ticking over neatly, all paying rent and everything, for the most part, sweet. Yes, we’ve hit some hurdles and had one or two oopsies, but nothing that can’t be fixed quickly and nothing that’s derailed us.

There’s still plenty new things happening behind the scenes and lots more coding happening. And the journey is, in true geekdom, tres cool. Here’s to making it happen even more and, oh, if you looking for some neat (but not just your everyday type stuff mind you) baby-related products, BabyGroup is where you should be looking.

P.S. And if I sound a little like I’m gloating, well, maybe I am. I’m just proud of the work I have done and try to do. I love what I do and hardly work a single day. I’m not ashamed of that. Why would I be? Yes, I’m not perfect and make mistakes from time to time, just part and parcel of being human. But I do try my best to make right. And this project, like a lot of others (even those I can’t talk about) have been such a blessing to be a part of, it’s hard not to sing and dance about. So, here I am, singing and dancing….

Categories
perspective programming

Getting In The Way

2013 and almost a decade has passed since I embraced agile development practices. Along the way, some of the fluff got dropped, some of it became lifestyle, some of it evolved into something better. “We” went through a lot. And those that made the decision back then to abandon established practices and try something new did it because “there had to be a better way” to releasing software. That was 10 years ago. Software release was messy. Bugs were expensive. Fast forward to today and production bugs are still expensive; if not more so.

What surprises most though is that after all this time, there still remain a number of projects (a collective term which includes startups, corporate teams, freelancers) where the methodology and practices are *still* 1990. If anything, members on some of those teams are even more resistant to change. And disturbingly, not all of them have even been coding for that long either. Oh, and the positions on the debates haven’t changed argument in 10 years. Time to move on…

I guess what has happened is that the experienced members of the team tried to adopt agile in some form or another at the wrong time in the wrong place with the wrong stakeholders. They got burnt. Juniors joined the team, maybe some of them eager to apply some agile practice, but the prevailing ethos was not going to let that evolve. If anything, the sentiment against any kind of agile practice was antagonistic (yes, not all decisions made by engineers are rational).

The nett effect; incumbent teams with a deep mistrust of change, still struggling to release software like it was 1999. Beyond that, unhappy programmers who complain about how dull software development is. And worse, a generation of developers unwilling to take ownership. Attitudes get in the way of releasing beautiful software.

Thankfully though, on the flip side of that are a bunch of shiny, happy people. They don’t need to be agile or follow an agile methodology to be great- they just are. They get on with the job and release beautiful software. Projects (which is to say, teams of developers from 1-n) need, more than ever these days, devs happy to embrace change and own the tech domain. Introducing agile (wether actually adopted or not) is just one way of gauging how resistant your team’s mindset is.

If you’re struggling with a team, or part of a team that’s struggling, the best thing you can do is make an effort to make it better- and the thing you’re looking for is not a messiah, a methodology, a bullet or a graile: it’s a thing which starts with a change inside you.

Categories
perspective

Be Less Do More

In general, we have a obsession with the idea of “being something”. We start off young, being asked as kids: “What do you want to be when you grow up?” That same question is ingrained throughout our growing years, and becomes super important during high school. We make life choices based on what we want to be. And stop doing the things we love because that interferes with the busyness of being.

Once you’re in the working world, recruiters will quizz you, managers will subpoena you, peers will interrogate you: “what do you want to be in 5, 10, 20 years from now?” Enough of the BE. It’s a lazy short-circuit attempt at trying to pigeon-hole your capacity.

When you stop asking that question and start asking: “What do you want to DO when you grow up?” you get a subtly different perspective with a radical shift in thinking; and hence, outcome.

There’s a big difference between being something and doing *stuff that represents what that being is supposed to entail.

Before there were plumbers, there were people who just did stuff, like fixed drains. Before there were doctors, there were people who just healed others. Before there were programmers, there were people who solved problems using software. Basically, before the BE came into existence, people got on with the job of DO.

Once the DO becomes established, others who do the same, team up and then what they do collectively becomes known as a BE of sorts. Everyone else then stops thinking about what to DO and focuses on what they can BE. That is, they just follow. We will not carve the future we need by looking at (following) what we can BE.

When you stop putting constraints on what you want to BE in life, you can start focusing on what you want to DO with your life. And that’s either a good thing, a bad thing or a scary thing.

Try it for yourself. Ask yourself those two different questions.

What do you want to be in life?

What do you want to do with your life?

There’s usually two different answers. The one is typically a label (because it’s asking for a noun) and the other is a typically an action (well, it is a verb, right?). But they should amount to the same thing? If not, what are you doing?

Start with what you want to DO with, and in, your life. Once you got that priority sorted out, you can then get on with creating the next BE, without worrying about what it will be called. And if you got kids, remember, we are are preparing them for a future we have no idea of. Almost all the “jobs” that will be available by the time they’re ready to enter the “workforce” do not exist today.

Encourage them (and yourself) to do the things they (and you) love- and do them well. Our world and our lives are richer because of people who dared to do the things they love before what they did became known as something professional that you could be, and make a living from.

Categories
perspective

Violent Young Men

For some time, I’ve been meditating on the source of authority. From organic social groups to governments, what mechanism propels an authority into being respected? And even more abundantly, how do “gurus” achieve their status despite having any official certificate? And for those who do have something “official” (read bureaucratic) what mechanism gives the institution offering the certificate, authority to do so? In the end, I came to the conclusion that violence is the source of all authority.

It’s easy to understand if we look to history. Kingdoms and rulers were established by force. On a smaller scale, leaders or regions and towns were established the same way. Gangs rule an area by force. Even the church (and other religious prescriptions) were all established under the sword– or, at the least, the threat of the sword. Once the general population subjugated, it just becomes “the way things are” and we continue until another force rises up to disrupt the incumbent authority. It’s primitive.

Naively, we might like to think that authority is established by voting and more sophisticated, even pleasant methods like logic, intelligence and service. Logic, intelligence and service help to maintain an authority in power since it liquidates the need for an opposition uprising, but it rarely establishes an authority. Not even in a “democratic” country. Of course, when we look to current establishments to argue that democracy does indeed establish authority, we forget that we are only looking at our generational window of a much older system at play.

So violence, or the threat of violence is enough to establish authority. You don’t need to look very far to see this playing out every day in a hundred different ways. Who holds the authority on the roads? Cops or blatant transgressors who get away with (quite literally) murder? Think of any confrontational issue, be it at work or in a social setting. Who establishes authority in the moment- and thereby sets the tone? The one prepared to fight or the one backing down?

If you look at more physical, criminal encounters, it’s the criminal who intimidates the victim and holds authority in the situation. This is achieved through force, or the threat of force. And inside that situation, the only authority over the criminal is the justice system “in action”. When that system fails to counter with a reasonable and equal counter force, or threat of force, there is no real authority that compels the criminals to reconsider their behaviour.

Take the death penalty, for example. In the days of olde, the hangman’s noose was prescribed for horse theft not so that the justice system could kill thieves, but so that they could stop thieves from stealing horses. Because, in the beginning, man was violent, always will be violent and no matter how much metro-political-correctness you try instil in a generation of young men, there will always exist a band of violent young men outside that fluffy conditioning, who will only know violence as the way.

To counter this forever-present force of evil in the world (for lack of a better description, for it is evil) you need brave warriors. Not cold-blooded warriors. You need warm-hearted, sacrificing and bold warriors who can stir hearts and lead in the face of adversary. You need young men and women who don’t back down when someone barks at them. You need young warriors who are not afraid to knuckle down, and if necessary, throw down to suppress the forces which threaten our hard-fought liberties. Yes, the liberties we enjoy today were won by the sword, lest we forget.

To that end, sport plays a critical role in the development of the young warrior. After all, sport is just a reflection of and preparation for greater things in life. Sport as the end in and of itself is indulgent and selfish. Sport is so much more; a master which trains us to lead and serve. And, less deeply, a great physical release, enjoyment and celebration of the human ability. But on the deeper level, sport offers us an opportunity to confront the seemingly impossible, overcome fear, achieve dreams and help us believe. We know this everytime we see it, and everytime we experience it for ourselves on the finish line. If only we care to reflect.

It’s no coincidence then that the great leaders of our past were fanatical pugilists. Today, we look at the sport of boxing with disdain and label it “barbaric”. We consider sports like rugby, NFL football or Aussie rules as violent. We steer our kids away from situations where (healthy) violence is prolific in the hope of protecting them from injury, while ironically allowing them to soak up ridiculously (cold-blooded) violent cartoons and movies. This in itself raises so many questions: how do kids learn to differentiate between the two? how do kids learn to respond, practically, to physically rough situations? how do young men, in particular, develop a healthy sense and responsibility for their own inherent violent nature?

Truth be told, violent but healthy sports offer our kids an education that can’t be transmitted academically. Dealing with violence is a skill, not a written test. Both when on the offensive and in the defensive, knowing your own physical limitations, strengths and weaknesses, as well as that of your opponents’ makes you a formidable warrior.

One only has to read through a brief history of Mahatma Gandhi’s life (arguably the world’s greatest pacifist) to understand the role and influence violence has over countries and communities. Not being afraid of violence, because there is a deep understanding of it through experience, is the first step to overcoming it, even non-violently. But being prepared to fight is what is important particularly if your opponent is dogmatic, stubborn and only knows one way. More than being able to fight, is being able to fight well. Of course, you can also (willingly) submit to the butcher’s knife as Gandhi put it, but that’s a matter of perspective I guess, one I would probably disagree on.

So while the world grows violent young men in abundance through an aggressive model of corruption, dishonesty and selfishness, fuelled by modern advertising (and by advertising, I am speaking very broadly and not pointing at media agencies at all), we should be cultivating a generation of young warriors prepared to inspire and work towards protecting and serving the values and ideals we hold fast. How?

Practically, with sports like boxing or rugby. Not with the sole purpose of “winning at all costs”. I believe those intentions are an invention engineered by the same cold-blooded violent mentality we oppose. Incidentally, we recognise that dark force within a game itself. It’s the cheap-shot player as an example. And in those moments, we see real heroes emerge and learn how to deal with villains. Heroes are not the ones responding with tit-for-tat violence. Nay, they are the ones responding with class, rising above and triumphing with a display of ability, strength and spirit. And it is in that demonstration which intimidates the opposition and establishes real authority; where we learn how to wield authority and circumvent aggression with non-violence in a violent world.

Categories
Life perspective

Getting out of bed

On my way to go paddle this morning, I stopped at a red traffic light. It was still dark out, a shade after 5:30AM and only the intermittent cars and buildings were glowing. In the shadows of the black, was a lone man; a vagrant. Blind. He was sitting softly at the light, clutching his make-shift guide stick; his face buried into his free hand.

He was sobbing.

I stopped and listened carefully. In between the sobs, he was singing a really sad song. In a foreign tongue but with the sweetest tones.

Miles from home, in a foreign country all alone, blind and wandering the streets of Cape Town sits a grown man crying.

And I’m off to go paddle in the pursuit of health, happiness and adventure. I’ll go back home after my hard paddle and choose between a breakfast of oats or Pronutro and huddle around the breakfast table with my clan drinking hot tea.

Never complain about getting out of bed. Ever.

Categories
programming

Engineering CSS

With sites becoming increasingly “full” with the focus on design, regardless of the simplicity, the explosion of CSS and it’s management is burdensome. There are some tools; some processes, but working with CSS on a “code level” has still got a long way to go. Yes, there’s SASS, which can help, but you’re still dealing with a myriad of artifacts. Let’s look at a simple block, for example:

Header
some text

There are 3 basic elements involved: a container block, a header and a body. This is just one block with 3 different CSS declarations. On a simple site, that’s only 3 artifacts you need to:
* name
* code
* maintain
* version control
* test

Scale that effort across a decently-sized site/project and you quickly end up with an insurmountable number of artifacts. And one of the biggest challenges facing just about every programmer is coming up with names!

Name for a library. Name for a class. Name for a method. Name for a variable. Name for a stored procedure. Name for a table. Name for a view. Name for a controller. Name for a document. Name for style. In code, it can be relatively easy since it’s all function-based. CSS is a little different.

Sometimes you name it according to function, but you can’t always recognize it that way as a reference point (later on in time). For example: the function of the block above might be something quite general: “information-block”. But later on the same site, you have a similar function “information-block” that looks different.

Header
some text

It’s subtle. But different. So you try “light-header-information-block” and “dark-header-information-block”. Ugh. It’s getting bad, so you go with abbreviations: “lthdr-info”, “dkhdr-info”. Ugh. Worse. Maintenance nightmare. So you try a different strategy, name things according to area: “new-info-block”, “forums-info-block”. That gets wieldy, so you break up the CSS files into: news.css, forums.css, assessments.css. Inside there, you have an “info-block” definition and then just make sure you only pull in the relevant stylesheet. Meh.

Then you get those general, across-the-site-but-not-always, styles. It’s not easy. Then you throw IE into the mix or vendor-specifics and.. well.. your 3 artifacts just got trickier. And then let 2 or more front-end guys loose on the same site with their own thinking and logic…

Ok. So while I don’t have a silver bullet here, I do have some strategies for dealing with the pain efficiently (as might be). Some already mentioned. Another is in the naming of sub-elements. As a guideline, I only focus on naming the bigger containing elements.

So, .info-block-wrapper { } for example. The nested elements we can always derive.
.info-block-wrapper .header {} or
.info-block-wrapper .body {} are easy. Even:
.info-block-wrapper div.header {} Or just:
.info-block-wrapper div {} where applicable.

Problem is using class=”header” and class=”body” is going to cause some issues just because they are such general names. So I prefix general names with the beloved underscore. Meh. _header and _body. As a co-operative to that guideline, I *never* define a _class style on it’s own. It’ll always be as a nested definition:

.info-block-wrapper _header {}
never
_header {}

This helps maintain some level of sanity while navigating through thousands of ephemeral definitions (yes, designs iterate way more than functional code) over the lifetime of a project with potentially as many front-end workers.

And then of course, there’s also the performance of CSS to consider. In terms of engineering, yes, CSS still has a way to mature while it also has the responsibility of being the most noticeable deliverable: a double edged sword if there ever was.