Tuesday, 28 May 2013

Finger Eleven - Them vs. You vs. Me


~ Sometimes so it reminds me… ~ 

Third studio album from Finger Eleven released in 2007, so I'm only 6 years late ;)

Unlike the previous two albums, which I listened to non-stop for 2 years of my life, this album doesn't have many songs I actually like enough to listen to regularly. The sound is still very much Finger Eleven though. My main gripe is that too many of the tracks don't settle on a melodic or heavy tempo which ends up spoiling them.

Anywho, three great songs that have made it into my regular playlist:

Paralyzer
The opening track on the album, it has a steady beat that builds nicely and I enjoy the energy :)



I'll Keep Your Memory Vague
This is an absolutely beautiful song which is my favourite track of the album. It has a brilliant melodic quality and I find the lyrics to be poetic and really emotive.




Sense of a Spark
This track has a nice homage to Stay in Shadow and I like the neat little rift at the introduction.


Monday, 27 May 2013

Live Templates

One of my favourite features of IntelliJ is Live Templates because it enables me to be more productive and makes my work a lot more enjoyable. In this post I want to share with you:
  1. An introduction to Live Templates
  2. How it makes me more productive
  3. Why I really enjoy using them!

What are Live Templates?


In a nutshell, Live templates are short-cuts for writing code. They can be incredibly simple but are also very powerful, allowing developers to quickly and reliably produce commonly used code constructs (such as for loops, covered later).

[A more detailed explanation and documentation can be found here: http://www.jetbrains.com/idea/webhelp/live-templates.html]

To find Live Templates within IntelliJ, open up the Settings (Default shortcut: Ctrl + Alt + S)


Above you can see the setting window and some pre-defined Live Templates. So how do you actually use them?

Gaining productivity


Using Live Templates is incredibly simple and there are many pre-defined ones we can you right now. One of the best ones that everyone one can mostly likely benefit from is the "iter" or for-each Live Template.

Suppose we have the following code:

  1. Collection<String> listOfNames = getFriendNameList();  
  2. // I want to wish all my friends a Merry Christmas  
Figure 2.1 - Initial code

Normally the next step would be you would start typing out a for-each loop manually. However, what you can do instead is:

  1. Collection<String> listOfNames = getFriendNameList();  
  2. // I want to wish all my friends a Merry Christmas  
  3. iter // type out "iter"  
Figure 2.2 - About to use the for-each live template

Now hit the "Tab" key and...



Hey presto! IntelliJ has constructed a for-each loop for you using your Collection! Note that IntelliJ automatically highlights the collection and you can navigate up and down between multiple collection candidates.

Hitting enter will then allow you to rename your item variable:


Again IntelliJ jumps straight to the variable and you can give it a sensible name. Finally hitting enter will pop you inside the loop, ready for you to start coding:



Here I used the "sout" Live Template to quickly produce the println statement, try this yourself!

This is a really simple example but it highlights how you can use Live Templates to automate the mundane loop construction and launch straight into the important functionality xD

Sidestepping the mundane!



Sometimes a coding task can be pretty repetitive and typing out the same sort of code over and over gets pretty mundane pretty quickly. This is where custom Live Templates can come into play quite nicely!

Let's begin with a simple example, creating a Logger.

Above you can see my custom "logg" Live Template which does three things:

  1. Constructs a Logger variable called log.
  2. Automatically imports org.apache.log4j.Logger
  3. Detects what class I am in and places it in the constructor argument.

Firstly you can see that the code is simply a variable declaration, which is what is inserted when I type "logg" and hit Tab.

Note the fully qualified Logger classpath, this is so that IntelliJ knows to import the log4j Logger. You can see on the bottom right of Figure 3.1 that I have checked "Shorten FQ names" which means the produced code will only have the simple name.

Finally I have used a Template variable "$CLASS_NAME$" to insert the classname. This is done by the "Edit variables" button which pops up the "Edit Template Variables" dialog. You can see I used one of the built in functions to return the classname.

[Read more about Template variables here: http://www.jetbrains.com/idea/webhelp/live-template-variables.html]

Conclusion


Live templates are fantastic and enable developers to spend less time writing scaffolding code and more time focused on the actual business logic and functionality. Although I only really found out about them relatively recently, I have woven it into the way I work and enjoying them ever since :)

For all those that use IntelliJ but haven't tried out Live Templates, I hope I have pipped your interest!

Wednesday, 22 May 2013

Agile In A Day - Training Summary

Yesterday I was luckily enough to go on a day course on Agile, which covered a multitude of topics and gave me a nice refresher on the topic.

Experiential Learning

Although it sounds like another bad buzz word, the concept of "experiential learning" was employed throughout the day. I actually really enjoyed it and I would definitely agree that the whole "learning by doing" concept.

Do Less... And Do It Better?

One of our first lessons was around one of the core tenants of Agile: uncovering problems and adapting to change faster. Our exercise basically illustrated that doing less work all at once meant you:
  1. Had less work to throw away if it all went wrong.
  2. Could find better ways to do the rest of the work.
Obviously doing things better doesn't magically happen, the techniques for continously improving is kind of what Agile is all about. The main technique/framework we focussed on was Scrum.

Scrum



A famous diagram I recall from my university days, sadly I have never really done Scrum in anger :( The biggest take away I had was the emphasis on "knowing what 'done' looks like". All your tasks in your product backlog should have concrete acceptance criteria, which ideally should be an automated test.

Another revelation was on the actual Daily Scrum meeting. Contrary to my experience, these meetings are actually supposed to last 15 minutes max and any problems should be discussed offline. Being strict with time and strict with your processes is very important in Agile, perhaps more so than in waterfall?

Finally we were reminded that Scrum is a framework which is abstracted from Software Development. You can in fact use Scrum for any project in any discipline! How you actually "turn backlog into product" is completely up to you, Scrum is a doughnut and it is up to you to find the jam to fill it with (your own processes/methodologies, e.g. TDD).

Understanding Requirements

We were shown some really useful techniques for gathering and understanding requirements:
  • 5 Why's - This is basically trying to get to what someone really needs, going beyond what they think they want to do to get it.
  • Clarification - Focussing on quantifying requirements and trying to put metrics against them so everyone understands what needs to be done.
  • Suggestions - When you understand what the real need is, at this point we can use our expertise to figure out the most effect way to deliver that need. At this point you want to remember things like KISS and YAGNI ;)

Retrospectives

One of the greatest takeaways I had from the training was the whole concept of linking retrospectives. So in every retrospective you follow these rough steps:
  1. What did we say we would change in our last retrospective?
    • Did the change go well?
    • Are we going to keep/disregard this change?
  2. What went well this iteration?
  3. What went badly this iteration?
  4. Name a few things we can change for the next iteration.
The whole idea of actually coming up with actions, recording them and trying to measure their effects is very refreshing. Whilst my experience of retrospectives is limited, actually trying to quantify changes beyond vague pieces of advice is stupidly obvious to me now.

Conclusion

As with any lesson, it is only useful if you put it into practice. Doing Scrum/Agile in isolation just doesn't work, although I can keep being disciplined in using XP techniques. Got to do more Test Driven DESIGN like I mean it!