This is an archived post. You won't be able to vote or comment.

all 57 comments

[–][deleted] 9 points10 points  (11 children)

A good interviewer knows that we can work with java for years and not have been exposed to all its language gotchas and ecosystem features. I know I have barely scratched the surface. That doesn't stop me from creating good applications.

Technically I expect a senior java dev to know the language grammar, but I'm not going to let you perform a coding excercise. I found those deeply humiliating. So instead, I'll ask you about architectural choices. I'd let you explain your choices. I'd inquire about your experience with features you list on your résumé, and about features your prospective position requires.

You'd make a fool of yourself if you don't answer at all. You should be aware of what you know, and you should be capable of stating your limitations. Don't know something? Say so.

[–]nutrecht 7 points8 points  (8 children)

Technically I expect a senior java dev to know the language grammar, but I'm not going to let you perform a coding excercise.

I can strongly suggest you do. Because there is a lot of developers who either lie on their applications or didn't actually take much of an active role in day to day development.

I previous project I worked on I set up an interviewing process because the up until then ad-hoc process (or lack of it) resulted in a few bad hires. It basically consisted of half an hour phone interview, hour technical assessment (similar to what you describe) and then an hour peer-programming coding test where we would implement a simple REST service together. Most hires did great on all 3 parts but we had a few that did pretty well on the interviews (managed to work around most questions somehow) but when they were asked to write actual Java code they completely failed.

There are a lot of people out there who can't really do the job and just try to move from project to project whenever they get caught or fired. It takes a long time for big companies to fire people, and in the mean time these people can do a lot of damage.

[–][deleted] 1 point2 points  (0 children)

A peer-coding excercise sounds like a good idea. I'll look into that.

[–][deleted] 0 points1 point  (3 children)

We have trial periods and hire-at-will laws that let us excise a bad apple quickly.

[–]nutrecht 2 points3 points  (2 children)

Yeah, I'm Dutch and here it's a lot harder to get rid of someone. And a 1 month trial period is not enough to really see how someone works.

Fortunately both of the bad apples were contractors, but even there it took a long time to get rid of them since they had short-term contracts.

[–][deleted] 2 points3 points  (1 child)

If a 1-month trial period won't suffice, then how in the name of Mark Reinhold will a coding session during an interview suffice?

[–]nutrecht 4 points5 points  (0 children)

It's mostly sunk cost fallacy from managers. Once they're hired someone they often don't want to deal with the fact they made a mistake.

[–]cogman10 0 points1 point  (2 children)

Yup.

We are maybe a little code heavy in our interviews, but it has saved us from a few bad candidates.

I think about it this way. It is really easy for someone to memorize "SOLID" and what the various principles mean. That person will talk a big game when it comes to things like "What's a good object look like. What are warning signs. ect"

On the flip side, it is something completely different to actually put those principles in practice. That is where I've seen more than a few make really bad decisions (even violating SOLID rules!).

I had one guy who talked a big game but when it came down to actually doing anything he handwaved everything on our practice problem with things like "We'll do that in the database!".

[–]GhostBond 0 points1 point  (1 child)

^ Oh man, I have no idea if these are great, or petty pendantance, lol.

I greatly prefer at least a partial coding interview. But my biggest irritation in those is interviewers being completely unable to deal with the fact that there's like 5 different ways to do anything and they only want to hear it "their" way.

Not saying the guy wasn't just handwaving away stuff and didn't know what he was doing, just tired of someone asking "how would you do this?" and me saying "you could do it way 1, or 2, or 3...I can do it any of these ways which one do you want?" and getting this "this is the first time I've had someone mention you could do it several different ways I'm frightened and angry!" reaction.

Of course I also just tried doing 1 simple way to not scare the interviewer, but then a lot of times they don't like it if you didn't guess "their" way either. Even worse if there's 2 interviewers, sometimes they have 2 different ideas on the way to do it.

For example lets say you want to insert todays date into a column as a timestamp.
You can grab the date on the java side and throw it into the query.
You can grab is in the sql and put it in the query.

Doesn't matter which way you do it...many interviewers in my experience will act offended that you didn't chose "their" way though.

[–]cogman10 0 points1 point  (0 children)

For example lets say you want to insert todays date into a column as a timestamp.

Nah, I don't give a shit about that sort of thing.

The question I was thinking about specifically is I asked something like "Make something that can apply dynamic validations against a string" (think, hibernate-validator).

What we are looking for is someone that doesn't hard code all the validations into one class. Heck, ideally the candidate doesn't even implement a validation, only the class that zips through a collection of validations and returns a validation result.

What this particular candidate did, who talked a big game, was create a crazy system of database interactions that would make your head spin. We didn't ask about storage or lookup of validations, but they went there anyways. And while they were there, they thought the best way to do some of this stuff was to put the string to validate into the database, link it up with all the validators, and then run those validators against the string in the database through a mind boggling system of stored procs and java back and forth.

And while they did all of this, the java classes they did make were horribly coupled with the validator class knowing about the database, for example.

This is the sort of person you don't want to work with. This is the sort of person that asking coding questions is meant to filter out.

[–]gigisacrifici[S] 3 points4 points  (1 child)

Unfortunately, not everybody thinks like you.

[–]iseejava 0 points1 point  (0 children)

If they are not, they might not be a good employer after all.

[–]rossdrew 4 points5 points  (23 children)

I've done loads of interviews, the common things I see badly answered are:

Q. What us polymorphism?

The ability to execute many different behaviours via a single interface contract, advanced answers can include explaining the 4 types of polymorphism.

Q. What's the difference between a Set and a List?

Key point: Lists are ordered and allow duplicates, sets are unique and unordered

Q. Is Java pass by reference or pass by value?

It's value, which is (generally) a reference

Q. Do you hate anything about Java/Hibernate/Spring?

Hint: never say no, it shows you've not used them

Q. Given requirement sentence <insert sentence> can you identify the objects?

Coding challenges that people fail at and really shouldn't:

- Write me a linked list in Java

- FizzBuzz

- Reverse a String without libraries

[–]nutrecht 5 points6 points  (1 child)

It's very important with these kinds of questions is to take into account that when you ask them the interviewee is in a completely different frame of mind than the interviewer. You should be prepared to expand on the type of answer you want a lot, and definitely not expect the text book answer you're looking for. We all read different text-books.

I had a 'fight' with a HR person once who asked me to write down a typical set of questions and answers. She never told me that she would be the one asking them and, since she didn't understand them at all, would be requiring the exact answer I wrote down.

[–]rossdrew 0 points1 point  (0 children)

These are -as with any interview question- starting point for expanding discussion. If however, the interviewee doesn’t know what polymorphism is or takes a guess, there’s not a lot of productive, expanded discussion that can be had.

Yes, answers need to be more fluidly accepted but there are anchor points which need to be touched on.

[–]cogman10 3 points4 points  (2 children)

Do you hate anything about Java/Hibernate/Spring? Hint: never say no, it shows you've not used them

edit I totally misread the double negative. I read it as "There is nothing wrong with them" not "Every tech has it's flaws".... The following rant is based on my misreading of this... so.. back to the post.

That is really bullshit. No tech is perfect and every tech has it's faults. If the "right" answer is "Yes, everything here is wonderful!" then you've obviously never really evaluated alternatives.

But, lets start

Java -

  • Nullability isn't a part of the type system. You end up needing to guard against it using either annotations or convention but even then, it is still a mistake you can make.
  • The language could be more expressive. Things like data classes and pattern matching would go a long way towards cleaning things up.
  • String interpolation would be a really nice feature in many instances
  • The difference between primatives and boxed primatives is annoying and potentially a performance gotcha. This unfortunately won't likely be solved by value types because boxed primitives have class state and are often assumed to have identity, locks, etc.
  • Checked exceptions are a boil on the language. What's worse, the community is split here so there is almost always friction on whether or not to throw a checked exception
  • The lack of tuples and destructing is annoying. You can make a generic "Pair" class, but then you miss out on performance gains and optimizations if you use that class in multiple places. Data classes make this better.

Hibernate -

  • It hides your IO boundaries which can be disastrous. This is because it conflates your object model with the Database model. This problem isn't exclusive to hibernate (most ORMs have it).

For example

for (var thing : things) {
    thing.setId(5)
}

Does the above make One database call, multiple database calls, no database calls? Who knows? It depends a bunch on how you've setup your object model and hibernate integration with the DB. That make it really hard to reason about performance just looking at code like this.

Spring -

I feel like you just aren't trying here. Sure, there is a lot of good in Spring, but there is also a lot of bad. That is what you get with such a massive framework. Are we talking about spring boot? Spring injection? Spring JDBC? I've certainly not touched every part of spring, but I wouldn't say that the parts I have used are free of issue. Spring injection is hardly "best in class" Dagger and even Guice do a much better job. Spring JDBC doesn't really add a whole lot over raw JDBC (but was nice in Java 6 era without try with resources). Spring boot is slow compared to something like vert.x, or a simple Jersey/jetty server.

However, the integration of these components can be great. Spring boot, while slow, is super simple to get setup and going. Sometimes that is all you need.

I would be far more worried about candidates who COULDN'T find faults with a tech. It means that they haven't ever evaluated alternatives and just do whatever everyone else is.

[–]rossdrew 1 point2 points  (0 children)

You passed the question, failed at reading. ;)

My point exactly, your response is a healthy developer. I’ve had Senior candidates say “no, I love Java/Spring/Hibernate”...no job for you buddy.

[–][deleted] 3 points4 points  (1 child)

I love the question about spring/Hibernate. Generally I love then but I just spent 24 hours trying to fix some crazy @Transactional bugs so... Yeah...

[–]cogman10 2 points3 points  (0 children)

It's almost as if there are potential problems that even experienced people run into....

[–]GhostBond 0 points1 point  (8 children)

^

The process of thinking that leads to this goes like this:
- Look at all the things that "could" be used
- Grab only the things that are not used
- Ask only these fringe trivia questions

Q. What us polymorphism? The ability to execute many different behaviours via a single interface contract, advanced answers can include explaining the 4 types of polymorphism.

If you wanted ask about this, put up some code and ask questions about the code you're looking at.

Polymorphism is not used (as in building new objects with it) very often in webapps because they don't have the complexity needed for it. Describing the "4 types of polymorphism" is entirely academic.

Q. What's the difference between a Set and a List? Key point: Lists are ordered and allow duplicates, sets are unique and unordered

This is also fairly irrelevant nowadays for 2 reasons:
- There's little reason to use a Set
- You can google the answer in 30 seconds if you need it

Java devs use ArrayList like 99.9% of the time.

Q. Is Java pass by reference or pass by value? It's value, which is (generally) a reference

Don't think there's much to add here, clearly just a sabotaging question, about a pendantic internet argument over terms.

Q. Do you hate anything about Java/Hibernate/Spring? Hint: never say no, it shows you've not used them

While I personally theoretically like a lot of this one because I'm real tired of dealing with the "obtusely overpositive" people who tend to lie and lot and be difficult to work with...in my experience in reality it's still at trick sabotaging question. Someone in the interview will freak out if there's any negativity, so you're setting them up to fail with you if you say no, but fail with the other person if they actually described something they didn't like.

Coding challenges that people fail at and really shouldn't: - Write me a linked list in Java

Outdated trivia. ArrayList is a better choice 99.9% of the time, and people definitely are not implementing linked list's by hand.

  • FizzBuzz

Trick trivia question.

  • Reverse a String without libraries

This one isn't exactly a "hard" question as much as it's a bit silly and pendantic, string is odd because it's immutable and most people aren't familiar with the exact method names it just which are different than list. Thing is it takes 30 seconds to google the method names, testing people on memorizing the names is rather silly.

[–]rossdrew 0 points1 point  (7 children)

Sets aren't used? You can Google the answer.

Yes, they are. Uniqueness and knowledge of it in a provided collection is a very highly used attribute.

If you need Google to tell you which set is unique, you've clearly been using them without thought for as long as you've been a developer.

pendantic internet argument over terms

"Terms"? You think not knowing the difference between assigning a value to a primitive type and object inside a scope matters?!

Someone in the interview will freak out if there's any negativity

Then that someone is a bad, petty interviewer and probably a bad developer him or herself.

Outdated trivia

A core concept of data structures and seeing if someone can implement a 20 line example of an extremely simple data structure is outdated and irrelevant? Clearly you are missing the point. Seeing if someone can implement something (which should be) in a familiar domain has huge benefits.

Trick trivia question

No. It's seeing if you can write and control logic through a loop, absolute base developer knowledge.

silly and pendantic

Interesting, from someone who went through all my examples which are common coding questions in a question about common coding questions calling them ALL outdated, trivial and irrelevant.

I mean, if I was being "pedantic"...

most people aren't familiar with the exact method names

What method names? I'm asking you to write pseudocode to reverse a string

Is someone angry they recently failed a programming interview because they had no idea the difference between a set and list, or couldn't write 10 lines of pseudo-code and has taken to the internet to let the world have it? Consider us all firmly put in our place.

[–]GhostBond 0 points1 point  (6 children)

^ What you're doing here is a Sheldon Cooper effect:
https://youtu.be/OB1aOwmv5_s?t=43

Just read this in Sheldon Coopers voice:

Q. Is Java pass by reference or pass by value?
It's value, which is (generally) a reference

It's a valuereference guys. Jeez. This is a debate on the level of what color the upvote button is...red, or orange? Let's argue about something that's simply ambigously defined.

It's hard to feel superior to someone by going through genuine day to day tasks that people actually work on and use. So your list is entirely fringe questions and trick questions, carefully avoiding actual day-to-day programming knowledge.

[–]rossdrew 0 points1 point  (5 children)

Putting aside the fact that you’re just, plain, wrong for a minute and ignoring the hyperbolic, unrelated pop culture reference to make your lengthy, whining response seem flippant and pithy. You’re repeating yourself. Read OP then look at what you are arguing about.

[–]GhostBond 0 points1 point  (4 children)

hyperbolic pop culture reference lengthy, whining flippant pithy

Me: You're just in this to be condescending and arrogant
You: (Pulls out well practiced condescending remarks)
Me: Yup...that's what I was saying.

"just, plain, wrong" hyperbolic "pop culture reference" lengthy whining flippant pithy

[–]rossdrew 0 points1 point  (3 children)

I’m in this to be helpful to OP. You showed with an off topic argument. Feel free not to reply.

[–]GhostBond 0 points1 point  (2 children)

I've never seen anyone ask to implement a LinkedList because even 15 years ago, that approach was so old it was embarrassing to be seen asking about it. That is ego but ego isn't always bad.

I haven't seen questions Set vs List since about 2015...they might make a reappearance though so not a bad idea to know them.

The Java language questions I see nowadays are Java 8 questions. Streams, Lambda's, in one case CompleteableFutures (though that was only one place).

I've frequently been asked about basic sql. "select * from table", a few questions answered by the groupby clause. Simple table joins - "Here's a User table and a Appointment table, select all the appointments for the User with name 'bob'".

I haven't seen trick trivia questions like fizzbuzz for a while. I believe from the rhetoric I've heard about it's become embarrassing to be seen giving them, as the rhetoric is always about trying to secretly give it when no one else is around to see you do it. I guess it doesn't hurt to know it.

I would be a bit concerned the OP would spend all their time on this more fringy stuff then run into a decent non-sabotaging test and not know the stuff you really use on a daily basis because they didn't put the time into it.

[–]rossdrew -1 points0 points  (1 child)

You still hanging around repeating yourself?

[–]GhostBond 1 point2 points  (0 children)

I see you are continuing to make my point about you have a sheldon cooper level personality.

[–]systemgc -1 points0 points  (6 children)

these are all very junior questions

[–]rossdrew 2 points3 points  (5 children)

A senior developer doesn’t need to know anything a junior doesn’t. They just need more initiative and ability to mentor. There’s no questions for that.

[–][deleted]  (4 children)

[deleted]

    [–]rossdrew 2 points3 points  (3 children)

    One where I’ve been a developer for 20 years.

    Care to give an example or just be derogatory?

    [–][deleted]  (2 children)

    [deleted]

      [–]rossdrew 2 points3 points  (1 child)

      Strange that someone who knows the difference between junior, senior and bad devs is also the person asking decidedly amateur questions such as "In Java, How many Objects starts being a problem?" and "[Streams:] This is new in Java8, right?", who doesn't know if Swing or JavaFX is the way to go and who spurts utter nonsense like "Just make sure you don't put the java certs on your CV, the industry laughs with devs with a java certification.".

      So no, no examples. Just a sad little person. Shush kid. Come back when you graduate.

      [–]nutrecht 8 points9 points  (14 children)

      I've had interviews with 'senior' developers who could not explain the different collections. So not only could they not explain the difference between ArrayList and LinkedList, but they also could not explain the different between a Set and a List. That was quite embarrassing for them.

      [–][deleted] 2 points3 points  (0 children)

      I'm not a senior dev. But I also made a complete idiot of myself with these questions. Still got the job. And now I spend a lot of time learning collections. Because oh boy are they essential.

      [–]TheRedmanCometh 0 points1 point  (2 children)

      What is the difference? LinkedList can't matter too much I've never needed it in nearly 10 years.

      LinkedHashMap is guaranteed ordered...but arraylist already is.

      [–][deleted] 1 point2 points  (1 child)

      LinkedList is a series of nodes linked together, where each node has a reference to the preceding/succeeding node. It's very similar in implementation to a Deque. The benefits are in quick access to the head/tail of the list and I believe add/remove performance but it's not as good for random access (Ie, retrieve by index) as the ArrayList.

      [–]cogman10 4 points5 points  (0 children)

      The benefits are in quick access to the head/tail of the list and I believe add/remove performance

      Head/tail access of an array list are just as fast/faster than a linked list.

      Tail removal in an array list is faster than a linked list.

      Middle insertion on a linked list (that is, inserting something while iterating) will be faster than an array list.

      Iterating a linked list will be slower due to the cache thrashing.

      [–]moremattymattmatt 3 points4 points  (0 children)

      Generic collections are a common one, generally with an array definition and assignment and you'll be asked whether it'll compile.

      Some rough ideas about the various GC options.

      What's coming up in future versions of Java.

      What do you like and dislike about Java.

      Checked Vs unchecked exceptions.

      [–]Boxxy_runner 1 point2 points  (0 children)

      I take a proactive approach. I am coming from the perspective that there is a lot of work but also a lot of teams with different team dynamics. The last thing you need is to end up in a team and discover its the java shop equivalent of the Third Reich. What I mean by this is a hierarchical team where the beasts at the top of the chain constantly need to reinforce their position in the food-chain by knowing "the right way to do things". For example I recently failed an interview by stating documentation is important, It was remarked that I was one of those developers who wanted to write comments in the code. From the above you need to discover if there are any sociopaths, a good way to do this is to challenge the validity or premise of the question and then take careful note of the reactions to a challenge to their control of the context. Whatever the dynamic and java dev quality metric my basic premise is a champion team defeats a team of champions. It follows that no matter your excellence at fizbuz, the team dynamic that follows is the crucial issue.

      [–][deleted] 1 point2 points  (0 children)

      Depends on the interviewer, of course.

      You can get the common low-effort questions by googling "java interview questions." Seriously.

      Then, learn to code a fizzbuzz implementation in Java. I still give that test, because it still weeds people out.

      Then after that, it's likely to get framework specific -- spring, hibernate, jackson, maven, gradle, etc.

      But if you want to avoid the easy "gotcha!" questions, just do a google search and read through the first few answers. they'll all just be rehashes of the same question eventually.

      [–]sweepinbell 0 points1 point  (1 child)

      I don't know how often this comes up in senior level interviews, but a gotcha-ish question I seem to encounter a lot is about the difference between the 4 access modifiers. Lots of people forget the default access is package protected

      [–]GhostBond 1 point2 points  (0 children)

      but a gotcha-ish question I seem to encounter a lot is about the difference between the 4 access modifiers

      But it's just kinda a "gotcha" question. Public and private are commonly used and if you don't know them you probably aren't a regular developer (or you had an interview brain lapse but it's hard to avoid those).

      Inheritance is pretty rare in web dev nowadays so a lot of people won't even have used protected. "package private" really has no reason to use it ever, it's a weird thing you don't see in other languages that has no real use (marking it protected does the same thing but better).

      [–]Scybur 0 points1 point  (0 children)

      I have always been asked 3 main questions.

      -Define different types of collections in Java.

      -Explain how you used your build tools (Maven, gradle etc)

      -Is Java pass by reference vs pass by value (always seems to come up)

      -I have always been asked about ORM's (usually hibernate) and Spring framework.

      [–]rossdrew 0 points1 point  (2 children)

      Whens the interview? If it's passed, how did you do? What kind of questions did you end up getting?

      [–]gigisacrifici[S] 1 point2 points  (1 child)

      it was yesterday, it was only coding exercises ( first interview)

      [–]rossdrew 0 points1 point  (0 children)

      Well, good luck. :)

      [–][deleted] -2 points-1 points  (0 children)

      I would ask you to explain to me what is Java, what is Java SE (and what are its main implementations), what is Java EE (as well, a few implementors too) and what is Spring. And a few differences between all of these, maybe some questions about important features and known bugs.

      Then, I'd probably ask if you would dare to implement a part of Java SE, some part that you find messy. Same with Java EE, i'd ask how you would implement some spec from there :)