Moved (to Posterous). Giving away GoodBaad

It's been a long time since my last post, so to give myself a bit of a boost I've decided to move the blog to Posterous (sorry if this causes a flurry of reposts in you RSS reader). This should make posting a little easier and means I can get rid of my VPS server and save a few pennies.

I've also decided that I need an outlet for the code I produce out of working hours. Therefore I've started a GitHub account so that others can benefit from the work I've done.

The first chunk of code is my GoodBaad web-app that was started around 2 years ago. It was a lot of fun and was a chance to try my hand at building a scalable PHP site from scratch (year's of working with frameworks like CakePHP left me with a feeling that I needed to understand the process of building one from scratch).  Although it's a bit old now I think I learned a great deal about being economical with code and building small flexible units that were short, easy to understand and ran quickly. Some rough benchmarks on my workstation lead me to think  that this stack could out-perform the equivalent CakePHP stack by around 10 times. These gains were done without any data abstraction (I preferred raw SQL)  or a templating engine (PHP is a templating engine if you ask me), and the app didn't need page caching as it was pretty dynamic (and you could always use memcached if it became a requirement) .

The core MVC was loosely based on ideas described in Rasmus Lerdorf's no-framework PHP MVC framework blog post. I agreed that many frameworks simply bring too much code to a application and for me this hid the most interesting parts of writing code. So, the result was an MVC app that sits somewhere between the no-framework stack and something larger like Cake.

So, if you'd like to run your own version of GoodBaad or need a lightweight PHP MVC stack you can take a look at mine for inspiration:

GoodBaad on github

That's all for now, I'll be posting some functional programming stuff shortly (expect plenty of Lisp/Scheme/Clojure and JavaScript!).

Filed under  //

Comments [1]

Vim is a great text editor

Vim is a text editor (evolved from Vi) that originated on the Amiga. Starting out as a command line only tool, all text editing was carried out via key strokes rather than via mouse and GUI. I first came across Vim on Linux servers, it was confusing and I struggled with the simplest editing tasks.

Today Vim has become my primary text editor. I love it. I use it on Windows and Linux as a standalone app and embedded into the Eclipse IDE.

What makes it so good? In short, once you have mastered a few basic commands (similar to shortcuts) you find yourself working with text in a more efficient/involved way. Your hands rarely leave the keyboard, you can complete complicated tasks in fewer steps resulting in a greater feeling of involvement with the code. The physical task of writing code hasn't changed a great deal over the years and Vim has been refined, over the last 18 years, to suit this task. Basically: "it doesn't get in the way".

If you want to get to know vim a little better here are a few links that I have found really helpful:

There may be a steep learning curve but the rewards are well worth it!

Filed under  //

Comments [0]

Web development is changing to meet mobile needs

Since the I-Phone's release, the "general public" has been switched on to mobile computing in a new way. Previously expensive, high end, "smart phones"/mobile-devices were marketed to business users and geeks. Now the landscape has changed: devices are springing up from many manufacturers and Apple’s App Store model is popular across the board.

It seems logical that, as these devices become more widely used, the way users interact with web services will incorporate the mobile platform as a core method of interaction.

Next time I'm building a new service that needs to be accessible on multiple platforms I think it would make sense to build an API before a website. Until recently I've planned projects around browser based distribution, now the browser may become less dominant.

Having useful services open to many developers over an API will aid proliferation of the tool. Developers would be free to provide the applications for the various platforms (as Twitter have done, I suppose that's why the next step on from "hello world" is becoming the Twitter client on many SDK tutorials). I know this is nothing new, but as mobile becomes more embedded into daily life: the way developers build services on the web will need to shift to accommodate it.

This isn't really a "proper post" more of a stream of consciousness; I'm about to make the shift from Web Developer to Mobile Developer and am very excited about the new possibilities.

Filed under  //

Comments [0]

"The more people do, the more society develops, the more problems arise."

The title of this post is an excerpt (from an excerpt) of a quote by Masanobu Fukuoka (posted by Tom Hodgkinson on The Idler blog). Masanobu Fukuoka was a soil scientist who turned his back on the perceived wisdom of modern agricultural practices to develop a technique of "natural farming" that more closely mimics nature.

This approach appeals to me. As a developer it is a core skill to innovate and find solutions to problems. Often these are solutions built on top of other solutions. By taking a step back and viewing the developments from a broader perspective the solution may be to cut away "innovations" rather than adding to them.

Running Shoe Technology Goes Full Circle

I have recently become the owner of a pair of Vibram FiveFingers shoes. These are basically a thin covering for the soles of my feet allowing me to walk and run "barefoot" (the actual soles of my feet are far too soft to be practical).

I came across FiveFingers in the comments for this article about how the invention of cushioned shoes has changed the way humans walk and run. Sports shoes have lead to many humans walking and running in a fashion that differs from the way the foot evolved to be used. As a result many runners (tired of injuries associated with landing on the heel of the foot) are using "barefoot" training methods to keep their bodies healthy.

Here's a rough illustration of how barefoot running has come back around:

  • Humans evolved to walk on their hind legs, their feet acting a a shock absorber along with the ankles an knees
  • Shoes similar to huarache sandals arrive allowing the wearer to withstand uncomfortable surfaces
  • Fashion and innovation combine leading the majority of the developed world to wear shoes with some sort of heal
  • Around 1972 modern athletic shoes are invented, coinciding with the growth of sports sciences
  • Today more people than ever suffer from sport and posture related injuries which need corrective orthopedic treatments. Shoes like the MBT are invented to "correct" the foot and allow us to walk "naturally"

It seems that many of the claims that are made for the benefits of orthopedic insoles and MBT shoes are mirrored by simply wearing no shoes at all.

How about software and programming?

One example of the over-engineering that goes on in software development industry might be: templateing engines creeping into PHP.

PHP started life as a way to customise static web pages (e.g. adding today's date or simple hit counters), it then evolved into a way to manage page layouts and behaviour, effectively an interactive templating language. Further evolution has lead to PHP becoming a full blown Object Oriented Language, and with this development have come various frameworks that improve code reuse and working practices.

Then came an innovation that (in my eyes) went too far, templating languages were introduced to make them manageability of page layout and data representation easier. This meant more code to interpret them and therefore further load on the system running it.

One of PHP's core appeals is its ability to mesh directly with HTML, a language truly intertwined with the web; templating seemed an unnecessary step away from that.

For some applications abstraction layers may be a step too far especially when it is an abstraction based on an abstraction.

In a broader sense this could apply to software in the form of feature creep.

I'm not saying that innovation is a bad thing, far from it. But, it may make sense to look at the whole process and in some cases whittle it back down to provide the best solution.

To conclude the rambling

It is a paradox. If you define the success of a species by ability to bend the environment around to their will, then humans most productive trait is the desire to innovate.

However, innovation upon innovation can lead to imperfections and further problems (which in turn will need further solutions).

A valuable skill, to those who's vocation it is to innovate (software developers especially), may be to recognise when a problem can be solved by removing a layer of complication rather than adding yet another "solution".

Filed under  //

Comments [0]

Pocket Programming: Learning New Skills Anywhere

Summer is here, and in a few days I'm off on holiday. Aside from the eating, drinking, sleeping, sight-seeing and reading: it may be a good chance to hone my problem solving and Python skills.

I'll be travelling light, taking in the east coast of Spain. So, any coding has to be done in the most portable/light-weight fashion.

Here is my pocket sized kit list for an ultra-portable programming environment:

This list is weighted towards to those of you with Symbian phones, but most smart phones have some sort of access to a programming language.

The one of the most appealing aspects of this kit: it is super cheap. The phone was "free" on a 1 year £25 p/m contract, the O'Reilly Book is about £6, pen and notebook another three quid: that's a cheap way to learn some valuable skills.

I'm sure there are a ton of alternative setups (Android, Windows Mobile, Palm, I-Phone?). A bare minimum set of requirements could be: a text editor and a web browser capable of parsing JavaScript (this may be possible on not so "smart phones").

If you're using an alternative setup, or have another way to program on the move, please add it to the comments.

Filed under  //

Comments [0]

Which Language Combination?

I'm trying to be a better programmer. I have been writing and learning as much code as I can, the benefits are a threefold positive feedback loop:

  • Learning is, in itself, very pleasurable (it makes you feel clever, which is nice)
  • New knowledge transfers to, and enhances, existing skills
  • New tools and skills provide a greater resource for providing solutions

But, how does a developer know which skills to learn and which languages are best to learn with? (Assuming that you're learning for fun rather than as a work requirement.)

If Google is a good bench mark (assuming that they can take their pick of the best developers), one requirement (taken from an ad for a Software Engineer) asks for:

Fluency in two or more of C, C++, Java, Shell, PHP, Perl or Python.

If you are specifically aiming for a career at Google then making sure you are fluent in two major languages is probably the way to go, and there is certainly no downside to a developer broadening their skill set. In my experience, each foray into new languages has improved my PHP, and in turn, I feel pretty comfortable in Ruby and Python.

When deciding to learn something new: you could argue that PHP, Ruby, Python, Perl etc... are pretty much different brands of the same tool (procedural, interpreted languages). It's great to have the option to use each, but these languages are not necessarily complimentary. It is unlikely that you would write a system with a combination of PHP, Python and Ruby. But, it is conceivable that you could have a project requiring C, PHP and Erlang skills.

Rather than learning interchangable skills, complementary languages might offer the opportunity to become a more rounded developer:

  • Interpreted, procedural (PHP, Ruby, Python, JS)
  • Compiled, procedural (C/C++, Java)
  • Functional, concurrent (Erlang, Scala, F#)

Assuming that side stepping between similar languages is easier than picking up a completely new concept: it would seem learning these varied skills opens up more possibilities.

Sometimes I worry that by learning a particular, none mainstream, language (like Erlang) I could be backing the "wrong horse". However, bearing in mind my earlier ramblings, there's little downside to picking up a new way of doing things, for example Elang may not prove popular, but the functional approach will give me a head start learning F# or Scala.

This slide from Painless Payment Processing by Erik Stenman points out other benefits of learning more "unusual" languages:

Nice paradox:

The lack of Erlang programmers makes it easier for us to find great programmers.

  • There are many great C and Java programmers, I'm sure, but they are hidden by hordes of mediocre programmers.
  • Programmers who know a functional programming language are often passionate about programming.
  • Passionate programmers makes Great Programmers

Or am I talking nonsense?

What I've been reading/learning this week

I've been too busy this week to form a proper blog post, so instead I thought I'd mention some good content I've consumed.

Functions + Messages + Concurrency = Erlang : Joe Armstrong

This talk from Joe Armstrong (author of Programming Erlang) gives a really clear breakdown of the reasons concurrent languages (like Erlang) are becoming more important as processors gain more cores. The following quite gives good flavour:

Due to hardware changes:

  • Each year your sequential programs will go slower
  • Each year your concurrent programs will go faster

Although Joe focuses on Erlang, this applies to all languages tackling concurrency (Scala, F# etc...), thoroughly recommended to developers wanting to know more.

McMafia, Seriously Organised Crime : Misha Glenny

This book has nothing to do with programming (directly), and it may appear at first glance to be some sort of "aren't gangsters cool" book for macho teenagers. Far from it.

Misha Glenny has been a BBC correspondent covering eastern Europe's wars, politics and then crime (if you've ever heard or read his reports and articles you'll know he's a very clued up chap). This interest lead him to investigate organised crime around the world. The resulting book is unbelievable (in the literal sense), it reveals how deeply organised crime is intertwined with our day-to-day lives.

The entire book is fascinating, and highlights they way organised crime can eventually gain so much power it becomes a part of the establishment and has influence over global politics (not just as an issue but as an instigator). It literally effects the lives of everyone on the planet.

Perhaps one of the areas that gets the least coverage is "digital crime". This is not due to it's insignificance, quite the reverse. It is huge and vastly profitable, the problem seems to be that researching it is almost impossible. Police forces simply don't have the funding and resources to gain enough understanding of the way the cyber criminals operate. It's a subject I'd love to know more about, and one that I'm sure will become more and more important over the coming years.

I can't recomend it highly enough.

Code Complete 2 : Steve McConnell

People have been banging on about this book for ages, so I caved in and started reading it (especially as I found it in the work bookshelf, saving me 30 quid).

I'm only 1/3 in but it already lives up to the hype. Clear, humorous and very well written. One misconception I had was that it is a straight manual to writing code. In many ways it is, but it goes much further into the thinking processes developers use. It highlights familiar problems and explains the solutions in a way that "just works".

Basically, if you heard about it and thought it might be worth a read: it is. Read it sooner rather than later, two chapters in I felt like I understood my trade better and that I was on the right track.

Filed under  //

Comments [0]

Goodbye Browsers: What Next?

It has been mooted fairly often: that the web may be breaking free from the browser, and I'm enclined to agree. So what does this mean to developers and how will this effect the web development process (and my first Erlang Web App)?

I'm currently upgrading a site that will need dynamic elements and interactivety intertwined with flat HTML files in a standard directory structure. During the technical design process it is also becomming apparent that these dynamic features will need to be distributed over various media and platforms.

None of these are unusual requirements and I've been developing similar projects for a number of years. However, my approach is beggining to change. Previously I would have built the whole system with my PHP framework of choice (CakePHP) and used it's inbuilt Views to publish the content in various formats (e.g. HTML and RSS), I'm now rethinking.

Our content needs to spread onto the ever widening array of platforms and media, so our publishing methods need to become more flexible. The solution I'm favouring is to publish content over some sort of web service or API and have the client platform, what ever it may be, interpret (and possibly redistribute) it. The RDF Standard is one format that is gaining popularity, especially as semantic technologies become more mainstream.

These principals are probably further advanced in the realm of Web Applications: it is becoming common place to produce an API allowing other platforms to interact with them. Turning the app into a platform (via an API) allows other's to build on top in turn engraining it into their business model (For example Good Baad relies on 5 or 6 different APIs). Google have been providing useful APIs for years and the results are plain to see.

It seem likely to me that the development process may change as a result. Currently an web app or content is built first as a website and then expanded into and API or feed. It seems more practical to build the API first and then this can be adapted to other platforms.

For example: I moved my blog consumption to Google Reader, now I rarely see the sites that the content originates from; I interact with blogs entirely via their RSS feed over the platform of my choosing. With web applications it seems like the same is becoming true, very few people interact with Twitter directly, but prefer to interact via the API (3rd party apps is one key to their phenomenal growth). And, if concepts like Ubiquity take hold: the web may break free of the browser entirely.

And this brings me around to my Erlang project: I'm still mulling over ideas, but it seems to me that a real-time app that is purely an API would be a very good first project. Also, Erlang seems very well suited to the Web API building task, e.g: from a data distribution view point Couch DB is pretty much all you need.

Over the next few weeks I'll build a simple Erlang app that interacts with the web over an API, it's possible I won't need to worry about building a client at all.

Filed under  //

Comments [0]

Notepad-Plus-Plus Plus Erlang

My primary dev environment is Windows, my main IDE is Eclipse or Aptana (leaning slightly towards Aptana's flavour of Eclipse lately, especially for PHP and Ruby on Rails), and for quick code edits, messing about and text editing I use Notepad++.

Notepad++ has served me well over the years: it's free, loads up fast (unlike the big IDEs) and gets the job done. I know that there are quite a few alternatives (In Type looks particularly appealing), but NP++ does what I need nicely.

However, I was quite surprised and disappointed that there was no inbuilt support for my new favourite language: Erlang! A quick Google around revealed that I'd have to add a user defined language to my installation, less quick was tracking down an example file for Erlang. I eventually discovered this old mailing list post. I then built my own variation that suites dark backgrounds, you can download it below.

To install you will need to replace or merge with the *path-to-AppData*/Notepad++/userDefineLang.xml

file. If you don't use a dark background alter the WordStyle tag properties: fgColor and bgColor to suit.

Download the userDefinedLang.xml

Let me know if you know of any better versions or edits, I'm sure mine is incomplete.

Filed under  //

Comments [0]

Hear my voice (on the Guardian Tech PodCast)

Last Friday I went along to the Guardian Tech Weekly Tour's visit to Bristol (in case you didn't know I mostly grew up and now live in Bristol).

I thought it'd be a good chance to meet up with a few faces from the local start-ups and web-development scene. So, I was pleasantly supprised to be able to have a chat with Jemima Kiss and get a bit of advice/insight into the projects I'm working on, I assumed that she'd be mobbed and too busy. She gave some really constructive and positive feedback on the web apps I'm building; it was a pleasant end to the week.

While there I was also interviewed for the podcast about what makes Bristol a good location for web development and starting a business (not that I know a great deal about the latter). I was slightly drunk on one and a half pints (it happens that way sometimes) so didn't expect to make it into the show... But, I did - so if you want to hear my weird high-pitched voice listen to Tech Weekly: On the road in Bristol (I pop up at 22:38).

PS: If you're bored of posts about my day-to-day existence: fear not, there's some solid programming fun coming up later this week...

Filed under  //

Comments [0]