<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Equivalence &#187; programming</title>
	<atom:link href="http://equivalence.co.uk/archives/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://equivalence.co.uk</link>
	<description>Technical Blog for Software Developers</description>
	<lastBuildDate>Wed, 04 Apr 2012 22:32:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>writing code used to be simple</title>
		<link>http://equivalence.co.uk/archives/1944</link>
		<comments>http://equivalence.co.uk/archives/1944#comments</comments>
		<pubDate>Wed, 04 Apr 2012 08:36:05 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[code libraries]]></category>
		<category><![CDATA[complex]]></category>
		<category><![CDATA[reinventing the wheel]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://equivalence.co.uk/?p=1944</guid>
		<description><![CDATA[Not that many years ago, though more than I care to remember, the process of writing code started with pen on paper. I&#8217;m not talking about 1970 here where you had to apply for compute time on some mainframe to see your ideas come alive, rather 1995 where it seemed the normal practice was to [...]]]></description>
			<content:encoded><![CDATA[<p>Not that many years ago, though more than I care to remember, the process of writing code started with pen on paper. I&#8217;m not talking about 1970 here where you had to apply for compute time on some mainframe to see your ideas come alive, rather 1995 where it seemed the normal practice was to encouraging us disobedient students to first distil our ideas (and code) on paper. I&#8217;m gathering that this practice is largely forgotten? Despite its disappearance this can still be good practice but is made difficult by the increasing complexity of modern code libraries and frameworks.</p>
<p>Take Ruby on Rails for example. This used to be the poster child of getting an application up and running quickly. This might be still be true if you have years of experience developing Rails applications but for a newbie, forget it, you are going to struggle. The introduction of the asset pipeline, amongst other things, has made learning how to use Rails a labour of love.</p>
<p>It&#8217;s not just Rails though. A lot of the code that you need will already be wrapped up in a library written by someone else. Creating a modern software application is essentially just a case of rearranging these packages into a new unique order. In fact, the need for the order to be unique can probably be dropped.</p>
<p>Using these libraries is good though? Right? I mean we should never &#8220;reinvent the wheel&#8221;? </p>
<p>So how many times do you find yourself spending more time trying to figure out how the fuck to use some library than if you had written it yourself? No-one really expects there to be detailed documentation, which is just as well, as in general you&#8217;d be thoroughly disappointed. Maybe it&#8217;s because I&#8217;m dumb, but figuring out how to use a library can be a complete time sink. I mean, I hate to encourage this, as it seems like I&#8217;m committing a heinous crime, &#8217;cause that&#8217;s what I&#8217;m told I&#8217;m doing, but just write the code yourself if it gets it working quicker for you. Obviously don&#8217;t rewrite the exact library that you are shying away from using, that is just stupid, but if you only need a subset of it&#8217;s functionality then go for it.</p>
<p>Never forget though, there will be a team of astronauts telling you that&#8217;s not what you should be doing. They will be spouting dogma, about this and that. However, if abandoning some well written (and not so well written) rules allows you to create a product that people use and love then tell the astronauts there are people who want to hear their shit on the moon and let them go there.</p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1944/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>the internet and i</title>
		<link>http://equivalence.co.uk/archives/1836</link>
		<comments>http://equivalence.co.uk/archives/1836#comments</comments>
		<pubDate>Wed, 01 Jun 2011 16:34:31 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Observations]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://equivalence.co.uk/?p=1836</guid>
		<description><![CDATA[If you are able to read this please keep it to yourself, don&#8217;t tell anyone about it. Your ability to possess information that others do not have access to is crucial to moving only in the forward direction. Yet there is very little information now that is not readily available to everyone. The internet is [...]]]></description>
			<content:encoded><![CDATA[<p>If you are able to read this please keep it to yourself, don&#8217;t tell <strong>anyone</strong> about it. Your ability to possess information that others do not have access to is crucial to moving only in the forward direction. Yet there is very little information now that is not readily available to everyone. The internet is almost ubiquitous. Rewind a mere 15 years though and observe how the landscape has changed so dramatically.</p>
<p>Back then a PC was the something only the posh kids had.  My school was fully laden with BBC micros that you could only use to control some piece-of-shit-circuit-board that you had cobbled together to light up a few LEDs in the form of a traffic light. </p>
<p>I still remember to this day getting my first PC &#8211; a (big) Compaq laptop of sorts. It was purchased second-hand from a shop that specialized in guns, knifes and guitars &#8211; I still have it somewhere. They probably didn&#8217;t even know what it was. When I read stories of people in the 80s having PCs it makes me laugh as, in my world, this stuff was sooo out of reach that you wouldn&#8217;t believe.</p>
<p>Still, what would the general public have done with the PC back then anyway (apart from gaming)? The internet was a luxury goods item at this point. Even at university only a few computers had internet access. However, between &#8217;95 and &#8217;97 it exploded. You were faced with a computer lab full of students looking up porn and printing out the pictures (I mean they were not much use unless you printed them out, right)! Those were the days of looking up what you wanted with reckless abandon without feeling that someone or something was watching you &#8211; soon to be quashed with the corporate firewall and government legislation. Make no mistake though, we are still in the golden age of the internet. Laws and legislation will likely mean that the freedom we associate with the internet now will not be the same 30 years down the line.</p>
<p>What puzzles me most is how we got by programming without the internet? If tonight I decided that I wanted to learn OCaml to build some super useful web service, then I would start by searching Google. I&#8217;d get binaries, sample programs and documentation in minutes. If I had a problem, I could search on Google or ask a question on Stackoverflow. The barrier to entry is just non-existent. I struggle to remember exactly what we had to do all those years ago. It must have been ridiculously hard compared to the present day. But this is good. We got information easily and moved forward. That said, the internet does have its bad points. </p>
<p>We now struggle to get things done because we can listen to music online, watch videos, read blogs, not to mention the ease with which we can communicate with friends using social networks. What the internet gives with one hand it takes away with the other.</p>
<p>I&#8217;m often tempted to unplug the router and see how I get on with work minus the internet. Invariably at the last minute though I find some compelling reason to have it switched on, then the thought of uplugging it fades into nothing and time just slips away again.</p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1836/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>an afternoon with Don Knuth</title>
		<link>http://equivalence.co.uk/archives/1792</link>
		<comments>http://equivalence.co.uk/archives/1792#comments</comments>
		<pubDate>Thu, 17 Feb 2011 01:09:27 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Glasgow]]></category>
		<category><![CDATA[Knuth]]></category>
		<category><![CDATA[Zukerberg]]></category>

		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1792</guid>
		<description><![CDATA[It&#8217;s not often you get the chance to spend an afternoon with probably the most famous hacker/developer/computer scientist the world has ever seen. However, last week I got the chance to do just that when myself and three colleagues had the great fortune to spend some time with Don Knuth. For the uninformed IT &#8220;professionals&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not often you get the chance to spend an afternoon with probably the most famous hacker/developer/computer scientist the world has ever seen. However, last week I got the chance to do just that when myself and three colleagues had the great fortune to spend some time with <a href="http://www-cs-faculty.stanford.edu/~uno/">Don Knuth</a>.</p>
<p>For the <del datetime="2011-02-16T21:30:36+00:00">uninformed</del> IT &#8220;professionals&#8221; that have never heard of Don Knuth this is the guy that brought to us the idea of <a href="http://en.wikipedia.org/wiki/Analysis_of_algorithms">analysis of algorithms</a> and asymptotic notation (big-O notation), the <a href="http://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm">Knuth-Morris-Pratt</a> string searching algorithm, the <a href="http://en.wikipedia.org/wiki/The_Art_of_Computer_Programming">Art of Computer Programming</a> book series, the list goes on. However, he is not only an &#8220;algorithm&#8217;s guy&#8221;, he also developed the <a href="http://en.wikipedia.org/wiki/TeX">Tex</a> typesetting system and the <a href="http://en.wikipedia.org/wiki/Metafont">METAFONT</a> language used to define vector fonts. So basically he is the most famous computing guy out there.</p>
<p>Knuth is a surprisingly easy guy to talk to. Sure, he can really lose you pretty quickly in a conversation, but he also has some great insights. </p>
<p>Our conversations tended to centre around stuff to do with algorithms. His next volume of the Art of Computer Programming will likely focus on <a href="Constraint satisfaction problem">constraint satisfaction problems</a> and <a href="http://en.wikipedia.org/wiki/Boolean_satisfiability_problem">satisfiability problems</a> &#8211; the former being something I worked on myself in the not to distant past. I asked what he thought was a good algorithm to teach people and he said he thought the <a href="http://en.wikipedia.org/wiki/Hopcroft-Karp_algorithm">biparite graph matching algorithm</a> was a nice one in terms of beauty (he did mention another which escapes me now). Not everyone will find the algorithms stuff that interesting (you should!) but his view of beauty is maybe something more universal.</p>
<p>He also expressed a love for writing code, he said that when he gets up in the morning he thinks about writing code and misses it on days when he doesn&#8217;t get the chance. That is pretty cool by me and sits in stark contrast to many academics. I got the feeling that he wasn&#8217;t too keen on the &#8220;apps&#8221; developers as he called them. My guess is that his thoughts lie with more meaningful problems than fart apps &#8211; however people download them so who are we to say. Still, there was definitely some lamenting going on about the fact that people use software without ever trying to understand what the software is actually doing. That is, have at least a high-level view of the data structures and algorithms used that make the said piece of software useful. Having this kind of understanding allows you to select the right tools for the job. In my experience people that tend to have this knowledge and understanding are far better developers and is likely why Google, Microsoft, Facebook et al. try to attract developers with this kind of knowledge.</p>
<p>He was telling us that he watched The Social Network on the way over on the plane. He said he thought it was great how Mark Zuckerberg was also someone who just liked building stuff like him &#8211; this was something Zuckerberg said himself at Startup School 2010. What is even cooler is Mark Zuckerberg actually sent him a copy of the latest Art of Computer Programming book and asked him if he would sign it for him.</p>
<p>So Don Knuth himself will have long forgotten who I am but at least I will be able to recollect years down the line this encounter with a computing genius.</p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1792/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>academics don&#8217;t care and industry doesn&#8217;t have the time</title>
		<link>http://equivalence.co.uk/archives/1501</link>
		<comments>http://equivalence.co.uk/archives/1501#comments</comments>
		<pubDate>Mon, 07 Dec 2009 01:29:29 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[computer industry]]></category>
		<category><![CDATA[future of programming]]></category>
		<category><![CDATA[programming languages]]></category>

		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1501</guid>
		<description><![CDATA[I&#8217;ve been reading some interviews recently (Coders at Work) and one interviewee (I can&#8217;t remember who, but I think it was Fran Allen) suggested that in the last 20 years programming languages have not progressed leaps and bounds as they appeared to in the early days. Are they right? Personally, I think this might be [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading some interviews recently (<a href="http://www.codersatwork.com/">Coders at Work</a>) and one interviewee (I can&#8217;t remember who, but I think it was <a href="http://en.wikipedia.org/wiki/Frances_E._Allen">Fran Allen</a>) suggested that in the last 20 years programming languages have not progressed leaps and bounds as they appeared to in the early days. Are they right?</p>
<p>Personally, I think this might be a good call. How different are the currently programming languages from C? OK, today&#8217;s popular duo, Java and C#, have garbage collection and thus we don&#8217;t have to deal with those troublesome pointers. Then again, both <a href="http://en.wikipedia.org/wiki/Lisp_(programming_language)">LISP</a> and <a href="http://en.wikipedia.org/wiki/Smalltalk">Smalltalk </a>have had garbage collection for a long long time. C# has lambda expressions, and other higher-level functions, but then again this stuff was around in LISP since day dot. It&#8217;s almost as if the &#8220;C-style&#8221; languages are battling to catch up with things like LISP &#8211; which is a language I&#8217;ve never used other than for some emacs hacking. However, LISP has been around since 1959, so why has it taken so long for people to realise that many of its features are incredibly useful? Have we been held back by the fact that most academics don&#8217;t really care too much about this kind of stuff, and so don&#8217;t push it, and industry is too busy telling us something needs to be done last week?</p>
<p>First, I know that there are academics who do care about this stuff but I don&#8217;t think there are enough. And by virtue of being an academic, they are not exposed to many of the problems that are faced by your every-day software developer, and as such, maybe they don&#8217;t see the future so well. Thus is it up to industry to innovate at this level? If it is, I don&#8217;t see us moving too far forward from our current situation in the next few years. Why?</p>
<p>Well, most small to medium sized software houses are not exactly making money in significantly large quantities to warrant throwing it away on research that some other company making similar software will use to create a similar/better product. So instead of spending money pushing forward the state of the art, you would be insane not to spend that money on making a better product. This combined with crazy schedules, does not leave much in the way of time for forward thinking.</p>
<p>So it appears that we need to rest our hopes on the large enterprises like Microsoft, Google, et al. It&#8217;s fair to say that these companies invest a significant amount on money in research, some of which goes toward trying to make programming languages better (<a href="http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/">F#</a> and <a href="http://golang.org/">Go</a> for example). However taking these two languages as examples we see that F# doesn&#8217;t appear to push that many boundaries, and I can&#8217;t comment too much on Go, as I&#8217;ve not looked at it closely, but it also doesn&#8217;t seem to include too many radical switches. Maybe radical does not sit well with shareholders, I dunno.</p>
<p>The thing is, I&#8217;m not professing to contain much insight on this either, and I&#8217;m not even sure I know what I mean by a radical switch. I just know it doesn&#8217;t appear that academia or industry are moving this forward quick enough &#8211; if the last 20 years is anything to go by. The only remaining vehicle for change is the programming &#8220;community&#8221; as a whole, but how much traction we can have is debatable. That said, we do need to move in a different direction, I&#8217;m sure of that, and maybe things like multi-core processors may force us kicking and screaming in that new direction. However maybe the problem is even deeper than this, and a switch away from the whole Von Neumann architecture is required. Who knows? Well, I hope someone does!</p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1501/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>sticking with what you know</title>
		<link>http://equivalence.co.uk/archives/1405</link>
		<comments>http://equivalence.co.uk/archives/1405#comments</comments>
		<pubDate>Thu, 27 Aug 2009 00:03:18 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Observations]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[programming language]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1405</guid>
		<description><![CDATA[There comes a time in every programmers life when they have to learn new things and step out the box. Yeah it&#8217;s difficult, for sure. It&#8217;s all too easy to create the latest application in your software empire, using a language you&#8217;ve been developing in for the last 10 years. However, the real problem is [...]]]></description>
			<content:encoded><![CDATA[<p>There comes a time in every programmers life when they have to learn new things and step out the box. Yeah it&#8217;s difficult, for sure. It&#8217;s all too easy to create the latest application in your software empire, using a language you&#8217;ve been developing in for the last 10 years. However, the real problem is thinking this is the only choice. When is it time to abandon this certitude?</p>
<p>First, we cover the forced abandonment. This is when you are pushed kicking and screaming into pastures new, whether you like it or not, i.e. the new job. Here, not only is the new language curve ball thrown (viciously), but you also get whole new set of business rules into the bargain. So what do you do? You program the new language like the old one, only translating the syntax in your head. This is not the best way to learn a language though. Why? Well consider those C programmers trying to program imperatively in Java, Java programmers in JavaScript, C++ programmers in Ruby, and so on. When there is a change in paradigm this mapping strategy just doesn&#8217;t work &#8211; a similar situation exists with languages that contain a more powerful expression set. It also encourages the behaviour where people learning enough to get the job done, without understanding what is really happening, or that there may have been a better way using &#8220;unmappable&#8221; language&#8217;s features. A better approach would be to write something small, and new, that allows you to explore the language&#8217;s features. I&#8217;m sure most people can think of something they could write. Furthermore, if you can make it useful to other people, or even your new employer, then everyone&#8217;s a winner! This is something <a href="http://www.equivalence.co.uk/archives/78">I touched on before</a>.</p>
<p>For many people though, this is the only time they will ever consider abandoning. This is sad, and a poor characteristic in a programmer.  And to be honest, I just don&#8217;t understand it. That&#8217;s not to say that I don&#8217;t accept that people just do programming as a job, then go home and don&#8217;t think about it. However, it&#8217;s like most things in life, it&#8217;s nice to progress?</p>
<p>As a programmer there will also be other signs that the tide is turning, and you don&#8217;t have to be too alert to spot these. Previously I wrote &#8220;<a href="http://www.equivalence.co.uk/archives/78">Perl is Dead, Long Live&#8230;Perl?</a>&#8221; and being a big Perl fan it was sad to see the language apparently dying, so I know what it&#8217;s like. Some signs to look out for may be:</p>
<ul>
<li>the language features are not moving on (Java watch your back) &#8211; the people who created it no longer care,</li>
<li>the community surrounding the language is dwindling &#8211; the people who use it no longer care,</li>
<li>there is little in the way of choice when selecting libraries/frameworks &#8211; the experts have fled,</li>
<li>other programmers have never heard of it &#8211; there is no buzz,</li>
<li>jobs using it are few and far between &#8211; businesses have given up on it, the death kneel.</li>
</ul>
<p>However, this is all not to say that you give up on your language just because it&#8217;s no longer cool &#8211; popularity is by no means a great indicator that something will suit your needs. It need not be the case that you give up on your language of choice, instead it could be that you contribute and drag the language forward. But be careful with this one.</p>
<p>Finally, any decent employer will want to see that you are continually developing your skill set &#8211; their business needs are continually evolving, so why aren&#8217;t you? You are much more likely to land a better job if you contribute to your own education in some way. It looks good and it&#8217;s also something to talk about.</p>
<p>So go out and learn something new today, and stop sticking with what you know.</p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1405/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>programming just isn&#8217;t that hard!</title>
		<link>http://equivalence.co.uk/archives/1323</link>
		<comments>http://equivalence.co.uk/archives/1323#comments</comments>
		<pubDate>Fri, 31 Jul 2009 00:19:13 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[Observations]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[good practices]]></category>
		<category><![CDATA[sucessful software]]></category>

		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1323</guid>
		<description><![CDATA[Programmers at times can take themselves, and their abilities, a little too seriously. The fact is that programming, in general, is just not that difficult. Sure, there are parts of it that are tricky but, at the risk of over generalising, the capabilities required by your run of the mill programmer are not that high. [...]]]></description>
			<content:encoded><![CDATA[<p>Programmers at times can take themselves, and their abilities, a little too seriously. The fact is that programming, in general, is just not that difficult. Sure, there are parts of it that are tricky but, at the risk of over generalising, the capabilities required by your run of the mill programmer are not that high. Are you sure I hear you say?</p>
<p>Well plucking figures right out the air I&#8217;d say that around 90% of applications involve a simple CRUD model. So what we are essentially doing is gathering data, processing data, and writing this data to the database. Two-thirds of this process is pretty simple, i.e. gathering the data and writing it to the database, this leaves the possibilities for hardness in the processing data phase.</p>
<p>Again in most situations the processing of data is pretty simple with no complex db manipulation or algorithmic mind games. Consider your typical web application for example. The processing of data is minimal, with little to no algorithmic work involved at all &#8211; I mean with Twitter there is literally nothing to do. Google on the other hand has lots to do: it has to make those search results shine. This is not to say that developing Twitter is simple, as the scaling issues will make your head hurt. However, scaling problems are only going to affect a very very small number of sites out there, but due to their ubiquity they are the ones we hear most about.</p>
<p>If all this programming nonsense is so easy then surely it&#8217;s difficult to make bad software?</p>
<p>Nope. The fact is that the only people who care what the code looks like are other developers. The code underneath could be shitter than an incredibly shitty shit and the end user wouldn&#8217;t know. As long as it carries out the task that they require the software to do, in a reasonably efficient and user friendly way, no one really cares. Oh apart from other developers.</p>
<p>Obviously nice structured code, that is easy to understand, free of bugs, and a maintenance dream is a good building block. However, it is by no means a guarantee that you are on to a winner. Marketing, user experience and coolness are all equally important, actually, they are probably much more important. I obviously can&#8217;t say for sure but I would imagine there are plenty of successful software products that are badly written but tick these boxes &#8211; maybe even most successful products, as they are free from the burden of the studious programmer.</p>
<p>So, essentially what I&#8217;m trying to say is that despite programming not being that difficult there are many other more important factors that contribute to the success of a software product. Many software products do their job, but the one that will be successful is the one that does it well.</p>
<p>All this is not to say that programming well is not important. On the contrary, it&#8217;s important to other developers who you work with and that is not to be underestimated. This is a topic for discussion another time though!</p>
<p>Finally, for those non-programmers out there, don&#8217;t start shouting &#8220;If it&#8217;s so simple why does it take so long&#8221;? Well just because something is easy it does mean there are not lots of easy things to do. I mean, hammering a nail into a piece of wood is pretty simple, right? But if I asked you to hammer 10 million nails into a bit of wood it would take you a long time. Remember this marketers and project managers.</p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1323/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>strong coupling and web development</title>
		<link>http://equivalence.co.uk/archives/1341</link>
		<comments>http://equivalence.co.uk/archives/1341#comments</comments>
		<pubDate>Thu, 23 Jul 2009 11:17:32 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[designers]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1341</guid>
		<description><![CDATA[We are all well aware of the dangers of strong coupling: for me, the most dangerous being the increased maintenance costs in such a system. Much has been discussed about coupling and measures such as dependency injection are used to help control it. However, as far as a Google search leads me to believe, but [...]]]></description>
			<content:encoded><![CDATA[<p>We are all well aware of the dangers of strong coupling: for me, the most dangerous being the increased maintenance costs in such a system. Much has been discussed about coupling and measures such as <a href="http://en.wikipedia.org/wiki/Dependency_injection">dependency injection</a> are used to help control it.</p>
<p>However, as far as a Google search leads me to believe, but I didn&#8217;t search too hard, not much has been said about the strong coupling that can exist between HTML, CSS, and JavaScript files. Maybe I&#8217;m doing something wrong, or at least something different, from others but many times in recent weeks I have found that the dependencies between these files can be rather tight and restrictive.</p>
<p>To understand what I&#8217;m talking about, let&#8217;s take a look at an example. Consider the following snippets of an HTML, CSS, and JavaScript files respectively:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;main_wrapper&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Header<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#main_wrapper</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFFFFF</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#main_wrapper'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'color'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'#000000'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>As you can see the id is referenced in at least three different places. Well so what?</p>
<p>The problem, as I see it, comes from the fact that it is more than likely these files will be maintained by different people. For example, a designer is likely to maintain the HTML and CSS files and a developer the JavaScript file. In the days before JavaScript proliferation, this maybe wasn&#8217;t such a problem. However, with the rise of <a href="http://www.jquery.com">jQuery </a>and its awesomeness the landscape has changed a little.</p>
<p>In fact, jQuery actually compounds the problem, as we have all become accustomed to seeing JavaScript code littered with things like <code>$('#main_wrapper')</code>, i.e. CSS selectors are referenced throughout the code base. What this means is that when the designer changes the structure of the HTML file, or the class names and ids, it can have unexpected side effects.</p>
<p>The easy (part) solution to all this is that when you create ids and classes you never change/remove them or their container &#8211; or at least you never change them without searching globally rather than just locally. I&#8217;m not sure how restrictive this is though, maybe those with far more experience of this than I do can offer up some more constructive thoughts? Are designers are just not used to such constraints? I dunno?</p>
<p>To me it just seems like a hassle having to keep track of selectors, ids, and classes in so many different places. It seems to go against the spirit of good programmer where we try to localised any side effects when changes are made. With the above way of working this doesn&#8217;t seem possible &#8211; and combined with the divided level of responsibility between designers and developers, I imagine this causes an increase in the number of bugs and also in the cost of maintenance.</p>
<p>Maybe others don&#8217;t see this as an issue at all? Maybe I&#8217;m doing designers around the world a disservice? You decide.</p>
<p>At the moment I can&#8217;t offer up any better solutions, as I have not really thought about it too much yet. When I do though, I&#8217;ll be sure to report back <img src='http://equivalence.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1341/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>the real geek test</title>
		<link>http://equivalence.co.uk/archives/1297</link>
		<comments>http://equivalence.co.uk/archives/1297#comments</comments>
		<pubDate>Wed, 17 Jun 2009 14:29:32 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Observations]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1297</guid>
		<description><![CDATA[I&#8217;m sorry, I&#8217;m sorry, but I object to the use of the word geek. I&#8217;d always imagined that a geek was someone who was obsessive about computer programming. Lately though I&#8217;ve seen people use it in a way that is beginning to annoying me &#8211; it&#8217;s used to describe someone who simply uses the latest [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sorry, I&#8217;m sorry, but I object to the use of the word geek. I&#8217;d always imagined that a geek was someone who was obsessive about computer programming. Lately though I&#8217;ve seen people use it in a way that is beginning to annoying me &#8211; it&#8217;s used to describe someone who simply uses the latest and greatest software or gadgets. This was brought to a head when I clicked a link in a tweet (thanks Colin!) which sent me to an article called  &#8220;<a href="http://www.wired.com/geekdad/2009/06/top-10-ways-to-provoke-a-geek-argument/">Top 10 Ways to Provoke a Geek Argument</a>&#8220;.</p>
<p>I mean, I like to think I&#8217;m a geek, sad, but true. However, if the things mentioned in that article are likely to incite an argument in a geek, then I ain&#8217;t a geek. <strong>True geeks</strong> laughs in the face of such insults. So bearing all this in mind I say a <strong>real geek</strong> is someone who takes offense when:</p>
<ol>
<li>someone states that programming is <strong>just</strong> a day job;</li>
<li>someone tells you they work in IT/computing and they can&#8217;t program &#8211; this often comes in the form of a third-person telling you their friend works in IT just like you!</li>
<li>someone tells you that the technology used <strong>doesn&#8217;t matter</strong>;</li>
<li>someone&#8217;s role call of programming languages does not extend to at least 4 and they don&#8217;t know at least one dynamic language &#8211; real brownie points go to those who know a functional language;</li>
<li>someone shifts a conversation about programming to something else &#8211; oh yes, including girls, well maybe not!</li>
<li>a developer tells you they don&#8217;t have broadband at home;</li>
<li>someone states that Agile development is essentially the same as the Waterfall model;</li>
<li>someone becomes a &#8220;developer&#8221; during a one year Masters conversion course &#8211; in particular sociology and arts students;
<li>a &#8220;developer&#8221; tells you they <strong>want</strong> to be a manager;</li>
<li>people don&#8217;t think they&#8217;re a geek.</li>
</ul>
<p>There you go, if you don&#8217;t agree with these then you ain&#8217;t a geek! However, you are at least one tenth of one! <img src='http://equivalence.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1297/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>the problem with frameworks</title>
		<link>http://equivalence.co.uk/archives/1128</link>
		<comments>http://equivalence.co.uk/archives/1128#comments</comments>
		<pubDate>Fri, 15 May 2009 10:49:12 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[web frameworks]]></category>

		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1128</guid>
		<description><![CDATA[I love frameworks. You love frameworks. We ALL love frameworks. As web developers we just can&#8217;t get enough of these things. They&#8217;re everywhere: from Rails, to MS MVC, to CakePHP, to Django, and so on. I&#8217;m so obssessed with frameworks that I spend more time thinking about what one to use than actually using it. [...]]]></description>
			<content:encoded><![CDATA[<p>I love frameworks. You love frameworks. We ALL love frameworks. As web developers we just can&#8217;t get enough of these things. They&#8217;re everywhere: from <a href="http://rubyonrails.org/">Rails</a>, to <a href="http://www.asp.net/mvc/">MS MVC</a>, to <a href="http://cakephp.org/">CakePHP</a>, to <a href="http://www.djangoproject.com/">Django</a>, and so on. I&#8217;m so obssessed with frameworks that I spend more time thinking about what one to use than actually using it. But this is not the only problem, as after choosing one, your problems can really start.</p>
<p>On a project that I have been intermitently working on for a little while now I chose to use CakePHP. The reason for this choice? Well first, I had a pretty good knowledge of PHP as I wrote my own little PHP framework when web frameworks were a mere twingle in their daddies eyes. Second, PHP is widely supported on shared hosting &#8211; though Ruby is catching up (that said, I&#8217;ve experienced some horrors with Ruby hosting). The widespread availability of PHP also means that PHP hosting tends to be cheaper.</p>
<p>Anyway, this is all beside the point. My real issue is with the size and complexity of these frameworks. Just the other day I was looking to do something as simple as validate an input that was supplied as an HTML POST parameter. Pretty simple right? Well it ended up taking me a disproportionate amount of time to do this task.</p>
<p>The first port of call was to find out if the framework itself supported this, which to my delight CakePHP (1.2) delivered on. Now it was down to the trawl/skim through the documentation trying to figure out how to actually do it. I found what I presumed done the task &#8211; basically I was required to add the appropriate validation rules to my model. Thus I added the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> Section <span style="color: #000000; font-weight: bold;">extends</span> AppModel <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Section'</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$actsAs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Tree'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$validate</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rule'</span> <span style="color: #339933;">=&gt;</span> alphaNumeric<span style="color: #339933;">,</span>
                                           <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
                                           <span style="color: #0000ff;">'message'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Alpha numerics only'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Then in my controller I simply called the <code>validate</code> method:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Section</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validates</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    parent<span style="color: #339933;">::</span><span style="color: #004000;">handleAJAXError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Section</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validationErrors</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>What happened? NOTHING! I passed data that should have failed and it passed. SHIT! I then decided to check to see that the rules were getting parsed so changed the <code>required</code> key in the rules to <code>true</code>, and passed nothing in. Now it worked &#8211; it asked me to specify the parameter. My logic was therefore it can see the data and the rules are getting parsed so what the hell is happening!</p>
<p>By this point I had spent quite some time trying to figure this all out. To be honest, I could have written the validation code quicker. So that&#8217;s what I decided to do. Yes I reinvented the wheel, it took me around 5 mins, dwarfing the <strong>hours</strong> I had spent trying to get the stupid library validation code to work. Not only that, much of the supposed benefits offered by using the built in validation code was of no use to me &#8211; it wasn&#8217;t built around AJAX requests. So what is the moral of this story?</p>
<p><strong>Well it&#8217;s read the documentation better, don&#8217;t run the most stupid tests, and don&#8217;t charge-in thinking you know how everything works!</strong> <em>WHAT</em> I hear you say?! </p>
<p>If only I had taken more care when reading, eh the first paragraph, in the documentation I would have observed this:</p>
<blockquote><p>First, set the data to the model:</p>
<p><code>$this->ModelName->set( $this->data );</code></p></blockquote>
<p>Whoops I never done this. Basically I wasn&#8217;t EVER passing in any data to validate, which makes my shocking test of changing the <code>required</code> to <code>true</code> to convince myself the rules and data were being parsed an absolute joke. Rushing in to write my hand crafted code is as bad as the other old chestnut of complaining &#8220;there is a bug in the compiler&#8221; &#8211; c&#8217;mon we have all said it <img src='http://equivalence.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  The only thing I can credit myself with here is that after a recent 4 week holiday I was stubborn enough to not give up and go back an look at it. Therefore, if there is anything to learn from this experience it&#8217;s that before starting something make sure you have taken the time to either read the documentation or listen to those trying to guide you. Oh and have a certain amount of stubbornness about you &#8211; not too much though.</p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/1128/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>are you in it for the long run?</title>
		<link>http://equivalence.co.uk/archives/479</link>
		<comments>http://equivalence.co.uk/archives/479#comments</comments>
		<pubDate>Mon, 02 Feb 2009 21:12:59 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[myspace]]></category>
		<category><![CDATA[optimization problem]]></category>
		<category><![CDATA[process optimization]]></category>

		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=479</guid>
		<description><![CDATA[As developers we are often faced with the issue of time vs. quality. Let&#8217;s face it though, we could spend forever getting it all just right, from documentation right through to unit testing. However, there has got to be a point when you let it go and see how it flies. This is particularly true [...]]]></description>
			<content:encoded><![CDATA[<p>As developers we are often faced with the issue of time vs. quality. Let&#8217;s face it though, we could spend forever getting it all just right, from documentation right through to unit testing. However, there has got to be a point when you let it go and see how it flies.</p>
<p>This is particularly true when you are faced with a real-world optimization problem, e.g. scheduling, time tabling, process optimization.  Often with this type of problem it is very difficult to obtain an optimal solution. However, I find the more time you spend on the problem the better you understand it, which normally leads to an improved model.  In turn, the improved model leads to a better solution, or an equivalent solution found in a shorter time.</p>
<p>This begs the question when do you give up and say it&#8217;s finished?</p>
<p>To be honest, I&#8217;m not sure what the answer is to that. As a developer I want to keep on going, hoping to pull the rabbit out the bag, but as an employer, I just want the thing done good enough to have a competitive edge.</p>
<p>The same goes for unit testing &#8211; especially at a startup. In this setting you are <strong>NOTHING</strong> until you get your product out the door, and until you do, you are hoping and praying that no one beats you to the punch. Some people say that quality shines through, but how bright it shines I&#8217;m not sure.  Take myspace as the perfect example. It has no redeeming features - it just got there before everyone else. Does anyone know a band not on myspace though?</p>
<p>However, Google proved that the best product can establish its market regardless of its starting position &#8211; I now find it difficult to believe that I thought Altavista was good. It&#8217;s important to remember though that for every Google there is a myspace (or the ipod, for that fact) where the first is not the best, but people have invested too much time in their choice to change (or in the case of the ipod, maybe it&#8217;s fashion outshining functionality).</p>
<p>So what IS the answer to when is the software ready to go? Maybe the simple answer is &#8220;whenever someone is willing to buy it&#8221;!</p>
]]></content:encoded>
			<wfw:commentRss>http://equivalence.co.uk/archives/479/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

