Ryan Harrison My blog, portfolio and technology related ramblings

[Link] Java 8 Lambda's - A Glossary of Terms

As a follow up to a previous post about the new features that Java 8 will bring to the table, here is another good link that covers some of the new terminology the update will introduce. As the new lambda expressions and streams API are likely to be the most used features of Java 8, it’s never too early to brush up on some of the new classes.

A conversational guide for JDK8′s lambdas - a glossary of terms

Read More

Free GitHub Micro Plan for Students

GitHub is a great service that I use often to host my personal projects. Their free accounts offer an unlimited number of public repositories where your code is visible to anyone visiting your profile. This is great for any open source work, but not so good for coursework projects where you really want to keep your source code private (at least until the deadline).

Handily though, if you are a student GitHub will give you a free Micro plan for a few years to help in your studies. This plan comes with 5 private repositories and of course you are still able to create an unlimited number of public ones.

All you need is a valid academic email address that has been added to your GitHub and you are good to go.

Sign yourself up here: https://github.com/edu

Read More

[Link] Everything About Java 8

As the release of Java 8 looms ever closer and closer, here is some good information about what new changes to expect. Unlike Java 7 this release does seem to actually include some useful features including lambda’s which can be neatly integrated with the new streams API and a much needed new date/time API.

Everything About Java 8

Read More

Chrome Resolving Host Fix

So recently I came up against the ‘Resolving Host’ problem in Chrome that temporarily grinds the browser to a complete halt. There seems to be a lot of people who are having the same problems, yet no real solution that works for any substantial amount of time.

The current fixes take the form of unchecking the ‘Predict network actions to improve page load performance’ checkbox under the advanced settings section of Chrome. On a completely updated system, for me however, this didn’t seem to work.

After a ton of searches and many trials I think I’ve found a solution that really works (well for me anyways):

Disable the ‘Built-in Asynchronous DNS’ functionality of Chrome by:

  1. Navigate to chrome://flags
  2. Find Built-in Asynchronous DNS (about halfway down the page)
  3. Disable it and then restart Chrome

I’ve been using this fix for over a month now and the problem seems to have disappeared completely.

Read More

Java - A better Hello World program?

For years now this has been the Java version of the famous ‘Hello World’ program that is often the very first program that new developers write:

  
public class HelloWorld {  
    public static void main(String[] args) {  
        System.out.println("Hello World!");  
    }  
}  

But is this a really the kind of code beginners should be seeing when they begin the Java adventures - putting all the logic in the main method and making no use of object oriented practices? Surely it would be better to drive in the fundamental OOP principles from the very start? You see all too much people using loads of static methods and calling them all in their main method which by now spans a good few hundred lines of code. Maybe they get this idea from this ‘Hello World’ program?

If we are really following object oriented programming practices (which Java tries so hard to enforce), the ‘Hello World’ program should really look more like this:

  
public class HelloWorld {  
    public static void main(String[] args) {  
        new HelloWorld().printHelloWorld();  
    }

    public void printHelloWorld() {  
        System.out.println("Hello World!");  
    }  
}  

Now we are suddenly using classes and methods! Ok it’s a little more complicated for complete beginners to learn, but at least it gives the teachers more to talk about rather than trying to avoid the inevitable questions about the static keyword and that String[].

Traditionally the ‘Hello World’ program is normally the shortest amount of code possible to generate the necessary output. That’s fair enough and the first example does this fine, but for teaching practices the second program is so much better. Classes/methods are amongst the hardest concepts to teach new programmers so why not begin that journey from the very beginning? A lot of new Java developers try to force procedural code into a purely object oriented language. Most of the time it doesn’t end well at all. Maybe this could be avoided by skipping the whole concept entirely (the static keyword is the main culprit). Everything should be inside methods of a class - of which objects should be created and those methods called with them. Hopefully the main method would then never grow into a hundred line mess of logic.

Just a suggestion to any Java teachers out there. Although a little harder to teach, in my experiences I reckon this could be a pretty helpful change in the long run.

Read More