The Dragonborn comes

I’ve been playing a lot of Skyrim recently and I’ve really enjoyed it. In an unusual state of affairs I find myself liking the theme tune a lot too, rather than something to be skipped through as quickly as possible I quite often leave it playing for a little while.  It conveys quite an adrenalin pumping message. In stark contrast to this video I found of a Spanish girl singing one of the Bard songs from the game followed by part of the theme song. She sings it beautifully and its quite haunting. Anyway, enjoy!

You can find her web site here.

She sings”The Dragonborn Comes” first, here are the lyrics

The Dragonborn Comes

Our hero, our hero, claims a warrior’s heart.
I tell you, I tell you, the Dragonborn comes.
With a Voice wielding power of the ancient Nord art.
Believe, believe, the Dragonborn comes.
It’s an end to the evil, of all Skyrim’s foes.
Beware, beware, the Dragonborn comes.
For the darkness has passed, and the legend yet grows.
You’ll know, You’ll know the Dragonborn’s come.

This is then followed with:

Dovahkiin Dovahkiin
Naal ok zin los vahriin
wah dein vokul mahfaeraak ahst vaal
ahrk fin norok paal graan
fod nust hon zindro zaan
Dovahkiin fah hin kogaan mu draal

Which translates too:

Dragonborn Dragonborn
by his honour is sworn
to keep evil forever at bay
and the fiercest foes rout
when they hear triumph’s shout

Enhanced by Zemanta
Posted in Gaming, Videos | Tagged | Leave a comment

Clean Code – A talk

I’ve recently watched this video of Robert C Martin giving a Clean Code talk at Java Forum in Stockholm. This post will be a mix of description of the talk, and my thoughts on the content.

Clean Code, Robert C Martin, Javaforum Stockholm 2011-08-24 from Björn Caroll on Vimeo.

It opens with quite an entertaining piece, that has nothing to do with the talk, on lasers and how we discovered the speed of light. It made me laugh at least.

Robert goes on to discuss why code rots over time, from the lightning fast, clean world of green field development, to modifying a now complex and enormous code base. The reason it rots is that developers make small mistakes, but these small mistakes keep building up and up, until the code is a large pile of small mistakes that happen to work together.

Now this build-up happens because developers are afraid to clean code, because if you try to clean code, you will break it. So we leave it, we tell ourselves “someone else will do it”. That someone else may never come along, and you are the one who gets assigned the bug that means working on that code. It’s your problem now… Don’t you wish you had cleaned it earlier?

To avoid the fear we need the safety net of unit tests, to give us the confidence that any change we make does not have unintended consequences outside of our immediate context, and also to give us a point where we can boldly declare, “This code is clean” and just as importantly, it still works.

However, writing tests can take just as much effort as writing the real system code in the first place, so how about dealing with it in small chunks? Write a test for a small bit of code, then write the code, test, code, test, code. Wait… Write the tests first? Yes, TDD. This is something I have heard about, read about, told myself to practice, but so far I have failed. I intend to remedy this; my estimates at work will need to increase but it should result in a better product, a better programmer. I see it as an investment now to reap rewards later. Now I just need to get management to see it that way and accept higher estimates.

As an aside Robert proposes an interesting idea for a metric to use in gauging how productive a team is: How good are they at using the debugger? He postulates that the relationship is inverse, as the only way to be good with the debugger is to spend a lot of time using it, and the more time you spend debugging, the less time you spend producing. An interesting thought; one I may revisit in another post.

Robert mentions another interesting idea, almost a consequence of TDD, that I had not considered or come across before. Get your QA department (if you have one) involved early, get them writing automated tests based on the requirements and hand those to the development team. The developers’ job then becomes writing the code (and probably more detailed unit tests) required to make those tests pass. If they pass, the requirements have been met, and your software is in a shippable state. No more dumping on QA at the end of the process, probably late, and with no slippage allowed to the shipping date. It seems so obvious: Who better to write tests than testers? I wonder how many companies that have a QA department follow this, though.

A direct quote from the talk: “Agile is there to destroy hope.” At first this got a big laugh, because Robert was obviously being sarcastic… wasn’t he? He was being dead serious; he goes on to discuss how hope is what leads to unrealistic estimates, delayed decisions, people hope things go well, hope that things will work out. Agile is there so it is known as early as possible that things are going wrong, so that you can make changes, adjust expectations, whatever. These are the reasons you should have your Burn-down chart and Velocity chart prominently displayed for the world to see. It may not be pretty, or pleasant, but it improves the end results. In the long term things should improve as long as lessons are learned along the way.

On the topic of test coverage, 100% should always be the goal. It may never be attained, it may not be possible to get there for your code base, but it should always be the goal. This goal belongs to the software development team. If the goal belongs to management, then it becomes subject to all the pressures that go with everything else management touches, and every software developer will tell you that management goals are different, strange beasts. It will lead to cut corners, hacked tests to make them pass, and will become self-defeating. Keep the goal in the team, foster the attitude of professional pride, and the team will be constantly seeking to increase coverage. I like this idea of constantly striving to improve – it’s the kind of thing that would make me enjoy my work if a company encouraged it in the right way.

To go back to the unit testing idea, writing tests for long complicated methods will lead to long complicated tests and this is obviously not ideal, so, as you would expect if you’ve read Robert’s book ‘Clean Code’, he advocates small methods. How small? 3 to 5 lines, but with a long descriptive name. Eclipse’s “extract method” tool is immensely helpful in keeping your methods small, because it allows you to continue making them smaller and smaller until you can extract no more.

On a personal level I disagree with putting any number to the question of how long a method should be. My view is this: “It should be exactly as long as it needs to be, to do what it has to do – no more, no less”. At first glance that may seem to contradict Robert, but if you think about it alongside the DRY principle, you end up at the same place. I just feel that there will always be cases where your method has to be longer than 3 lines. I am in no way defending the 100 line long methods, I’m just saying that a number doesn’t help to convey the intended meaning behind the answer.

At the end of the talk Robert opened up to some questions, as most talks tend to do. I found these very interesting for different reasons. There was only time for two questions but here they are.

“How many arguments should a method have?” Within the answer Robert mentioned “never pass a boolean into a method”. At first I was slightly taken aback; in the seconds I had to take that in, I couldn’t see why. The answer was obvious, as soon as Robert stated it: A boolean means your method is doing more than one thing, a boolean declares that there is an if statement in there. You should have two functions – one for the true branch, one for the false. Now, I see some problems with this, as surely the further up the hierarchy of your code you go, you’re going to need to pass in multiple arguments, and even some booleans. I’m writing this post as I watch the video so I’ve not really had time to mull this over; hopefully I will before I actually post this to the site, but if I don’t, at least you know. If you have any thoughts on this feel free to leave a comment.

The second question was, “Is it possible to apply your ideas to already destroyed code?”, meaning legacy code. This resonated with me as the company I work for has a couple of legacy products that could really do with being revisited, as they are large and complicated and just keep getting more so. In short the answer is yes, as I expected, but it is hard, very hard. What I didn’t expect was this: “Never make a project to do this, never go to your manager and say, ‘We need 3 months to write tests for this,’ because you will fail!” What I take from that is that it has to be an ongoing commitment to refactor that legacy code. It will be hard, things will break along the way, and it will take as long as it takes. However, with every refactoring, with every test, that code base is improved. These improvements build up and up, until you have a big pile of improvements that all work together and you can prove it, with tests.

An interesting talk that I enjoyed, and it just moved Robert’s new book ‘The Clean Coder’ further up my reading list.

Posted in Software Development, Videos | Tagged , , | Leave a comment

25 Questions you should ask yourself.

I came across this page today and my first thought was “Yeah, yeah, it will be the same old stuff” and whilst this is true to some extent many of the questions are truly thought provoking, and perhaps even a little scary when you think what your answers could be. Its well worth a look and I’m going to try and find some time to sit down and actually think about them. A lot of them come from ThoughtQuestions.com so if you like them, you should check that site out for more.

Get your message across

Get Your Message Across

 

Posted in Links | Tagged , , | Leave a comment

New Developer rig based on H67 chipset and i5 2500K

Well I’ve finally went and done it. After many months of looking around and changing my mind about everything, I’ve placed my order with Ebuyer for all the components I need to build my own system.

I’ve built systems in the past that were on tight budgets and involved a certain amount of cannibalisation of older systems. This, however, is the first time I’m building completely from scratch and with good sized budget. I had two main aims for this build: I wanted something with good raw power, and would still be nice and quiet.

With these two overriding priorities, a Sandy Bridge processor and an H67 Express chipset motherboard went galloping to the front of the herd. The Sandy Bridge processors offer incredible boosts of energy efficiency for their respective power ranges, and the H67 chipset allows the use of the processors on-board GPU. The Intel Integrated Graphics HD3000 that comes with my processor of choice is more than good enough for my day to day tasks and can even handle older games at good quality levels and newer ones at playable frame rates.

With noise levels being important I turned to the website silentpcreview.com for help in choosing my PSU and case. This website is a gold mine of information with reviews on so many components. The Antec P183 is on their recommended list, and the Coolermaster PSU gets a good review.

The real luxury buy though was in choosing an SSD to boot from and store my frequently used applications and data. This should hopefully keep my machine running smoothly and quietly for some time to come.

Below is a list of the components with their product number linked to the Ebuyer website.

  • Processor: Intel Core i5 2500K 3.3GHz 251596
  • Motherboard: Gigabyte GA-H67A-UD3H-B3 H67 Socket 1155 ATX 258684
  • OS: Microsoft Windows 7 Home Premium 168373
  • Case: Antec P183 V3 – GunMetal Grey Super Mid Tower 253339
  • PSU: Coolermaster Silent Pro 500W Modular 147112
  • RAM: 2 x G-Skill 4GB DDR3 1333MHz Ripjaws CL9 1.5V 226283
  • Hard Drive: Seagate 1TB Sata-III  Barracuda Green 253335
  • Hard Drive for OS: Kingston 96GB V+100  SATA-II SSD 246998
  • Montors: 2 x Iiyama 24in widescreen eco black monitor 245284
  • Optical drive: Sony DRU-880S 24x DVD±RW DL & RAM SATA Black 240593
  • Keyboard: Microsoft Natural Ergonomic 4000 97577
  • Mouse: Logitech Performance MX 172750

 

Posted in Hardware, Software Development | Tagged , , | 1 Comment

Is this really Uncle Bob?

In the last few months I’ve become involved in the series of Q & A sites that come under the Stack Exchange banner, primarily the sites known as Stackoverflow and Programmers.SE.

Stackoverflow is a site centred around code oriented problems, and since its launch in 2008 has proven to be a wonderful resource for amateur, student, and professional programmers alike. This is one of the more mature Stack Exchange sites and it shows in the quality of its users. The user base covers a vast array of programming languages, contains published technical authors, and leading developers for some of the worlds biggest companies. Not the least of these users is a man called Jon Skeet, author of C# in Depth and current top user by reputation score (all questions and answers are voted on by other users, thus giving “reputation”). I single Jon out here for his consistently high quality answers, and what that means to the community of users. The existence of such users (and there are several others) on the site creates a slow burning feedback loop where better answers better educate the rest of the user base, thus improving others’ ability to answer questions, be they in their work or on the site. It also improves the standing of the site in the meta-conscience of the programming community by having high profile, high quality users. Bear this in mind for later in the post.

Programmers.SE is a sister site to Stackoverflow which is meant to cover the craft of programming, everything else that is specific to being a programmer that isn’t actually code. This site only launched in December 2010, so less than 6 months old as I write this post. It’s a slightly unusual site for the Stack Exchange network because the area it is meant to cover naturally leads to very subjective questions, normally a no-no for Stack Exchange sites. However, realising there was a need for this type of site, but also a need to keep a rein on the questions becoming too subjective, the 6 guidelines were born. These took some time to come to fruition and indeed the community is still working to learn about itself and educate new users accordingly, still growing… it is only a baby after all.

The point about high profile, high quality users is what prompted this post, and the addition of one in particular to the Programmers.SE site. On a question entitled “Can a function be too small” an answer appeared with a user name “Uncle Bob”. It’s an unassuming name, and might possibly have slipped by if it wasn’t for the type of question, but to many programmers “Uncle Bob” is Robert C Martin, author of Clean Code. Now this book has influenced an untold number of programmers, and for the better. I’ve read it once and it changed how I viewed my code, and I plan to read it again to ingrain more of its practices in my head.

Robert Martin is exactly the kind of user Programmers.SE needs, a high profile, high quality user. I don’t want to take anything away from the other users of that site, many have provided fantastic answers to incredibly interesting questions, and are the reason the site made it out of beta and has continued to grow since. However attracting someone like Robert Martin to the site adds to the prestige of Programmers.SE. Here is a site where you can possibly be getting advice off of some of the leading lights in our industry. That is the kind of site developers like to be part of, we don’t like poor quality, we hate wading through the mounds of chaff produced by so many on the internet on our way to getting the information we need.

Now, before I get too carried away, Robert Martin has only posted once to the site to my knowledge and is as yet an unregistered user. However just  that brief visitation filled me with confidence for the future of one of my favourite sites. I hope he visits again, and I hope many more like him do to. These sites live and breathe because of their users, so come one, come all, bring your good questions, or your great answers, or just your burning desire to be better than you are at what you do.

Posted in Musings | Tagged , , , , | Leave a comment

Reading List

I’ve decided to get organised about my reading, the technical books have been piling up as I keep buying a new one before I start/finish the last one. I’m not kidding about the pile either, currently it’s 19 books high, if I’m lucky I’ll get through it this year. As part of my motivation and for the benefit of my own future self, I plan to publish my thoughts on each book as I read it. The best known books in the pile are Code Complete 2, The Art of Unit Testing, and Effective Java, all of which are considered must reads by most programmers.

So, if I must…

Posted in Books | Tagged | Leave a comment

Best Mars Images From Orbiter’s First 5 Years

I recently found this link in my Twitter feed, and I’m just a sucker for beautiful pictures of other worlds.

Best Mars Images From Orbiter’s First 5 Years | Wired Science | Wired.com.

I’m busily trying to track down some high-res copies that I might be able to hang on the wall.

Posted in Photos | Tagged , | Leave a comment

One month on

I’ve now had the domain for a month and to be honest I’ve not had too much time to commit to it. I’ve gotten as far as a few scribbles for a logo, which if I can translate into an image via inkscape, paint.net, or photoshop, will actually be quite cool. I’m still not entirely sure if I’ll try to keep this site as a professional portal into my life, or make it a personal one. Knowing me it will end up a bit of both.

I have a bit of a “big thought” article on the go about what it means to be a good developer, which to me is an interesting thought excercise which will hopefully transform into a good read for anyone who finds it. However the vast time difference between my first post and this one has convinced me I should post smaller pieces more often (even if they stay on the same topic for several posts) as well as keeping a few large pieces slow burning in the background.

Posted in Introduction | Tagged | Leave a comment

Hello world!

I hadn’t considered what I would use as the title of my first post here but the default supplied by WordPress seemed quite fitting as a Developer.

I’ve been thinking about getting my own domain for years but this weekend I finally decided that it cost so little I could consider the first year a throw away purchase. I’m not 100% sure what I’ll use it for. I’d like to think I’ll continue this blog, even if no one reads it purely as a cathartic experience. I may add some kind of wiki that I can add to and use to keep the thousands of little hints and tips I find, use, and (eventually) lose in the day to day events of my work. It may eventually showcase some coding I do. I don’t know.

I guess it will just be about everything and anything.

Posted in Introduction | Tagged , | 1 Comment