Archive for the ‘Blog’ Category

Getting off the elevator

Today’s article is a guest post from CJIQ fan Zac Morris.  Whilst reading my book he emailed me about my section on interview technique, and specifically about being confident and outgoing with your interviewers as often candidates can appear hostile either intentionally or unintentionally.

 

Zac is on the autistic spectrum and correctly felt that my articles didn’t take into account what interviews and the process is like for someone with autism.  I think it’s something that isn’t spoken about enough and I felt it was best for Zac to do a post to talk about the situation in his own words.


I discovered Sam through his blog post: “Why I hate Spring”; something I reference when discussing Java frameworks with people. I recently purchased his eBook: “JAVA INTERVIEW BOOTCAMP”, which has been an extraordinary resource. When I purchased the eBook, I was signed up for a matching email subscription, which is why I received the email below…

In Sam’s book, “JAVA INTERVIEW BOOTCAMP”, several elements in the Soft Skills and Interview sections rubbed me the wrong way, but when taken as a whole, the positives outweighed any negatives. Unfortunately, when I received this email it brought up some of those feelings of being rubbed the wrong way.

I had never interacted with Sam; I didn’t even know if he was actually involved in the creation of this email, or if it was part of a marketing company, but I decided to take a chance with a very basic response:

—- On Sat, 28 May 2016 Zac Morris<zac@zacwolf.com> wrote —-

So you’re saying you hire only Extroverts?

 

I was actually surprised to receive a response:

—- On Sat, May 28, 2016 Core Java Interview Questions <hello@corejavainterviewquestions.com> wrote:

Hiya Zac,

Thanks for the mail, and I’m gonna alter my text based on this.

It’s absolutely not an extrovert thing and I should specifically cover that. My main point was that a surprising number of candidates are actively hostile/ it’s not because they’re introvert, usually the opposite.

 

Introvert candidates are great (and very common). If someone’s quiet because of nerves you can tell straight away and it’s the interviewers job to make them feel more comfortable and work with them to get the best idea of what they would be like to work with.

Let me know if you have any other Thoughts or questions,

S

 

While I really appreciated the response, I still felt Sam was missing my point…

You see, I am on the autistic spectrum (“Ultraviolet”/Highly Functional), which can result in me being overwhelmed by certain situations. ​ At 48, I’m very practiced at coping at a professional level. I have approximately 30 years of work experience, 26 of those with fortune 500 companies; my last non-contract position was 15 years with Cisco Systems, working full time remotely from home.

I decided back in September 2014 that it was time for something different, and having never had much trouble finding work, I gave my notice and decided to take a few months off for some personal projects. Unfortunately, between working from home all those years and taking time off, I’m finding my coping skills to be a bit rusty. On top of that, I’m running into more challenges, even downright roadblocks, in the marketplace than I expected.

Ten years ago, things like the ADA (Americans with Disabilities Act) would have been a tool to help people like me by mandating “reasonable accommodations” in the workplace, but today, to get around this requirement, companies have specifically instituted two hiring design patterns: temp-to-hire and building a “culture” around the OpenOffice philosophy. The first means that because you are not an actual employee, they aren’t required to make reasonable accommodations, and the second means that providing someone with a private/quiet workspace is considered an unreasonable accommodation, because it would be counter to their OpenOffice culture. I’m finding very little awareness, much less understanding, by employers and their interviewers of what a serious problem this can represent for someone like me. Yeah, that’s my cross to bear, but when I got Sam’s email, I felt a bit defensive.

So I decided to try a different approach:

—- On Sat, 28 May 2016 Zac Morris<zac@zacwolf.com> wrote —-

I would like to challenge you; just because you may actually be pretty good at identifying an Introvert from an Extrovert, you should never assume that skill is absolute. You have no real idea what that person getting off the elevator may have gone through to get to that point in space and time.

I then went on to relate an elevator story of my own:

Recently I went to a job interview in a building that had a very strange elevator system. It had a bank of elevators and two digital touchscreen keypads. You had to punch in your floor number, then it would tell you which lettered elevator would take you to your floor. Having never experienced this type of system, I did not know this, so I stepped into the first elevator that opened and there were no buttons. Another person on the elevator saw my dilemma and said, “You enter your floor on the keypad outside”. So I stepped out, and I see the digital pad which is laid out like a phone style number-pad [1-3, 4-6, 7-9, #0*]. My appointment was on the 11th floor. Hindsight being 20/20 I should have used it as a number entry pad, but that’s not typically the way that an elevator system is laid out (and in my defense I wasn’t even sure if the building had more than 9 floors). So I had to go ask the security guard how to get to the eleventh floor. He laughed and said that I just hit the “1” button twice. Now I have an IQ of 159, so on top of the embarrassment of being laughed at, this simple thing made me feel quite stupid, not something you want to feel right before a job interview. By the time I got to the correct floor, I was a minute late, quite overwhelmed, and I was immediately lead into a conference room where two people were already waiting on me.

I went on…

Yeah, I get it, the world isn’t fair, but as someone that is billing themselves as a self-help author, you have a higher responsibility to show multiple sides to every story (interviewer and interviewee). You could have expanded your “Be guy #2” with something to that effect, instead it came off as judgmental vs. helping people realize that an interview is a kind of show, and the two absolutes of any show are: “The show must go on”, and “As an actor in a show, you have a part to play”.

Like I said, I’m decent at coping, so even after my own elevator experience I was able to turn on the “interviewee persona”, but others with my condition might not be so practiced, or (and here’s the important bit) even know that it’s something they even need to practice.

It is all part of what I believe to be de facto expectations of extrovert-styled normative behaviors used to define professionalism. I get it, expectations are expectations, but for someone like me, the discussion of soft skills in the interview process would be much more helpful/productive framed in the idea of an interview being like a show in which there are roles to play, otherwise it just feels like a judgment of who/how I really am. To some that may sound like simple semantics, but for people like me, it is a very important semantic!

I was very happy to get the following response from Sam:

—- On Sat, May 28, 2016 Core Java Interview Questions <hello@corejavainterviewquestions.com> wrote:

Hi Zac,

This is a brilliant email and you’re 100% right. This is something out of my area of experience and I imagine that’s the case for most people who are recruiting. […] I’d love for you to flesh this email out into a blog post which I could use on CJIQ. I think stories like yours are unknown to most recruiting people and you could really help a lot of people on both sides of the fence.

So here we are. I really do hope that this post can help people on both sides of the fence: help interviewees like me better understand the expectations of employers and interviewers and how it’s possible to learn skills in interviewing without compromising who/how you are; and help employers and interviewers better understand that they can’t assume that they know someone’s story based on a few words said (or not said) when getting off an elevator.

Java Code Challenge: Nodes!

Welcome to Java Code Challenge! We’re taking challenges for reddit’s dailyprogrammer and going on a deep dive into the answer. A working solution is not enough; we’re looking for the cleanest Java code with tests. 3rd party libraries are welcome but if you can do it without it will be easier for others to comprehend.

If you can fit your solution in the comments then go for it, but preferably put your answer in GitHub and link in the comments. Next week we’ll be sharing the best solutions and sharing the best code practices we see!

Scroll to the bottom if you want the solution.

Challenge

In graph theory, the degree of a node is the number of edges coming into it or going out of it – how connected it is. For this challenge, you’ll be calculating the degree of every node.

Input Description

First, you’ll be given an integer, N, on one line showing you how many nodes to account for. Next, you’ll be given an undirected graph as a series of number pairs, a and b, showing that those two nodes are connected – an edge. Example:

3 
1 2
1 3

Output Description

Your program should emit the degree for each node. Example:

Node 1 has a degree of 2
 
Node 2 has a degree of 1
 
Node 3 has a degree of 1

Challenge Input

This data set is a social network of tribes of the Gahuku-Gama alliance structure of the Eastern Central Highlands of New Guinea, from Kenneth Read (1954). The dataset contains a list of all of the links, where a link represents signed friendships between tribes. It was downloaded from the network repository.

16
1 2
1 3
2 3
1 4
3 4
1 5
2 5
1 6
2 6
3 6
3 7
5 7
6 7
3 8
4 8
6 8
7 8
2 9
5 9
6 9
2 10
9 10
6 11
7 11
8 11
9 11
10 11
1 12
6 12
7 12
8 12
11 12
6 13
7 13
9 13
10 13
11 13
5 14
8 14
12 14
13 14
1 15
2 15
5 15
9 15
10 15
11 15
12 15
13 15
1 16
2 16
5 16
6 16
11 1
12 16
13 16
14 16
15 16

Challenge Output

Node 1 has a degree of 8
Node 2 has a degree of 8
Node 3 has a degree of 6
Node 4 has a degree of 3
Node 5 has a degree of 7
Node 6 has a degree of 10
Node 7 has a degree of 7
Node 8 has a degree of 7
Node 9 has a degree of 7
Node 10 has a degree of 5
Node 11 has a degree of 9
Node 12 has a degree of 8
Node 13 has a degree of 8
Node 14 has a degree of 5
Node 15 has a degree of 9
 
Node 16 has a degree of 9

Solution time

This is a relatively simple challenge but one that demonstrates why programming is more of an art than a science. Every single response was different in design and style. There is no one “correct” answer, which is one of the wonderful things about programming.

One of the aims for this series for me is to highlight more than just correct solutions, but solutions which are good code- code which, if in a production code base, would not quickly become legacy code or difficult to maintain.

This is not an inditement on any of the solutions- it’s a simple code challenge and so it stands to reason most people will just be solving it for the challenge, not to write beautiful code.

The general solution

The reason this is particularly easy as a challenge is that the input tells us how many nodes to expect- we don’t need to figure this out for ourselves. We’re also assuming that all our data input is accurate which makes it super simple.

So, we simply need to add up how many times a node ID appears in the input and store that number for each node. Pretty simple bucketing, which is what most people chose to do. Take this example from Jusio, which uses an array to store the totals.

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;

public class Degrees {

    public static void main(String[] args) throws IOException {

        Scanner scanner = new Scanner(Files.newBufferedReader(Paths.get(args[0])));
        final int[] dependencies = new int[scanner.nextInt()];
        while (scanner.hasNext()) {
            dependencies[scanner.nextInt() - 1]++;
            dependencies[scanner.nextInt() - 1]++;
        }
        for (int i = 0; i < dependencies.length; i++) {
            System.out.printf("Node %s has degree of %s\n", i + 1, dependencies[i]);
        }
    }
}

As we know how many nodes there are up front an array is a perfectly viable solution.

In Java 8 we can “one line” this thanks to Streams. Jusio also offered up a Java solution.

Files.lines(Paths.get(args[0]))
  .skip(1)
  .flatMap(it -> Stream.of(it.split(" ")))
  .collect(Collectors.groupingBy(Integer::new, Collectors.counting()))
  .forEach((node, count) -> out.printf("Node %s has degree of %s\n", node, count));

A nice condensed solution. However, it’s important to be careful with Java 8’s functional features. Since their release I’ve seen a tendancy by developers to go overboard to try and crush all their code into a one liner. When writing code readability should be our number one concern. Clean, readable code is easier to maintain.  I personally find the Java 7 version easier to comprehend, although for an example this simple it’s not that big a problem.

A pause for thought

The thing that has come across pretty consistenly is that most of the solutions have not been written using TDD or tests. That’s fine- I understand not everyone loves TDD as much as I do. But that has lead to one-shot code that has no seperation of concerns. The entire solution is shoved into a main method. As mentioned before this produces an adequate solution but not sustainable code.

I recieved an email after posting this challenge:

“to be clear, is the input standard in or a file?”

The answer for me is clear- it doesn’t matter. The way I approached this challenge was to start with the functionality- the bucketing- and providing the data in using a test, and testing the data out by giving access to the underlying sorted data.

@Test
   public void twoNodesConnectedResultsInTwoOutputLines(){
       NodeChecker nodeChecker = new NodeChecker(2, "1 2");
       String[] output = nodeChecker.output;

       assertThat(output.length, is(2));

       assertThat(output[0], is("Node 1 has a degree of 1"));
       assertThat(output[1], is("Node 2 has a degree of 1"));

   }

My NodeChecker class takes the input already split into the first line and the rest of the file.  This way I can test that the functionality is correct without worrying about the format it’s coming in as.

I could have even gone a step further and had the NodeChecker expose it’s collection counting the node degrees as opposed to it directly resulting in the textual output.  At the moment my solution is highly coupled to the output format.

However, it’s a simple interview challenge, and wouldn’t be hard to refactor  to something better :).

Next Step

If you’ve enjoyed this, I’ve just release a brand new video course.  I’ve taken a programming interview challenge that I give to my candidates and done a deep dive into the solution.  You’ll learn how to use Test Driven Development to solve a complicated programming challenge, along with a whole slew of advice, tips and tricks for impressing your interviewer.

Check out the new TDD course!

 

 

 

 

 

Is Polyglot Programming a good thing?

Is Polyglot Programming a good thing-

You have a lot of technologies on your CV in your last role. Java, Python, Scala, Node. What are your thoughts on Polyglot programming? Is it a good or a bad thing?

TL;DR: Right tool for the right job, but chances are the right tool is Java. Don’t choose a language because you want to try something new: it’s going to be a maintenance nightmare.

I’m not sure if you’ve noticed, but recently there seems to be an awful lot of noise about the death of Java and the rise of the JVM. Scala, Clojure, Groovy, Jython have all recently gone through being the language choice du jour (Although this great article shows how Java still rules the roost by a long way). More and more projects in these languages are appearing on the job boards and in projects at bigger and bigger companies.

But, is this a good thing or not?

As a massive nerd, I love trying new programming languages. New things are shiny. I like shiny. Last year when I started doing the “functional programming principals in Scala” course on coursera (it’s free!) run by Martin Odersky, the creator of Scala, I was convinced Scala was going to be the answer to all of my Java based problems. “Look ma, the syntax is so much more concise! And now I understand why immutable is so awesome!”. It’s this kind of hedonism which is why more and more projects are getting started in these languages. Bored programmers want to try new things out, and so a new language is brought into the company.

This is a terrible idea.

The sales pitch is “right tool for the job”. And that’s absolutely correct. Much like how in the early days of Java, if you needed really low latency you had to go to C++. It was the right tool for the job. There are absolutely valid cases for where functional programming is a better fit than object-oriented. But you need to be able to properly justify this up front with strong reasoning. The answer shouldn’t be “I fancied trying something new”. There’s a great post on Yegor256 called “It is not a school” which goes into depth about the fact that projects should hire people who already have the skills for the job:

However, if you make your projects spend their money on your education, that’s theft. And a good project manager should stop you, saying “This is not a school!”

This is a hard truth to swallow because I want to learn new stuff on the job, but the brutal fact is that it’s not in the best interests of the firm to have to spend time and money to teach me new skills.

Even if you already know the language in question it’s still probably a bad idea to use it. Your code will outlive your stay at an organisation. Irrelevant of language, people are going to curse your name when they have to maintain it, because as programmers it’s much easier to blame the person that came before us. Our jobs are hard enough when we have to take over Java code. Taking over an old codebase in a brand new language is going to be that much harder. If this is on a big project, then the organisation is going to have to hire people that specifically know the language. For now at least, these people are few and far between, and often expensive because of their niche.

As if that weren’t reason enough to think twice, you need to consider tooling. Java has been around for a really long time and has an incredible set of tools and libraries around it. IntelliJ is all powerful; the verbosity of Java is irrelevant thanks to Keyboard shortcuts and intellisense which make me immensely productive. Tooling like this doesn’t exist in a mature fashion in any other language (if you’ve ever tried to debug a gradle script you will know my pain). There’s also a lack of documentation and online support; it’s safe to say that most common Java problems have been answered on StackOverflow. Newer languages are improving, but they’re not there yet.

This isn’t to disparage polyglot programmers. I think being able to program in multiple languages is an absolute must and is something I look for on a CV. It shows a wider interest in programming and it’s a great way to change your mindset around your coding style. Spending the time to try out functional programming has absolutely changed my approach to Java and I write better code for it. I feel educated enough in the languages I know so that when the right use case comes up, I can and will use the right tool for the right job. But it won’t just be because I fancy giving Clojure a go (which I really do).

Now, I’m sure this is going to draw a lot of ire from the community. Which is why it’s important to remember that in the context of interviews, you need to present whatever your own opinion is but justify it in the context of the arguments above. It’s perfectly valid to argue that Java is a ridiculously verbose language and it’s not as suitable for a lot of tasks; highly parallelised data processing or complex multi threading could be better suited to Scala and Akka for example. You can argue the gains in using other languages outweigh the costs of introducing new languages to be maintained, particularly as developers we should be willing and able to retrain ourselves in those languages. Just make sure you can articulate your viewpoint and the arguments against it properly.

Implement Queue Using Two Stacks

implement queue using two stacks

Code Corner: Create a queue from two stacks

In code corner, we take a real interview programming challenge and solve it in code. Whilst these questions may be likely be asked as a whiteboarding exercise, as a developer you will learn much more by actually coding the solution and getting your hands on the APIs, collections and algorithms in discussion

You can download this exercise from the CJIQ Github at https://github.com/corejavainterviewquestions/queuefromtwostacks. Each stage is a commit; rollback to the initial check out and code along on a branch. You can then compare your answer to mine. Results are developed using TDD.

Creating a queue from two stacks is one of those questions that seems to have lingered around for years and still gets asked. It’s a good one to know just in case it gets asked, but more importantly it’s a nice opportunity to look more into stacks, queues and calculating Big O.

 

The task is simple. Replicate the functionality of a queue using two stacks.

A Queue is a First-in-first-out (FIFO) data structure. If you push item A, B and C in that order, then pop three times, you will get A, B and C. Conversely, a stack is a Last-in-first-out (LIFO) structure; In the same example you would get C, B then A.

You can read more about these data structures in this previous post on interviews and data structures.

Queue has 2 methods we’re interested in: add and remove. Stack has push and pop.
Let’s start with our first failing test.

 @Test
 public void addingOneItemAndRemovingFromQueueWillReturnThatItem() throws Exception {
     Queue queue = new Queue();
     queue.add(“Item 1”);
 
     assertThat(queue.remove(), is(“Item 1”));
 }

To write this test, I’ve created an add method- I’ve chosen to use Strings. We could generecise it very easily but let’s keep it simple. We add a remove method, which we expect to return the object we’ve added.
To implement is very simple; the functionality would be identical for a Stack, so we’re effectively just delegating.

 Stack stackOne = new Stack();
 public void add(String item) {
     stackOne.push(item);
 }
 public String remove() {
     return stackOne.pop();
 }

First test pass! Feel the serotonin.

commit

Ok, time for a more realistic test, adding multiple items.

 @Test
 public void
 addingMultipleItemsThenRemovingOneWillReturnFirstItem() throws Exception {
     Queue queue = new Queue();
     queue.add(“Item 1”);
     queue.add(“Item 2”);
     queue.add(“Item 3”);
     assertThat(queue.remove(), is(“Item 1”));
 }

This gives a nice test fail; We’re getting item 3 back incorrectly. Now we need to actually think of an implementation.
Imagine our stack like a bucket.

stacks
We need to get to the bottom of the bucket to remove the item that was first in. The only way to do this is to pop all of the items in the way.
This test is really simple, so we don’t actually care about the other items. Let’s just pop everything out the way. It’s crude, but in TDD we aim to do the minimum work to make the test pass.

 public String remove() {
     String result = null;
     while(!stackOne.isEmpty())
         result = stackOne.pop();
     return result;
 }

Pretty basic. Let’s write a harder test.

commit

I’ve renamed the last test and expanded it to include an extra pop.

 @Test
 public void
 addingThreeItemsThenRemovingTwoWillReturnItemOneThenTwo() throws Exception {
     Queue queue = new Queue();
     queue.add(“Item 1”);
     queue.add(“Item 2”);
     queue.add(“Item 3”);
     assertThat(queue.remove(), is(“Item 1”));
     assertThat(queue.remove(), is(“Item 2”));
 }

Now we need to handle the storage when popping items from stack one. The obvious location is to put onto the second stack we’re allowed. By putting each popped item on the stack we reverse the collection so it’s in the right order for a queue. The top item can then be returned.

stacks (1)

 

We must then return all items back to the first stack so that we can add more items to the stack.

 public String remove() {
     while(!stackOne.isEmpty()) {
         stackTwo.push(stackOne.pop());
     }
     String result = stackTwo.pop();
     while(!stackTwo.isEmpty()) {
         stackOne.push(stackTwo.pop());
     }
     return result;
 }

This makes the test pass, and is a an accurate albeit crude solution to the problem.

commit

There is some duplication in the code above. The TDD Mantra is Red, Green, Refactor. So let’s clean the code up a little.

 public String remove() {
     swapStacks(stackOne, stackTwo);
     String result = stackTwo.pop();
     swapStacks(stackTwo, stackOne);
     return result;
 }
 private void swapStacks(Stack stackOne, Stack stackTwo) {
     while(!stackOne.isEmpty())
         stackTwo.push(stackOne.pop());
 }

Not only is this cleaner code, but it’s much easier to understand what’s going on.

commit

What about missing tests? It’s important to think of edge cases in these scenarios. What about the empty case? Particularly in an interview it’s important you decide what is the correct behaviour. Should the queue return null or throw an Exception? Either could be argued quite reasonably. I have chosen to throw an exception, as passing null around can result in fragile and error prone code.

 @Test(expected = NoSuchElementException.class)
 public void throwsErrorIfRemoveCalledOnEmptyQueue(){
     Queue queue = new Queue();
     queue.remove();
 }

This test fails; we get an EmptyStackException. This should be an easy fix.

 public String remove() {
     if(stackOne.isEmpty())
         throw new NoSuchElementException(“The Queue Is Empty”);
     swapStacks(stackOne, stackTwo);
     String result = stackTwo.pop();
     swapStacks(stackTwo, stackOne);
     return result;
 }

Easy!

commit

Just for safety, lets throw in a more complex test, of multiple adds and removes.

 @Test
 public void multipleAddsAndRemovesInCorrectOrder() throws Exception {
     Queue queue = new Queue();
     queue.add(“Item 1”);
     queue.add(“Item 2”);
     assertThat(queue.remove(), is(“Item 1”));
     queue.add(“Item 3”);
     assertThat(queue.remove(), is(“Item 2”));
     queue.add(“Item 4”);
     queue.add(“Item 5”);
     queue.add(“Item 6”);
     assertThat(queue.remove(), is(“Item 3”));
     assertThat(queue.remove(), is(“Item 4”));
 }

As expected, this test passes. We now have a complete Queue solution.
However, this is a very slow solution. Let’s analyse the Big O. First, we have to go through every item on the stack and pop it; that’s n. Then we have to push every
item, which is n again. We then pop all the items, another full iteration of n. We then add all bar one item back, n–1. That’s O(4n). Pretty poor! Can we come up with a better solution?
Let’s consider the first time we perform a remove operation. We push every item and pop it onto the secondary stack. At this point the secondary stack is in correct queue order. If we do not move back to first stack then we can just pop from the secondary queue until it is empty. If a remove request happens and stack 2 is empty, we simply swap the stacks then.

 public String remove() {
     if(stackOne.isEmpty() && stackTwo.isEmpty())
         throw new NoSuchElementException(“The Queue Is Empty”);
     if(stackTwo.isEmpty())
     while(!stackOne.isEmpty())
         stackTwo.push(stackOne.pop());
     return stackTwo.pop();
 }

Every pop is from stack two. We check if there are elements (we now must check both stacks). If there are, we check whether we need to do a stack swap (i.e. stack two is empty). We can then pop from the top of stack 2.
As we now have a test suite we can run to check the solution, we know we haven’t broken anything.
But what is the complexity of this algorithm? When stack two becomes empty we have to do a full pop from stack one and push onto stack two; which is O(2n), simplified to O(n). However, this should not happen often (dependent on the usage of the stack). Most calls to remove will just execute stackTwo.pop(), which is a constant time operation.
We can therefore say that, whilst the worst case is O(n) it will give constant amortised time, e.g., if you run a million operations through the queue most of them will be constant time.

42 resources to help you get your new Java role

The 4 steps to your new Java role

I remember when I was last looking for a new role I spent a few hours before each interview googling “Java Interview Questions” and various variations on it; Java Collections Interview Questions, Java Threading Interview Question and so and so forth.  A lot time spent trying to find articles which had good content and which were accurate.  I didn’t even think to look around for advice on my resume or to try and find new Job boards.

Fortunately, I’m a lot smarter now and I’ve done all the leg work to find the best sites and articles on the net so you don’t have to.  Below I’ve compiled a list of all the places you can and should go to in preparation for your interview and your general job hunting experience.  This list is going to change!  As I discover new things I’ll add them below.  If you’ve any suggestions then why not ping me an email at hello@corejavainterviewquestions.com?

The above infographic shows what I consider to be the 4 key stages of preparing for going out and find a new role.    The list of resources are ordered accordingly.

 

Don’t forget, everything above is available in Java Interview Bootcamp, the ultimate resource in your job hunt as a Java Developer.  Relative to the raise you’re going to get in your new role, $19 is a tiny investment (and there’s a lifetime money back guarantee.  If you don’t get a job, just ask for a refund!).

 

The ultimate Java Interview prep book.

Step 1: Creating your Resume

1- Creating your Resume (on CJIQ)

My article on how to put together an amazing resume.

 

2- A follow up article on creating an online resume (also on CJIQ):

Having your CV online can make a huge difference. It allows you to attach it to your outgoing emails, link to it from LinkedIn and your webpages and hopefully let people find you organically.

 

3- Reddit: /r/cscareerquestions

There is a weekly resume critique thread so you can get feedback from real people (example here). This is also a great place to see what issues other people are having, and to ask questions youhave. Make sure to read the FAQ first!

 

4- Pinterest of example Java Resumes

If you’re really stuck with somewhere to start, here are some basic ones to get you going.

 

5- Google Docs Templates

Making your CV not be a boring black and white mass of text can really help you to stand out. Google docs provides a ton of useful templates so you don’t need to re-invent the wheel.

 

6- “How to write a CV” (Prospects.ac.uk)

Targeted more at recent grads and not specific to Java, but if you’ve never written a CV before then this is a safe from-the-beginning introduction.

Step 2:Applying for Jobs

Recruiters

7- iKas International: HK, Singapore, London, NY, Australia

8- You can listen to Sarah Sellers from iKas international on Episode 5 of the CJIQ podcast.

9- BAH Partners: Hong Kong

10- Argyll Scott: Hong Kong

11- Madison Maclean: London

12- Aston Carter: UK, Ireland, HK, Belgium, France, Singapore, Sweden, Netherlands

13- Orbis Consultants: London

Websites

14- http://careers.stackoverflow.com/

Stack Overflow is well renound for being a developers first port of call when stuck on a problem owing to the thousands of questions and answers on the site.  However did you know it also has one of the best job boards online? Search by company, country or technology using a fast and intuitive interface.

 

15- https://weworkremotely.com/

Ever wanted to work from home on a permanent basis?  There’s a website for that! We Work Remotely was built by 57Signals to help distributed companies recruit top talent in the knowledge that the best person for the job may very well not be in the surrounding 6 mile radius.

 

16- LinkedIn Jobs

If you’re job hunting you absolutely need to have a LinkedIn profile.  But don’t stop there, LinkedIn is hugely active in the jobs market and has a lot of roles available on it.

 

17- eFinancialCareers

Niched down to just finance jobs, but you know the role is going to pay well.  Has sub sites for a huge number of regions, so make sure to choose whichever is your country of preference.

 

18- Dice

Regularly comes up on /r/cscareerquestions as one of the better job boards for technologists.

 

19- Monster

Fairly standard but reliable general job board.

 

20- GlassDoor

Not only a great jobs website, but it has a ton of information about companies; employees can leave reviews with pros and cons, along with salary information, so you can get an idea of what it’s really like to work somewhere.  Take with a pinch of salt (people are more likely to write if they’re disgruntled) but certainly a good place to start checking out a company if you’re interviewing.

Step 3: Soft Skills

21- http://questionsininterview.com/

A site focused on the non technical questions in interviews; everything from HR type “Tell me about a time you’ve worked in a team” through to brain teasers and puzzlers.  Worth practicing a few of these before you go into your interview so that you’re comfortable with this way of thinking and explanation. “What percentage of the worlds water is inside cows” isn’t something people think about most days (I hope!)

 

22- Big list of example questions on Reddit

Reddit is amazing.  Search through /r/jobs for other questions/advice.

 

23- Monster Careers Advice

Monster has been around for a long time and has built up a big library with hundreds of articles to help with general interview preparation and practice.

 

24- Prospects.ac.uk

Graduate Prospects focuses on helping interns and graduates with career advice although much of the advice on the site is applicable irrelevant of experience.  The articles are written by some of the UKs best careers advisors and well worth checking out.

Step 4: Java Interview Questions

Java Revision

25- Java Interview Bootcamp

The majority of this book is dedicated to core Java revision, refreshing you on concepts like Threading, OOP and GC from the start and going into great depth.

 

26- Effective Java (Amazon Link)

One of the definitive Java text books.  Being able to program, and being able to explain design, style and clean code are very different things.  This book will serve as a good way for you to refresh your knowledge and thinking on Java.

 

27- DZone

DZone features original content and syndicated posts from Most Valued Bloggers (of which Core Java Interview Questions is one).  Choose a topic and use the search box and you will be given a ton of interesting, well written articles to read.

 

28- Concurrency in Practice (Amazon Link)

Famous for being the defining threading book in Java, it’s certainly worth taking the time to re-read a few pages before your interviews as Threading seems to come up so consistently.

Example Questions

This is quite a hard section to find links to.  There are so many websites out there, but they all tend to be ugly, full of adverts and of low content value with short 1 sentence questions and answers. The links below are the best of what I know online.

 

29- Core Java Interview Questions: Java review

As opposed to being a giant list of questions and answer, CJIQ instead does in depth core java revision articles which include example pertinent interview questions, along with comprehensive answers.

 

30- Java Code Geeks 

A very popular Java site, which has a lot of lists of Java Interview Questions and Answers.  Start off with the link above to their PDF of 115 Q&As.

 

31- Java Revisited

This entire site is done by one incredible man (@javinpaul), which when you see how much content there is on the site you’ll be as amazed as I constantly am.  Tons and tons of material.  Not the prettiest site in the world but plenty of reading material.

 

32- Java Interview Questions: Quora

Quora is a brilliant site for people to ask  questions openly and have experts come on and answer them.  There is a topic dedicated to Java Interview Questions, so there’s plenty to dig into here.

 

33- A big list of questions on Reddit

I can’t stress enough how useful Reddit is as a resource.  Simply go to the search and type “Java Interview Questions”.  The link above is to an example post with a ton of decent Java interview questions.

Code challenges

34- Core Java Interview Questions Code Corner

The special area on CJIQ dedicated to coding challenges, along with solutions and walk through videos based on real interview questions.

 

35- /r/dailyprogrammer

With fair regularity programming challenges are posted to this subreddit.  They are marked on their difficulty, which means you can take on whatever you feel comfortable with.  Not Java specific but there are normally Java answers posted (because it’s the best language!).  If you want little projects to try out things and stretch your design skills, this is a great way to do it.

 

36- http://www.javainterview.net/

Made by one guy (You can find him here on twitter) and absolutely packed with example code questions from interviews, alog with example answers.  A great place to start your coding revision before an interview.

 

37- LeetCode

A compendium of over 150 programming interview questions. Even better, you can enter your solution into the website and it will judge whether your solution is correct or not.

 

38- Hackerrank and CodeEval and Codility and Coding Bat

Both are similar to LeetCode, but a lot flashier. Tons of challenges, which can be completed to earn rank and compete on a leaderboard.  Tons of challenges split up into categories.

 

39- DZone Code Golf

Every week the folks at DZone post a coding challenge to produce an answer in the least amount of space.  Interesting way to warm up the mind.

 

40- Cracking the Coding Interview (on Amazon)

An Amazon number 1 best seller with over 150 programming questions and answers.

 

41- http://www.careercup.com/

Career Cup markets itself as “the world’s biggest and best source for software engineering interview preparation”.  It has volumes of programming interview questions that people post having had them asked in an interview, along with peoples submitted answers.  Some of the posts are better than others, but worth a look around for real questions.

 

42- Project Euler

Programming challenges with a mathematical slant, if you’re that way inclined.

Podcast Episode 5: Recruiters! with Sarah Sellers

core java interview questions podcast episode 1

 

IMG_9709Without a doubt I think this is going to be the most popular CJIQ podcast, maybe ever!  Sarah Sellers is from iKas international, an international recruitment agency based in HK, Singapore, Australia, London and New York (aka the glamour locations!).  I remember when I first had a call from a recruiter and being caught completely off guard so I approached this interview from the perspective of a complete beginner.  Whether you’re changing jobs for the first time or it’s been a long time since you dealt with a recruiter, or you just wanted an open and frank discussion with a recruiter this episode is for you.

 

I think the big takeaway from this podcast is trust, and finding a recruiter that you feel you can work with.  From my experience as well there are a lot of “slimey” recruiters, but there are also a number of diamonds in the rough. Go for coffee with a number of recruiters and find the one you feel comfortable with.

Java Phone Interview (4)

 

If you want to contact Sarah, you can reach her via ssellers@ikasinternational.com, or take her advice and give her a call at +852 3970 6604 (Skype does international numbers!), or hit twitter at ikashongkong.  Let her know you heard her on the podcast.

I’m also happy to announce the official release of Java Interview Bootcamp, my first book under the CJIQ banner.  If you’re looking for a new developer role then stop googling for example interview questions and check this out.  The first half of the book is dedicated to the “soft skills” of interviewing, which I think is the most important part of the interview. The second half is a comprehensive core Java review.  The book has been in beta for 2 months and I’ve had some incredible feedback from people who now have a new job thanks to this book.  I’d love it if you could check it out now.

Podcast Episode 4: Technical Programming Tests with Jim Bennett

core java interview questions podcast episode 1

Things have been quiet recently on the website whilst I’ve been travelling back to the UK.  Whilst therJim Bennette I took the time to sit down with my good friend Jim Bennett and talk about technical tests. I loved his article he wrote for CJIQ (you can see the post here) which I took a ton of value from and really wanted to sit down with him and expand the discussion.  We ended up talking for an hour but it’s packed with incredible information, including:

  • The benefits and negatives of moving abroad during your career
  • What are technical tests and what are companies trying to achieve with them?
  • The truth that companies want you to succeed
  • Why most interviews suck
  • Why you need to contact the interviewing team directly
  • How to use the job spec to write the best code
  • The tips you need to follow to give you the best chance of progressing

You can find Jim at @jimbobbennett and www.jimbobbennett.io

 

PodcastiTunesButton

Subscribe via RSS (Android/PC)

Download this episode (right click and save)

jimbennettcorejavainterviewquestionsResources discussed in this show:

IntelliJ (Download for free!)

ReSharper

Eclipse

WPF

MVVM

Maven

Gradle

How to create an online resume

create online resume

create online resume
My post on creating a Java developer resume (which you can read here) has proven to be one of the sites most popular.  I’ve been even more impressed by the number of people following through to the links regarding online resumes. This is clearly something are interested in, as they should be.  The vast majority of firms do online research on candidates now, and a lack of online presence can be a warning sign.  On the positive side, including a link to your online resume on your paper CV can ensure that people always see the latest version of your CV, and you can use this to direct them to your other sites online.  It’s also much easier to bookmark a candidate for later than to file the CV away where it will inevitably get lost.

As a result I wanted to put together this step by step tutorial to getting your online CV up. It’s often difficult to know where to start which means people are paralysed into inaction.  Below lays out everything you need to do to get your CV online in under 10 minutes.  You have 10 minutes right?

I have created the videos to guide you through, but the full instructions are listed below too.

Part One: Buying your domain

You need a domain to point people at which has your CV. Fortunately this is really easy to do.  If you can get yourname.com then that’s perfect, but if not there’s some other great domain endings geeks use, particularly .me and .io.  For this example I went for samatkinson.me.

You need to buy your domain and hosting from somewhere. There are tons of options at various price points out there. I use A Small Orange for every single one of my sites. They’re consistently rated as one of the best providers in online polls (such as this lifehacker one).  The big thing for me is the support; if I have any issues, from breaking one of my code templates to having issues setting something up they have 24/7 chat support with no waiting times.  I can’t recommend it enough. There are other hosting providers available though and it’s completely your choice.

If you head to the a small orange domains page you will see the screen below:

enter you domain

 

Enter the domain that you’re looking for; for me that was samatkinson.me.  This will search for that domain and similar domains.

search for domains

 

If your domain is available then select it, else play around with other options.  If you’re really struggling, pop your name into Domainr which will help you come up with some innovative domain ideas.

On the next screen you can just pass straight through. We’re leaving the nameservers pointing at ASO as we will buy our hosting from them too.  ID Protection will hide your details on places like whois.  It’s expensive but for the  privacy conscious it’s a good idea.

nameservers

This will take you through  to your cart. But we’re not done just yet, as we need to add hosting. A website has to be hosted on a server somewhere. Fortunately this is very cheap! Click on “Add another product” on the right.

Final screen part one

 

This will take you to the hosting options. For an online CV you only need a very small amount of space so the “tiny” option will be sufficient. If you select small or above you will be able to use multiple domains with the same hosting which can be quite cost efficient.

hosting options

 

On the next screen we want this hosting to be used with our domain, so we can just click next.hosting for domain

Skip straight pass the next two screens unless you want one of the add ons. I never select these.

addons Screen Shot 2015-01-11 at 12.24.09

 

And now you’re done! Checkout with your details and make sure to write down your login details.

Bonus! Get 15% off at the checkout using coupon code “aE1yQ”checkout

Part 2: Uploading your template


The obvious question at this point is “What template?”. You have three options

  • Write it yourself: Not recommended! It’s a lot of effort and, based on some I’ve seen in the past, it probably won’t look great.
  • Use a free template: In the original article I recommended this free template over at BootstrapZero. It’s very nice and you can edit it as much as you want.
  • Use the CJIQ template: As a bonus for every reader of Java Interview Bootcamp they receive an exclusive resume template. This too is based on bootstrap. This is what I used in the tutorial and video, but the instructions are EXACTLY the same as the free template above.

CJIQ Resume tempalte

 

From the ASO homepage, select “Support and Account Center” from the top right and login.

aso homepage

On the next screen you will see “Your Services”. This is your hosting which we need to log into. Select it, then “View Details”.

your services view details

If you don’t know your cPanel login then you can select “Change Password” to set a new one. Else, head straight to “Login to cPanel”.  This will take us to our control panel where we can get the details for uploading our resume.

 

Login to cPanel

 

Enter your login details which will take you to the cPanel. There is a ton of stuff here we can ignore.  We want FTP.  FTP is file transfer protocol, which allows us to upload files to our hosting.  In the “find functions” box, type “FTP”.ftp cPanel

 

Select FTP Accounts.  On the accounts page scroll down to the “FTP Accounts” header. You will find your FTP account here.  Click “Configure FTP client”.  This will give us the configuration to allow us to upload our template.

configre ftp client

You will now be presented with configuration files for a number of FTP clients. An FTP client is a piece of software you can download which will handle file upload.  I’m a huge fan of Cyberduck, which is available for Windows and Mac and is completely free. You can download it from https://cyberduck.io/.  Once you’ve done that, download the Cyberduck configuration and doubleclick the file that is downloaded.

ftp config optionsCyberduck will now open.  Enter the login details for your FTP account; the address you selected from the FTP accounts list (e.g.something@yourdomain.com) and the password (which you can change on the FTP accounts page).

Make sure the username includes the FULL account, not just the bit before the @symbol.cyberduck login

Once you’re logged in you’ll be shown everything that’s in your domain.  This is normally just a cgi-bin folder. We can now upload anything to our domain by dragging and dropping it in.

Unzip your resume template which you have downloaded.  We want index.html to be in the space cyberduck is showing you.  Go inside the folder your index.html sits in and select everything (cmd+a or ctrl+a for windows).  Drag and drop the files into cyberduck.

upload template

 

The files will upload to the server. When it’s complete, your website will be live! Congratulations!

You can check the uploaded version out at http://www.samatkinson.me.

 

Quick Bytes: Do you have experience with agile?

Agile Interview Questions

Agile Interview QuestionsIt’s impossible to be a Java developer without experience agile in one of it’s many forms.  Stemming from the agile manifesto which originally launched in 2001, agile practices took the software world by storm to quickly becoming one of technologies biggest buzzwords, which it still is today.  The problem is, many if not most agile projects have little or nothing to do with agility, instead becoming an excuse for poor design or instead allowing clients to demand more output at a faster pace and for less.

 

This makes agile a very interesting interview question from both sides. Chances are you have experience in a project which claimed to be agile, but was it really? Can you recognise the strengths and weaknesses?  Agile questions also give you a great opportunity to understand a teams development practices.  Are they the real deal, or have they just added two week sprints on top of waterfall? The maturity of a companies agile practices can be a good indicator of the quality of it’s systems.

 

What is Agile Development? How does it differ from other methodologies?

Agile development acknowledges that software projects are very different from building projects where more traditional development methodologies came from.  It is entirely possible to know up front exactly you would build and design a house; you can perfectly spec the size, shape and design up front. This allows you to perfectly plan what work is required and how long it will take based on previous experience: putting a brick wall up with a window is a standard practice wherever you do it.  Software is not like that. System development is complicated and difficult, but more importantly the end user does not normally know what they want or they are incapable of explaining it.  If you take 6 months to write a full specification and a further 12 to build the system it is often out of date by the time it is finished and won’t actually meet the needs of the customer.

Agile development acknowledges up front that requirements are malleable and that there will be unknowns. Being able to respond to change and produce a working, valuable system is our primary goal.   There are a number of features of agile development which help to achieve this:

  • Iterative development: a minimum viable product is produced to get a system in the hands of the user.  New functionality is added and the system improved using the feedback of users.  This minimises the time between a user requesting a feature and being able to use it live.  In turn this helps to prioritise the features which will add the most value for development next.
  • Stakeholder interaction: One of the central tenets of agile lies in the close interaction of development and business, working as partners on the solution.  This requires commitment from the business to spend time on the project but ensures a higher quality solution. In other methodologies such as Waterfall where the requirements are agreed up front lead to IT being a service and the solution rarely matching the needs of the consumer.
  • Product Backlog/Planning: The work for the coming weeks or months is written as stories; these are chunks of work which can be usually completed within a single iteration (usually lasting 2 weeks).  Features can be prioritised by the business based on rough sizing (such as t-shirt sizing). Features with higher importance can then be broken down into detailed stories.  Only the work for the upcoming iterations should be well understood with detailed stories, as this reduces the chance of wasted planning because of a change in priorities. Agile embraces change.
  • Velocity: By measuring the size of stories (either in time, story points or some other fashion) we can see how many of that unit we can complete each iteration.  A well performing team will “burn down” a similar amount each sprint, allowing for a team to be able to estimate upcoming deliveries with a reasonable degree of accuracy.

Where agile tries to incrementally develop and deliver a product, Waterfall instead focuses on creating all the requirements up front and delivering the system as a “big bang”. This rarely works.

Tell me about your experiences with Agile. Do you think it’s a good thing?

Obviously this is going to completely depend on how your teams have worked, but the important thing is to take the time before an interview to think about your experiences and come up with a concise opinion.  Here’s my view.

In principal, agile development is a great thing. It’s certainly lightyears ahead of waterfall and other legacy methodologies.   There’s a big difference between lowercase agile and uppercase Agile.  Lowercase agile is about actually being agile: flexible, nimble and open to change. This is a rare thing though, as most firms use the formal uppercase Agile.  It has garnered a worsening reputation in recent years.  A lot of people have used the banner of Agile as an excuse for poor development practices; skipping out on design, poor planning, completely abandoning documentation.  The most common practice in my experience seems to be to continue to do Waterfall; big requirements up front, but then to do two week “iterations” without any flexibility or interaction with the stakeholders.  This is obviously a bad thing.

Further to this, things like Scrum have further damaged the reputation in my opinion. It places formal process around the intentionally loose agile manifesto, which can add significant overhead at no benefit in an undisciplined and untrained team.  Scrum master certification has removed all value in the term “Scrum Master’ thanks to greedy training companies allowing anyone with money and a weekend spare to become certified.

For me, good agile can be represented simply as “iterative development” and working closely with my stakeholders.  Each team and each project works differently and it’s important to come up with something that works for you.  Being able to react quickly to changing requirements and deliver brilliant, functional systems is the most important thing for an agile team.  This doesn’t preclude up front design and this doesn’t stop documentation.

I’d love to know what you think.  What is your experience with agile, or indeed Agile?  Let everyone know in the comments!

 

Podcast Episode 3: What does a good Java developer look like?

core java interview questions podcast episode 1

core java interview questions podcast episode 1

I am Mike De Lunareally excited for you to listen to episode 3 of the podcast which features my first ever guest, Mike De Luna (www.michaeldeluna.com).  The topic of what a good developer looks like is one I love to discuss.  It’s so much more than being a good coder! In this discussion me and Mike break down what the skills a top developer has and how to express these during an interview, and also what facets a bad developer has.


work with cool people
This episode is absolutely packed with information and tips.  What do you thinkmakes a good developer? Put it in the comments below!PodcastiTunesButton

Subscribe via RSS (Android/PC)

Download this episode (right click and save)

Resources discussed in the show: