Pattern-Based Software Dev – Day 3

Today was hand-in day for the first part of this module’s coursework – to design a shop, based on four requirements, using Object-Oriented design principles. Specifically, we had to use the State, Strategy and Item Description patterns, although I also worked in a couple of other patterns I like – Decorator (solves problems of composing functionality using recursion) and Iterator (hides implementation details of collections behind a simple object you can only iterate over).

I quite enjoyed having a simple pet problem like this, with a real reason to work through some aspects of it. If you’re interested in having a go yourself, the assignment reminded me of the first pragprog Code Kata – Supermarket Pricing.

As a result of the coursework, I’ve found a UML tool I can live with – Visual Paradigm. I’ll probably do a bit of a review and compare with the other tools I tried soon, but suffice to say it was by some margin the most pleasant and easy-to-use tool of the 5 or 6 I tried. £40 needed to get rid of the invasive watermark, but it looks like when it comes to CASE tools you get what you pay for.

The lectures are proving tricky to keep on top of – the pace is kinda slow (maybe that’s just me), so I find myself struggling to maintain attention. Still, the lecture notes are very detailed, so I spent a a few hours reviewing last week’s notes creating myself some revision material. I’ve been using a piece of software called Freemind to do ‘mind-mapping’, something I found out about in a presentation by Steve Brett in last years’ unsheffield unconference. It seems to work pretty well for the way I do revision, here’s a screenshot if you’ve not seen a mind map before.

Freemind Screenshot

So anyway, it’s all good. Coursework part 2 starts now, two more lectures in this module.

Advertisement

Pattern-Based Software Dev – Day 2

My Dell Vostro gave up the ghost a couple of days before the Software Development module was about to start. I tried the first day of the course without a laptop, but it wasn’t really working out so I bit the bullet and bought a new machine. I’ve only had it a couple of days, but so far I’m very happy with my new purchase. I’ll probably do a review after I’ve had it for long enough to judge, but here’s a photo of the new kit at the side of the old kit.

New HP dm3-1020ea (centre) versus Dell Vostro (right)
New HP dm3-1020ea (centre) versus Dell Vostro (right)

As for the course itself, day two brought in patterns to help understand the problem domain and patterns to help design at a higher level than software implementation, as defined by IBM.

The coursework requirements were also laid out.

15% will be a solution for a set of requirements, resulting in a object-oriented design for an electronics store. To be completed individually, assessment consists of UML Class diagrams in a 4-page report explaining how the classes solve the problems.

35% will be a 4-person team project, analysing a real e-business solution. Assessment will be a 15-page report, and includes team management aspects.

The other 50% will be assessed by exam around June.

Pattern-Based Software Dev – Day 1

I got a couple of great surprises this morning on turning up in Manchester for the module starting today.

First up, the lectures were originally timetabled for a 9:30am start, and are now timetabled for 11:00am. That gives me loads of time between arriving in Manchester at 08:00 and starting lectures to eat, get to the library, do any admin stuff that’s easier when I’m onsite and generally chill out before getting started.

Second – I signed up for ‘IBM Patterns for e-Business Applications’, because I wanted to get some Software Engineering coverage as part of my MSc, and there was some coverage of design patterns in the syllabus for this module in 2009. I was in two minds about it, studying something with ‘IBM’ on it didn’t seem entirely right for an academic course.

To my surprise, the course has been re-branded ‘Pattern-Based Software Development’ overnight, and a complete re-write of the lectures has started to appear that appears to focus on understanding and applying some of the GoF design patterns – pretty much the exact course I wanted to take. I’ve studied and applied some of the GoF patterns before, and I’m really looking forward to learning the syllabus and having my work critically reviewed.

As an aside, it looks like the Manchester CS department is completely re-working its taught MSc Advanced Computer Science proposition, organising the taught modules into ‘pathways’ like Artificial Intelligence and Natural Language Processing. Looks like a good move to me, helpful for students choosing modules.

The lecture material introduced the Strategy, State, Proxy and Item Description patterns. The first three are pretty well known, but it’s the first time I’ve come across the last one.

Coursework material involves UML Class diagrams and designing a system to solve a loosely defined business problem. Unfortunately, it seems that good UML tools are tough to find. After a few days of battling working with the Eclipse project’s UML2 plugin I’ve come to the conclusion that I don’t much like it for simple diagramming. I’ve tried a few other tools with limited success, just a couple left to try. It might be you do have to pay $$$ to get a good one – but we’ll see.

When Eclipse Plugins Don’t

Quick Version

If, after ‘installing’ a plugin for Eclipse 3.4 it’s not visible in Preferences or in context menus, check that your user account has permissions to write into the appropriate Eclipse directories – because Eclipse doesn’t warn you.

Preamble

For those who don’t know, Eclipse is an IDE heavily used for Java development. Like anything else, it’s a delicate balance of awesome and suckage, and today I got caught out by a pinch of suckage.

It’s a plugin-based platform, which means that anyone can write a piece of software that ‘plugs-in’ to Eclipse to extend or enhance the functionality. It’s a great approach, allowing me to tailor my own installation to my needs. Having recently re-installed Ubuntu Linux, earlier today I was trying to set up my plugins without success.

The Problem

I set up the m2eclipse update site as described in the documentation (pretty standard fare… Help > Install New Software…, paste in the update site URL and choose components to install) but after ‘installation’ was completed there was no sign of the plugin. There should have been new options appearing all over Eclipse, but no. Tumbleweed.

Tried installing the next plugin on my list… Subclipse. Same story. So not a problem with a plugin…

The Solution

…and then it dawned on me. I’d installed Eclipse into /opt, which is all locked down to root, with administrative privileges. Schoolboy error – no permissions for the plugin files to actually be installed under the authority of my user account, which is the context that Eclipse normally runs.

A quick chown to root:admin for the /opt/eclipse directory (rather heavy handed – I should probably have worked out which directories I needed write access to, but I was out of patience), ‘uninstalled’ the plugin in the Eclipse, tried the install again and then I was back in business.

I’m really surprised that Eclipse doesn’t complain when it’s ‘installing’ a plugin in directories to which it has no access. I may not be the sharpest tool in the box, but I’m fairly sure that permissions problems happen to other people too. I might go so far as to find out where you feed back to the Eclipse development community for once. Anyways, this post will help remind me next time I get this wrong, it might help someone out, and if nothing else you might be mildly entertained by my ineptitude.

Installing Ubuntu 9.10 from a USB Stick

Linux distributions tend to come as ISO images – files which are images of CDs/DVDs. I’ve always burned the images to a disk to install, but I’ve been meaning to try setting up a bootable USB stick instead.

Better for the environment, right? More importantly, I never seem to have a blank CD knocking about when I decide to do an install.

I expected some hassle, but it turns out to be trivial if you’re already on a Ubuntu machine, so long as your BIOS supports booting from USB devices. So…

  • Check the computer you want to install into supports booting from USB; if it doesn’t I guess you’re stuck with the CD option
  • Slap a USB stick with 2GB space or more in a slot on another Ubuntu machine (make sure there’s nothing on the stick you’ll miss if it gets lost!)
  • Start up usb-creator from the command line (just type usb-creator, or sudo apt-get it if it’s not installed)
  • Choose the .iso in the usb-creator utility
  • Choose the target USB device
  • Wait while files are copied and stuff
  • Pull out the USB stick when it’s ready, plug it into your target machine and reboot.

The familiar installer screens should start up.

More details here.

Finishing up the Machine Learning Module

Well, the Machine Learning exam was this morning… another 5:30 am start to get to Manchester in plenty of time.

My Top Tip for distance learning today has to be: if you have to attend classes, labs, exams – you know, stuff that you can’t really afford to miss, aim to be there an hour early.

Today, I didn’t realise that the exam wasn’t in the same building that I’ve had every lecture, lab and exam so far. In fact, it was on the other side of the campus, and it’s not a small University. I was very glad of having 45 minutes from checking my information to the exam starting! Totally my own fault, of course – focussed on studying and the date and time of the exam, I made an assumption – but these things happen. If you’re there early and everything works out fine you have time to relax and centre yourself. On the other hand, if there is a problem, you’ll be very glad of that time.

The course itself was a fascinating introduction to several aspects of automated learning. Starting out with linear and nonlinear classifiers, moving on to decision trees, then probabilistic classifiers, unsupervised learning and finally sequence learning, we covered a large set of knowledge with significant maths pre-requisites.

Most of the material was quite approachable (now that I’m largely over my irrational fear of mathematical symbols – I wonder if there’s an official phobia for that?), with the notable exception of the probabilistic stuff. I’m not sure why I had such a problem with it and even after some serious digging in books I’m still not totally clear on some of it. More work needed there in the future, I fear.

Funny thing about the maths stuff – it has taken/is taking me a lot of effort to penetrate the notation. Once I can read it, though, the concept hiding underneath tends to be fairly intuitive. Go figure.

So how did the exam go? As with the last one, I can easily imagine how it might have been much tougher. Feels like it went OK, but you never know do you?

Anyway, now the immediate study pressure is off for a few weeks I’m hoping to catch up on some reading (right now, a quarter of the way through Code Complete 2, by Steve McConnell – I’d like to finish that off) and get a few more blog posts in.

Perl is slower and faster than Java

Bit of a random one coming up…

I needed to get an measure of the difference in performance between Perl and Java for a simple client application, so I wrote the traditional ‘Hello World’ app in both and ran a bunch of executions averaging over the time from start to end of execution. The net result:

Perl is around 34 times faster than Java.

Really? I thought Java was supposed to be fast? In fact, Dhananjay Nene talked about how comparatively fast a selection of languages – including Java – were on his blog, and cwilbur ‘s comments suggest that in that experiment:

Java is around 100 times faster than Perl.

So how can these two conflicting results both be true? I’m sure you’ve already figured it out, but I’m going to tell you anyway.

Java code takes hundreds of milliseconds to start up, because Java code runs in the Java Virtual Machine which needs a little time to get itself ready before your code can run. Once it’s up, however, you can get performance close to (or even better than, in reality) that of typical C++. [edit – originally no supporting evidence was offered. My sources for this statement on Java vs. C++ are resources like http://scribblethink.org/Computer/javaCbenchmark.html like https://www.theserverside.com/opinion/Is-Java-slow-Compared-to-C-its-faster-than-you-think. Personally, I have very limited hobbyist experience of C and C++ many years out of date now]

On the other hand, Perl doesn’t need that environment and so can start faster but trades off more overhead at runtime, meaning slower running performance.

Just goes to show, application performance is another area where there’s no one right answer – it’s about choosing the right tool for the job – I don’t think there’s any way round these performance characteristics without cheating.

Stackoverflow Blog Podcast

Back in September, I blogged about how I’ve become a podcast addict. I said I’d follow up with short posts on the podcasts I listen to and why I give some of the precious little time I have to listen to them. I look forward to the stackoverflow blog podcast each week, so here’s why.

blog.stackoverflow.comThe Feed

Joel Spolsky (joelonsoftware.com, Fog Creek) and Jeff Atwood (codinghorror.com) started up the stackoverflow.com programmer’s Question and Answer site in 2008 and they’ve been running a podcast in which they talk about the site, the community that’s built up around it, software development and whatever else they feel like talking about.

Topics and Focus

The Stackoverflow.com Site

The design of the site and the decisions that the team made back then, and how those decisions have played out from the private beta to a site with over a million pageviews per day. I’ve not seen anywhere else you can get this kind of insight into a real project.

The Stackoverflow Community

From the initial programmer’s site, there’s now serverfault.com (sysadmin Q and A), superuser.com (for the family’s computer expert), meta.stackoverflow.com (Q and A about Q and A), careers.stackoverflow.com (jobs and careers stuff), and stackexchange.com (hosted stackoverflow engine providing Q and A site hosting on a paid-for basis), so there’s a lot of discussion about building and serving communities online.

Interviews

Over the past few months, there have been more episodes with software luminaries from outside the stackoverflow team, talking about what they do and their views on the sites.

The Transcript Wiki

Pretty much every word in every episode has been transcribed by listeners (there’s that community thing in action again), which means that the content can be accessed by search engines and people with impaired hearing.

Frequency

Weekly, only a couple of missed weeks over the life of the podcast.

Audio Quality

Always excellent, very clear and easy to listen to.

What’s Not So Good

Might be tricky to get into if you haven’t been following it, as I think there are a few recurring topics and in-jokes. I don’t think there’s much of that though, so I’d listen to a couple of episodes to give it a go if you’re interested in the topics.

Well, I think that about sums it up, cheers!

Reflections on the Year of the Blog

I’ve been rambling inanely on blog.crossedstreams.com for a year now, and it seems like an opportune time to briefly reflect on the experience.

Here’s some figures, to start with.

  • Posts: 61. (about 4.5 posts per month for thirteen months)
  • Genuine Comments: 52.
  • Spam Comments: 5,337. (Thanks Akismet, you rule!)
  • Feed Subscribers: 27. (My subscribers also rule!)
  • Most Visits in a Day: 75.
  • Total Visits: 3,556.

Here’s some highlights.

  • I’ve helped out a bunch of people from all over the world (and many of them took a moment to thank me, which is awesome).
  • I participated in (possibly even started?) an internet meme.
  • I recorded the ups and downs of my first year of doing an MSc for posterity.
  • I didn’t annoy anyone or get flamed.

And some stuff I learnt.

  • How to use WordPress. It was kinda clunky when I first started but the current version is a joy to use. The plugins I use (I use Feedburner feeds, Akismet spam filtering, Google Code Prettify, Google Analytics and Google Sitemaps, plus others) are totally transparent – they just work. Even the update process is a one-click thing now. Although I can’t help the cold sweat when I do that click, even though I have backups…
  • How to use Google Analytics. I pay nothing, but I have a toolkit telling me what pages people are looking at, where my viewers are in the world, what the trends are… I even have instant access to the complete historical record of that information – right back to last October. Just awesome.
  • How to use Feedburner. Takes the load of providing feeds off my site (OK, so that’s not really a problem with 27 subscribers I’ll grant you) and gives me some idea of how many subscribers there are and which posts get clicked through.
  • How to set up the blog.crossedstreams.com subdomain. I knew about DNS beforehand, but it was an fascinating experience to watch as this incredible global phone book lurch into action at my command. I have renewed respect for the genius of Paul Mockapetris in coming up with something so simple and yet so powerful.

Top 5 Cool Machine Learning Links

I’ve seen so much awesome stuff in my forays into Machine Learning as part of the course I’m doing, I thought I’d present for your entertainment and information my top 5 machine learning resources. (Kayla Harris suggested this infographic if you’re looking for a quick introduction to how ML is used in industry).

No, come back – some of this stuff is actually quite cool, I promise!

Here goes, in no particular order:

How to make $1M with Machine Learning and Netflix

Netfix offered a $1M prize for a team that could best their video classification technology by a significant margin.
The netflixprize page tells the official story, and the presentation attached to this blog post is well worth a look.

Detexify – Handwritten symbol recognition

For those of you that use LaTeX, you’ll know the pain of trying to find the code for a symbol if you can’t remember it. Detexify lets you draw a symbol on the screen, then uses machine learning techniques to recognise it and tell you which codes it thinks you need. The accuracy is astonishing – a really good showcase for the potential of the techniques.

Detexify in action
Detexify in action

Lego Mindstorms Robots that Learn

This JavaWorld article takes Lego Mindstorms and adds a pinch of Machine Learning to make a robot that learns to follow a path on the ground.

I highly recommend this article for a casual read, it’s very nicely written and accessible but does delve into the theory and mathematical foundations of the Perceptron algorithm at the heart of the article.

Machine Learning at videolectures.net

There are 794 presentations and lectures – that’s not a typo, seven hundred and ninety-four – on every aspect of machine learning you could dream of here, at videolectures.net, from a range of sources. Many are quite approachable for the layperson.

The Singularity Summit

To wrap up, the Singularity Summit seems to be the forum for the players in the general Artificial Intelligence arena to talk about the past, future and philosophical implications of AI.

The Conversations Network hosts a free podcast series for the summit – personally, I really enjoyed James Hughes’ twenty-odd minute talk, in which he answers one of  the great unanswered questions – if you’re standing on a railway bridge, are you safer stood next to an artificial intelligence or a human being?

That’s All Folks

I hope there’s something in there that’s given you some food for thought. If you have any stuff that you think is awesomely cool in this space, drop me a comment so I can check it out!