Use Chrome as Your JavaScript IDE

Earlier this week I attended FOWD, a fantastic conference for web designers and developers in the heart of London.  One of the highlights of the trip was the JavaScript Web Warrior workshop with Addy Osmani. He mentioned  that using Chrome Experiments you could edit your JavaScript right there in Chrome, without needing to bother with any other editors. Here’s how to enable that feature:

  • Download Chrome Canary. Standard Chrome doesn’t have this feature yet, so it’s time to live on the edge. Of course, Canary can be installed alongside Chrome without any issues, so it’s cool. 
  • From Canary, navigate to chrome://flags and enable the Developer Tool Experiments
    Screen Shot 2013-05-17 at 09.54.43
  • Restart Canary and then navigate to the site, hosted locally, that you want to work with.
  • Open up Chrome Dev Tools, and click on the settings cog. From here, navigate to the Workspace section.
    This is where you can set up the mappings from URL to file system. Screen Shot 2013-05-18 at 09.05.36

Obviously you will need to give Chrome access to your filesystem.

 

And that’s it – you’re good to go.

In the following video, Addy gives a run down on how to use this workspaces feature:

Shipping Greatness: Book Review

Something every developer and team aspires to is shipping great software. But as we all know, it doesn’t always work out that way. So what can we learn from Chris Vander Mey’s Shipping Greatness ? 

First, let’s take a look at the authors credentials; Chris has worked as a product manager at Google and an engineering manager at Amazon; two companies who have a pretty good track record when it comes to delivering products. So, I guess he has learned a thing or two.

The book is split into two parts. The first focusses on the step by step shipping process that the author has seen used in Google and Amazon.  This starts with defining your misson, puts a spotlight on creating a great user experience and deals with the testing and measurement of your delivery.

The second part of the book looks at the best practices and techniques that you should use as someone trying to orchestrate a great delivery.  Skills that you will read about in this section include how to build a team that is up to the task, and how to be a great communicator and decision maker.

While the book will appeal to anyone who wants to build great, meaningful software products, it is probably managers and technical leads that will get the most out of Shipping Greatness. 

There’s a really nice “10 Principles of Shipping” list at the back of the book, which any leader should keep in mind – maybe put a printout up on the team whiteboard. These principles include tips such as  ”start with the user and work outward” or “you’ll never do the whole job, so first od that which only you can do”.  As well as showing the way to deliver greatness, this book could help improve how you lead your team.

Running Lean: Book Review

If you want to execute lean practices at your startup, then Running Lean   by Ash Maurya should be top of your reading list.  Highly regarded by reviewers across the board, the book claims to help you to Iterate from Plan A to a Plan That Works. So how does it do that?

The book is broken into four distinct parts. First, you are introduced to a roadmap of how to apply the process, which is made up of three meta-principles: document your plan A, identify the riskiest parts of your plan, and then, systematically test your plan.  For software developers familiar with agile processes, this may sound familiar. But don’t let that stop you from learning how to apply these principles.

I claim to understand lean/agile and any other buzzword that claims to get the right product out quickly. But understanding and execution are two entirely different things. Ash does a fantastic job of explaining the intricacies of each of these steps. Even the documenting of your plan A gives some great tips on working out what your business model should be, what to prioritise and how to track progress.

The part that gets most focus in the book is the testing of your plan, where you need to go through the steps of understanding the problem, defining the solution and validating the solution.

As a software developer, this book made me realise the value in a defined iterative process. As someone who’d like to create my own company, this book provides a useful handbook for the early days of a startup.

Gradle Effective Implementation Guide: Book Review

Until recently, Ant has been my build system of choice: functional, proven and, it just works. So, I was intrigued to see what Gradle could provide instead. So when Hubert Klein Ikkink , one of DZone’s leading MVBs on Groovy, gave me the chance to review his Gradle Effective Implementation Guide , I could hardly refuse.

The book begins with a really good introduction into what Gradle actually is. Useful for Gradle newbies like me, but most people can probably afford to skip it.  The book then goes through the main things you’ll want to do in your Gradle build scripts; using tasks and dealing with files and directories; before showing how easy it is to use Gradle for your Java projects. Later on the book illustrates how you can use the Scala or Groovy plugins to build projects for those languages, and how to build multiple projects that are dependent on each other.

I found the chapter on writing custom tasks and plugins to be particularly useful. Most importantly, the author explains how you can write tests for your custom plugins to ensure they work as expected. As you’d expect, Gradle has good IDE and continuous integration support, all of which is explained in the last chapters.

The book will probably appeal more to people who are new to Gradle. I found the explanations to be be really detailed and useful. Whether I’ll use Gradle for my next project, I’m not sure – but it certainly is tempting

How To Be The Next Big Thing

Everyone wants to be the next big thing, but few of us are fortunate enough to know where to start. Luckily, Paul Graham gave some insight into this in his latest post, How To Get Startup Ideas.

There’s one piece of advice that keeps coming up, whether it’s in this latest post from Paul, or the Steve Jobs biography - build something that you would want to have.  At least this way you have a customer from day 1, right?

Another benefit of “you being the customer” is that you know exactly what the problem is – no need to spend time testing markets early on. Sometimes testing the market means asking friends and family whether they would find a particular idea useful. That’s ok, but bear in mind that it takes a strong friend to tell you that your idea sucks.

These days there is more and more pressure on people in software to come up with great ideas. But this pressure just ends up in below-par products, or worse, products that no one wants:

Why do so many founders build things no one wants? Because they begin by trying to think of startup ideas. That m.o. is doubly dangerous: it doesn’t merely yield few good ideas; it yields bad ideas that sound plausible enough to fool you into working on them.

Paul mentions one more point that resonates with me – thinking that the idea is too late, that someone has already done it, and that I should just force myself to think up something different, leaving a perfectly good idea behind

Because a good idea should seem obvious, when you have one you’ll tend to feel that you’re late. Don’t let that deter you. Worrying that you’re late is one of the signs of a good idea. Ten minutes of searching the web will usually settle the question. Even if you find someone else working on the same thing, you’re probably not too late.

How many times has this been proven over the last three decades? IBM has the PC industry sewn up and along came Apple. Altavista was a great search engine (in it’s time) and now we all use Google. The MP3 player market was flooded, and the iPod became the default.

It’s never too late to disrupt, you just need to believe in your idea.

 

 

Facebook Compiling PHP to Run on the JVM?

An article popped up today claiming that Facebook is investigating compiling PHP to run on the JVM. Until now, Facebook has been using a PHP-to-C++ cross compiler. But the addition of invoke dynamic to Java seems to have opened up a new possibility for Facebook.

Alexander Turner, the author of this article points out that using the Multi Language VM for PHP is somewhat analogous to what V8 has done for JavaScript: JIT compilation of interpreted languages shows a significant increase in speed. In fact, Alexander sees this as the beginning of the end for interpreters:

These are exciting times. Soon I expect interpretors and interpreted langauges to be confined to DSLs and all general-purpose coding to be running in a JIT environment or as up-front compilation. That will be good for companies, good for performance and good for the planet.

Either way, it’s good to see another of the major companies taking the JVM seriously. It could certainly take a long time for Facebook to get to a stage where they can have their code running on a VM unless they leverage the Quercus or Project Zero implementations.

Unknown is whether this is actually happening, but it brings up an interesting debate. If you had a Facebook-size codebase written in PHP, would you take this approach? Node.js would certainly be a more fashionable alternative.

The Most Popular Language This Month Is….

The most popular language of this month? Well it depends which source you use. For example, I checked out the TIOBE index as well as the top language used in GitHub projects. Would you be surprised that Java was not number 1 on either listing?

Now, I never take these language popularity things too seriously. More than likely, the language you’re using at work isn’t the cool language of the day. But it gives a good indication of what languages might be worth learning, if you have the time.

TIOBE Index – C Reigns Supreme

On the TIOBE index, where Java has been number one for a very very long time, C has taken it’s place at the top. Yes, C!

Don’t worry if you’re confused right now looking at this – I don’t get it either! It’s obvious that Objective-C continues to grow more popular. But JavaScript looks a bit low on this index, especially when you consider the results I found at GitHub

GitHub  – Everybody Loves JavaScript

I guess the GitHub ratings make more sense, considering you can’t move in GitHub without bumping into a JavaScript project. Every other language has a reasonable showing. Compare Java to C and there’s not much in it.

Some Better News For Java Developers

I didn’t have to go too far to find some good news for Java developers. RoleConnect, an Irish company that connects contractors with employers ran some analysis on what skills are most in demand right now. According to the team there, there’s still a huge interest in Java/J2EE and Spring developers.

So, three different indices and it’s no clearer what the most popular language really is. Is there a definitive way to measure this statistic? Or is it just all too subjective?

Getting To Grips With the Equinox Console

When developing Eclipse RCP applications, sometimes you’ll find that your plug-in’s capabilities don’t seem to available. The Equinox OSGi console is one of the most useful tools to inspect the state of all the plug-ins in a running application. This article gives a brief introduction to the console, and how it can be used to help with your development of an OSGi based system.

To make the console available, just use the -console parameter in your run configuration. If you want to see the console for an “installed” Eclipse instance, you can just add -console to the list of parameters for running Eclipse (e.g. eclipse.exe -console). Having done that you’ll see osgi> appear in the console output, similar to an MS-DOS window.

The following is a list of commands that can be used in the osgi console:

  • help
    Lists all available commands.

  • ss
    Provides a list of all the plug-ins and their current status. If you provide a string after ss, it will list all bundles containing that name. For example, if I used ss logging I would be presented with a list of plug-ins that contain logging in their name. ss here stands for short status.
  • start
    Starts up a plug-in. You can either pass through the full name of the plug-in to this command, or else you can use the symbolic id, as displayed from the previous ss command.
  • stop
    Stops a plug-in. Just like the start command, you can either pass through the full name of the plug-in or the symbolic id.
  • install
    Paired with a URL , this installs the plug-in that the URL refers to into your system. There is also an updatecommand, that allows you to update a plug-in using a URL.
  • uninstall
    This command takes the symbolic id of a plug-in and uninstalls it from your running system
  • diag
    Using the symbolic id, or the plug-in name, this command shows all resolution problems for a particular plug-in.

  • active
    Lists all the active plug-ins in the running system.

So when you have an issue with your plug-in:

  • Make sure it’s on the list of bundles, using the ss command. Or if you expect the plug-in to be running, use the activecommand.
  • Using the id of your plug-in (usually easier than typing in the full name) check that the status of your plug-in is  ACTIVE. If not maybe you need to force the plug-in to start up using the start command.

Once you become familiar with the OSGi console, it becomes a very powerful utility for investigating the overall status of your OSGi based application.

Design Patterns Uncovered: The Mediator Pattern

Today’s pattern is the Mediator pattern, used to handle complex communications between related objects, helping with decoupling of those objects.

Mediator in the Real World

An airport control tower is an excellent example of the mediator pattern. The tower looks after who can take off and land – all communications are done from the airplane to control tower, rather than having plane-to-plane communication. This idea of a central controller is one of the key aspects to the mediator pattern.

Design Patterns Refcard
For a great overview of the most popular design patterns, DZone’s Design Patterns Refcard is the best place to start.

The Mediator Pattern

The Mediator pattern is known as a behavioural pattern, as it’s used to manage algorithms, relationships and responsibilities between objects.. The definition of Mediator as provided in the original Gang of Four book on Design Patterns states:

Allows loose coupling by encapsulating the way disparate sets of objects interact and communicate with each other.  Allows for the actions of each object set to vary independently of one another.

The following diagram shows how the mediator pattern is modelled.

The Mediator defines the interface for communication between Colleague objects. The ConcreteMediator implements the Mediator interface and coordinates communication between Colleague objects. It is aware of all the Colleagues and their purpose with regards to inter communication. The ConcreteColleague communicates with other colleagues through the mediator.

Without this pattern, all of the Colleagues would know about each other, leading to high coupling. By having all colleagues communicate through one central point we have a decoupled system while maintaining control on the object’s interactions.

When Would I Use This Pattern?

The mediator is a good choice of pattern when the communication between objects is complicated, but well defined. When there are too many relationships between the objects in your code, it’s time to think of having such a central point of control.

An observer based variation of the mediator pattern is used in Java Message Service (JMS) implementations, which allows applications to subscribe and publish data to other applications. This is a common combination of patterns that makes sense.

So How Does It Work In Java?

Here we’ll use the Mediator pattern in the context of a chatroom application. First we’ll define an interface for our mediator

//Mediator interface
public interface Mediator
{
	public void send(String message, Colleague colleague);
}

While we described the Colleague as an interface above, it’s more useful to use an abstract class in this case:

//Colleage interface
public abstract Colleague
{
	private Mediator mediator;

	public Colleague(Mediator m)
	{
	    mediator = m;
	}

	//send a message via the mediator
        public void send(String message)
	{
	   mediator.send(message, this);
	}

	//get access to the mediator
	public Mediator getMediator()
	{
		return mediator;
	}

        public abstract void receive(String message);	

}

Now let’s create our concrete mediator implementation

public class ApplicationMediator implements Mediator
{
	private ArrayList<Colleague> colleagues;

        public ApplicationMediator()
        { colleagues = new ArrayList<Colleague>();} 

        public void addColleague(Colleague colleague)
        { colleagues.add(colleague);}

	public void send(String message, Colleague originator)
	{
		//let all other screens know that this screen has changed
		for(Colleague colleague: colleagues)
		{
			//don't tell ourselves
			if(colleague != originator)
			{
				colleage.receive(message);
			}
		}

	}

}

Finally we’ll create one concrete colleage.

public class ConcreteColleague extends Colleague
{
      public void receive(String message)
        {
           System.out.println("Colleague Received: " + message);
       }	

}

Here’s a client that drives the entire application:

public class Client
{
  public static void main(String[] args)
  {
      ApplicationMediator mediator = new ApplicationMediator(); 

     ConcreteColleague desktop = new ConcreteColleague(mediator)
     ConcreteColleague mobile = new MobileColleague(mediator)

      mediator.addColleague(desktop);
      mediator.addColleague(mobile);

      desktop.send("Hello World");
      mobile.send("Hello"); 

  }
}

Watch Out for the Downsides

While this pattern aims to reduce complexity, without proper design, the Mediator object itself can become very complicated itself.The Observer pattern could help here, with the colleague objects dealing with the events from the mediator, rather than having the mediator look after all orchestration.

Find Out More


The classic Design Patterns: Elements of Reusable Object Oriented Software
For more practical Java examples: Head First Design Patterns.

Maintaining Your Value In the Software Industry

These days it can be tough to find the job you want as a software developer, either because the lack of opportunities out there, or facing huge competition in the process. In this article, I’d like to offer some tips that  might help you to maintain your value as a software developer.

All of these tips apply to those who are in current employment, or who are looking for a job. If you aren’t working right now, some of these points are essential: you don’t want it to appear as if you’ve lost interest in software when you’re not getting paid for it!

Challenge Yourself

While you may think that you know all that you need to know, there’s no harm in expanding your experience and improving your CV by achieving some relevant certification.

Certification is a really effective way of learning new things and refreshing on the things you already know.  Java developers have huge certification options available through the Sun Java Certification exams. Starting off with the SCJP exam, you can choose the path that suits you, all the way to Enterprise Architect. Eclipse developers can earn RCP and OSGi certification through the Eclipse Training Alliance.

Stay Educated

If certification isn’t an option for your technology, or you’ve done it all before, make sure that at the very least you stay educated. This can be as simple as buying a book, or doing an online tutorial. As well as keeping up to date on technologies that you use, it’s really rewarding to educate yourself in a new framework or technology. Once again, your CV gets a nice update and you’ll probably find ways to apply what you’ve learned in your current job.

Training course can be expensive, but if you can afford it – go for it. Make sure that you do a sufficient amount of research into the course to make sure it suits your needs and covers what you expect.

However,once you know the basics of software development, it’s easy to teach yourself.  There’s a lot of information available out there, and a large amount of the tools and IDEs that you need are probably free.

Join A Community

If you have a local user group, or gathering of other technologists, why not try to go to the meetings once in a while? Maybe start up a local technology conference and work on your presentation skills.

If you’re out of work right now, joining an open source project can be of huge benefit. You get to work as a team with other people passionate about technology, and pick up new skills from them. More importantly, joining an open source project can fill that empty year in your CV, and show that you’ve kept your skills sharp.

Find Your Voice

Finally, starting up your own blog can really help your confidence. It’s never been easier to set up a blog, with so many providers available. Teaching can be the best way of learning – so as you write about the technologies, tools and frameworks that interest you, you’ll find that you have an even better understanding. Researching new topics for your blog can be really interesting too. The most rewarding part is when you find that you have an audience and people are interested in what you have to say.

I should point out here that we do have an MVB program here at DZone, which is a really effective way of getting traffic to your blog from the DZone platform.

The key point I’d like to make is that you should never stand still as a software developer – there’s always someone behind you who will pass you out. Have you any other tips to share on staying sharp?