Results tagged “opinion” from Bound Variable


Renounced magic

I started working on a quick port of blosxom to JavaScript running on v8cgi mostly because every programming language needs a blogging engine and JavaScript kinda doesn’t have one.* Despite being potentially superfluous, a post on it might have made a good read. Unfortunately I temporarily lost interest so that will have to wait for another day.

Instead, I decided to write something that’s barely related to JavaScript because, well, if I don’t write I quickly forget how to write - to point where I’ll spend ten minutes composing a two sentence email only to delete and never send it because it didn’t make sense. Anyway, here goes. I’m breaking a few rules in the following text so I can only hope the reason won’t be lost in the reflection.

In order to pay the “bills” during my years at university I used to tutor high school Maths, Physics and English. At first the syllabus for each subject was fairly close to what I’d been through myself but as each year passed I noticed bizarre things happening to each subject as they were morphed into things I barely remembered until eventually every last equation had been removed from Physics and HSC English students started telling me they were studying Blade Runner.

Truth be told, I don’t really like maths all that much (many years since leaving uni it’s still possible to give me a mild panic attack by asking me to calculate an autocorrelation coefficient) so I could probably have done without tutoring HSC Maths. I did generally enjoy tutoring English though.

The first lesson with a new student was always interesting. Generally it would begin with a fifteen minute chat with the parents - a chat that would tell me nothing about the student except that their parent had absolutely no idea what their children were doing at school. I’m not much for making light conversation but the preamble seemed important in making the parents feel comfortable and involved and they always liked it when I told them their child was talented and capable of doing well in English but had never been taught how. (I also had to teach some of the kids to spell despite the parent assuring me it wasn’t necessary because, you know, computers meant nobody needed to spell anymore.)

The student would be ready with the texts they had been assigned for the year and a stack of notes given to them by their teacher. That stack of notes would invariably contain a few sheets containing quotes that the teacher thought students were supposed to learn. For every student that I tutored though, there were only really ever two problems that needed work.

The first was that all-too-often they hadn’t actually read the text, or if they had read it they hadn’t taken the time to understand it. The solution to that was fairly easy. Tell them to read it and come back the following week promising to do nothing but sit there for an hour whilst they explained the text to you. It’s amazing what most people will do to avoid an hour of awkward silence.

The second problem was the important one. Every single person that I tutored HSC English to had absolutely no idea how to approach composition. It might have been tempting to think that they had no idea how to write effectively because they had missed that day in school but that wasn’t the case. I don’t know if it’s been different in other times or other parts of the world but most of what these kids learnt at school was about turning up in the morning and sitting at a desk all day.

These kids, or teenagers, had no idea what they were supposed to write except that somebody had told them that they needed to produce something called an essay with an introduction, body and conclusion and that they should litter it with the quotes supplied in the relief package. These essays were terrible, starting with “In this essay I will talk about” and rapidly declining from there.

So, I would spend one hour telling these kids how I approached composition (not sure if that part helped) and then assigned them a truck load of writing exercises which we’d look at the following week.

The writing exercises worked.

I don’t know if any of those former students still write anything longer than an SMS but the impact of seeing smart kids with valuable ideas completely unable to put them across on paper has always stuck with me.

I think writing matters. More importantly I think good writing matters. I also think that like most of the things I grew up with it will eventually be put through the photocopier enough times that only a surgeon’s photo will remain. I think that’s a shame.

I think writing matters and that’s one of the motivations for spending the time to write (and rewrite) the posts on this site. I also think it helps me extract my mind from programming flatland… though I have little supporting evidence for that one.

Anyway, finally to the point. One of the great things about the web for me has always been that it gave more people an opportunity to explore and express the ideas they had to an engaged community.

I may be subscribing to the wrong sites but watching the declining quality of posts in my feed reader doesn’t seem encouraging. The number of link blogs, top ten lists, twitter summaries, spam, trolling and product whoring seems to be steadily increasing. I know some of these things have traditionally been considered synonymous with The Internet but for a while there it actually seemed like there was a lot of effort going to producing quality writing. Am I still looking at originals or is it all photocopies? Do people still write or is it all just out takes, bloopers and greatest hits? Does anybody care?

* There is actually at least one built on Helma used on reasonably high traffic production sites such as blogger.de but I am conveniently choosing to ignore them for the moment.

† In hindsight there may have been some motivation in not wanting to pay me to sit there for an hour and do nothing. Hard to say.

‡ I don’t mean to criticise the education system for teaching kids these two things as they are as essential for keeping a job as brushing and flossing are essential for keeping teeth.


Cascading

It’s possible to criticise CSS for solving the wrong set of problems. Whilst I am talking about CSS here, I am not talking about that. CSS has been an undeniable success in terms of removing a heap of cruft from HTML. I don’t think people should be happy to stop at that though. There are problems.

Anyway, I’ve written a fair amount of CSS in my time. At least, I’ve written enough CSS that there’s a chance that I’m partly responsible for the great wad of legacy CSS that you hate working on every day.

If I might quote Toad from the claymation movie version of Wind in the Willows

I’m not sorry so it’s no good saying I am.

At one point in time a front-end developer working on legacy code would be staring at a vast sea of nested tables created by a tool such as FrontPage - trying to figure out where in that sea they needed to add their code such that it won’t cause the layout to barf table everywhere.

These days it’s just as likely that a front-end developer will be working on legacy code and be starting at a vast sea of my CSS trying to figure out what last-minute 2am bug report had prompted the use of so much “!important”.

Actually, it’s worse than that. These days it’s just as likely that as a front-end developer you will be working on a vast sea of your own legacy CSS… written only three months ago. The thing with CSS is that most of it is legacy as soon as it’s written. This is not a criticism of people writing CSS, I’ve seen people with good ideas put a lot of thought into the best way to maintain CSS with good results. I just don’t think CSS is really helping those people solve their problems.

Let’s say that you decide to write new CSS to replace somelegacy code. What’s the usual approach?

Start with a blank file, insert standard browser reset code and off you go.

I can’t think of another coding discipline where even proficient, thoughtful coders achieve so little reuse from project to project.

Now, in the time since I last wrote any large amount of CSS that somebody else has had to work on, I’ve seen a lot of promises about the latest trend in writing or organising CSS. Indent it this way, indent it that way. Put these comments in. Group by specicifity. Group by function. Break it down this way. Break it down that way. Make it Object Oriented!

Yup… I heard that news about using component based architecture for CSS. Component based architecture makes a lot of sense. I still bet the next time you work on a completely new project you start with an empty file and CSS every single line from go to woe without reusing more than half a dozen classes from the last project you worked on.

It’d be nice if a component based approach actually resulted in front-end developers being able to compose a new site from an existing set of components. It’d be nice if there was, I dunno, meta-CSS.

Unfortunately, I can’t see that happening. Instead, it seems that some front-end developers love writing CSS selectors so much that the only thing they wish to change about that particular 4GL is the lack of variable spaghetti to add to their CSS minestone. I don’t think variables would help.

It looks like developers love those selectors so much that they’ve transported them and the development technique wholesale to other places such as JavaScript where instead of ever writing an abstraction or component themselves they start with a blank file, a selector engine and… well, you know… potato programming all the way. It looks like that because it is like that. The reason? CSS encourages it.

Just like SQL… Just like XML. CSS - and the attached mindset - seems to be one of those things that’s frequently over-applied and relied on too heavily in places where it either doesn’t belong at all or should only be a small component. There’s nothing wrong with supporting XML in a programming language but there’s definitely something wrong when XML becomes the programming language. Similarly, there’s nothing wrong with supporting CSS selectors in Javascript but there’s definitely something wrong when CSS selectors become the programming language.

Some may disagree, but I think that as a developer, I shouldn’t be trying to make everything else look like what I’m familiar with… instead I should be trying to make what I’m familiar with better. I think CSS could be better and I don’t think much more ground can be gained whilst the language remains as it is.

A post tagged with opinion from Wednesday, 24 June, 2009