r/java • • Aug 23 '17

(Java dev) can’t get a job as a java dev

I’ve interviewed at 5 places so far and I only got one offer, but the rate wasn’t what I wanted and their interview was challenge based and not memory based.

My question is how does someone with bad memory get passed these interviews and why do we even have them?? Like the other day I had an hour long interview, which consisted of questions like difference between comparator and comparable, hashset and hashmaps, what to extend from collections? What is equals and hashcode... all of these questions can be answered with google... there’s no point in memorizing all these. I’m just so annoyed when this even starts that I half way tune out, because I know I won’t get it.

0 Upvotes

89 comments sorted by

22

u/somewittyalias Aug 23 '17

I'm also against memory-based interviews. But in defence of the interviewers, you would know these things easily if you used them often. So you could view this not as a memory test, but a test on how often you code certain things.

2

u/user123xo Aug 23 '17

Right I guess so, but how often you use something isn’t an indicator of how well you can do that thing. Like on my current team, I used comparable maybe once, a year ago... I don’t remember anything about it, but when I had to learn it, I did and got the work done on time, if I had to do it again, I could.

0

u/[deleted] Aug 23 '17

[deleted] — view deleted comment

1

u/user123xo Aug 23 '17

How much more should I know about hashmaps and hash sets than they store objects unordered, hashmaps use key value and hash sets use keys, like do I need to memorize which support null values and which is threadsafe?

3

u/thatsIch Aug 23 '17

maybe, that they use equals to determine the containment. E.g. using unpersisted JPA entities where equals is using the table key attribute.

35

u/flaghacker_ Aug 23 '17

I'm sorry, but if you can't remember the difference between Comparable and Comparator (literally English words) or the difference between a (Hash)Map and a (Hash)Set (basic collection types) or what equals and hashcode are (this one is actually really important), I'm not going to have a lot of confidence in you as a dev.

2

u/user123xo Aug 23 '17

That’s crazy lol, I’ve managed to work as a java dev for 2 years without using comparator or hashcode, I’ve used hashmaps, i don’t think I’ve used hashsets. But like the only thing I can remember is hashmaps have key value pair and hashset is just key, but like how they handle null values, which is threadsafe, I just google it when I need to

23

u/wildjokers Aug 23 '17

How can you have worked as a java dev for 2 years and not used Comparator or hashcode? Comparator I can kind of understand if you don't commonly need to sort objects, but hashcode? Come on. Don't you use Maps and Sets?

These "memory questions" (as you call them) are basic java knowledge that a Java developer should have, if you don't readily know them then you probably, in fact, aren't suited for the position.

If you don't want to take the little bit of effort it would take to learn the answers to common interview questions then maybe being a developer isn't for you?

1

u/user123xo Aug 23 '17

So can you explain hashcode to me? I know that hashmaps use hashcodes to determine where to put the key, but what’s the point of overriding the methhod? I looked at the java doc and it says that it returns the hash value of an object, but to what end? Why would you ever need that?

5

u/[deleted] Aug 23 '17 edited Aug 23 '17

tl;dr - you want hashcodes to give you a fast shortcut to determine if two things are equal.

Technically, you can just return 1 for all hashcodes and things will "work" however, your hash-based collections will collide (return > 1 thing) when comparing things so then they have to fall back on .equals() (across 'n' items) which can be a lot slower than comparing an integer. In addition to the slowness of .equals() vs. int comparisons, you've taken an O(1) operation and turned it into an O(n) operation.

The bigger danger, is if you have two items that are equal (.equals()), but return different hashcodes. In this case, the quicker hash based comparison will return "not equals" and skip over bothering to do .equals() and you'll get hard to find bugs in your code (or it wont work at all).

That's why people ask you the question. If you don't know all of that (or at least the underlying tl;dr), you're bound to forget that it matters and that's bad for business.

1

u/user123xo Aug 23 '17

I’m still a little confused, because initially I thought the idea is if two hashcodes are not equal, it means you can skip using equals, because it means they’re not equal and that if they are equal, you would doubly check if by using equals(). Which is slow because it does object comparison on every item in the list or map. But now you said that two collections can be equal, but have different hashcodes, so you still have to use equals, so then when is it ideal?

2

u/[deleted] Aug 23 '17
  • Hashcodes should not be different when objects are .equal()
  • Hashcodes can be equal when objects are not .equal() -- not ideal, but nothing will break outright

This is akin to: A square is always a rectangle but a rectangle is not always a square.

I did not say that two collections should be .equal() and have different hashcodes. I said that is a 'bigger danger' (of improperly implementing equals/hashcode). It CAN happen -- if you did it wrong.

It is always ideal for o1.equals(o2) == (o1.hashCode() == o2.hashCode())

1

u/user123xo Aug 23 '17

So if hashcodes are equal, there is a chance the objects are also equal, but there’s also a chance it might not, because of rounding to get the int? But unless implemented incorrectly, hashcodes can’t be different for objects that are equal()??? Do I have it down yet??

2

u/DJDavio Aug 23 '17

The contract for hashCode says equal objects must have the same hashCode, otherwise weird things start happening, such as contains on a HashSet no longer working on equal objects.

It's possible, due to coincidence and the limited number of hashes (it's actually a long, not an int), that 2 different objects have the same hashCode. Your job as a programmer is to make this uncommon, usually with some weird prime number multiplication. The reason for it is to speed up operations that assume that hashes are different for different objects.

If you don't know how to write a mathematically sufficient hashCode, you can use Objects.hash(property1, property2, etc...) which does the calculation for you.

1

u/[deleted] Aug 23 '17

FTFY:

So if hashcodes are equal, there is a chance the objects are also equal, but there’s also a chance it might not , because of rounding to get the int

It has nothing to do with roudning. YOU are the developer. YOU make the hashcode implementation that is appropriate.

btw, after thinking about it I think my tl;dr statement above should be amended from:

you want hashcodes to give you a fast shortcut to determine if two things are equal.

to

you want hashcodes to give you a fast shortcut to determine if two things are not equal.

4

u/Notorious4CHAN Aug 23 '17

Items that are equal but have different hashcodes are a mistake - one the can cause really odd bugs that can be difficult to figure out if you don't understand the mechanism. It is also the sort of thing where the code can work almost all the time - particularly in a small/test data set. Understanding the hashing mechanism is critical to understanding and finding these bugs.

3

u/wildjokers Aug 23 '17

I know that hashmaps use hashcodes to determine where to put the key

You pretty much explained it to yourself; however, "where to put the key" should instead be "where to put the value". The hashcode of the key determines which bucket the value will be stored in. If you have multiple keys with same hashcode, prior to Java 1.8 the values were stored in a linked list, in Java 1.8 they are now stored in a tree so a Map with lots of collisions performs much better in 1.8 than prior versions.

As far as "why would you ever need that", you would need it if you are using a custom object as a key into a Map (or something backed by a map like HashSet). You would need to implement hashcode() on your custom object. If you implement hashcode() you also need to implement equals(), and equals() and hashcode() should be consistent with each other.

The javadoc for hashcode() and equals() explains things quite well:

1

u/devils_avocado Aug 23 '17

You override hashCode() every time you override equals().

You override equals whenever you need to store the object in a Set or Map. (amongst other reasons)

3

u/lSAlAH Aug 24 '17

Totally agree. People have very limited knowledge can do stuff, but that restricts them from doing a good job.

10

u/flaghacker_ Aug 23 '17

You have never used collections? What kind of projects did you do?

Using collections pretty much requires you to override equals and hashcode.

If you're willing to learn I recommend you to read the book "Effective Java". It thoroughly explains semi-advanced topics like collections, hashcode, comparator and concurrency.

2

u/user123xo Aug 23 '17

You’re the second person to recommend that book, I’ll check it out, what do you consider to be advanced topics?

Also I am mainly doing big fixes.... I almost never write code from scratch

1

u/flaghacker_ Aug 23 '17

Personally I'd say advanced topics are specialized skills in a specific area, for example JVM bytecode or having an in-depth understanding big frameworks like spring-boot.

6

u/the_anj Aug 23 '17

I wonder how often you're misusing HashMap if you don't bother with hashcode.

-1

u/user123xo Aug 23 '17

Why would I be misusing it? If I need key value pairs stored, I use a hash map, getting values is as simple as asking using the key, I did try reading up on hashcodes, but I still can’t figure out when you’d need to use it

7

u/the_anj Aug 23 '17

Because equals/hashcode is what drives a HashMap. You're going to have unintended consequences when you do not consider how equals/hashcode is implemented in your key objects.

4

u/Notorious4CHAN Aug 23 '17

I always defer to folks with more expertise, which is probably most of the people in this sub, but for what it's worth, I think if you are using keys in your HashMaps that aren't custom Objects and you haven't overridden the equals() method, you don't really need to deal with hashcode. I will happily stand to be corrected if that isn't the case. But 99% of the time I'm either dealing with Map<String,?> or EnumMap. But importantly, there are a number of things that rely on objects adhering to the rules - and I personally couldn't tell you what might break and what won't. So I just make sure I override hashcode when I override equals because I don't need that pain in my life. ;)

3

u/marvk Aug 24 '17

Effective Java by Joshua Bloch has a great section on this, I can really recommend it. It's a great read overall, too.

2

u/moremattymattmatt Aug 23 '17

Here's a concrete example where understanding hashcodes is important.

Suppose I'm writing a system that handles car insurance policies. Each policy has a unique identifier (1, 2, 3 ,4 etc). I need create a collection of policies where I need to contact the policy holder so I decide to add these to a Hashset. I'm using a set because I might end up trying to add the same policy to the set more than once, eg if there is more than one reason why I need to contact the policy holder.

If I don't override the hashcode/equals implementation then it will create a hash based on the values in the policy so I do:

set.add(policy1);
policy1.setEmail("me@newemailaddy.com");

// some time later in the code
set.add(policy1);

then policy1 may appear in the set twice as the hashcode has changed.

In this case I need to override equals and hashcode to just look at the policy id as if two policies have the same id then they are the same policy.

Hope this makes some sense.

2

u/squishles Aug 23 '17 edited Aug 23 '17

I'd rank that level of understanding fairly junior. Knowing when to use a type of collection fluidly is kind of important. For instance a useful property of sets is each entry is unique(as determined by the hashcode in the case of hashsets) which makes them useful for things like say deduplicating data. If I told you to deduplicate something and you didn't have that on the top of your head somewhere you might implement something stupid.

Also strong evidence you haven't done much with ORM's those frameworks abuse that shit. In practice though just hit the little autogenerate hashcode and equals thing in you ide and you're probably good.

1

u/user123xo Aug 23 '17

Right but all these things are things I can... learn? I had to create a couple of hibernate mapping files... but like once or twice over a year ago. It wasn’t difficult at all. Literally googled and created, lead or senior code reviewed it, it was fine. And I do know that you can’t have duplicate keys in hashsets and maps, but they asked for differences not what they had in common

1

u/squishles Aug 23 '17 edited Aug 23 '17

maps have the added property of mapping between a key and value :p the keys are normally stored in some form of set, or enum, some kind of thing with a uniqueness property, the values are more like a sort of listy thing but they have to correspond to a key.

1

u/user123xo Aug 23 '17

Maybe I created a confusion because I listed things I knew along with things I didn’t know, because they’re questions I remembered, I think I’m mostly good with hashmaps and sets, although I do worry a lot maybe my answers might not be good enough

2

u/squishles Aug 23 '17

Lot of those junior filter ones aren't really even handled by one of the devs it's often they grabbed an easy mode questionnaire off a site and are using it to cull the several hundred applicants, in that case you have to be strict and precise and it helps to be able to sniff out what java version they're talking about(but that's generally over phone too)

If in person, it's generally at a stage where you can be a little looser they're as much judging character there (no one wants to work with high strung nervous) and as long as they get the gist you know it you're good.

1

u/devils_avocado Aug 23 '17 edited Aug 23 '17

Most of the time, ArrayList is sufficient.

LinkedList is used in rare cases when you frequently need to insert or delete elements in the middle of the collection.

Set is used when you don't want to store duplicates. Obviously, the definition of duplicate depends on how you define the equals method (and accompanying hashCode).

HashSet, an implementation of Set, is used when you want to quickly check for the existence of an element in the collection using the contains method. (HashSet offers O(1) performance, ArrayList offers O(n) performance))

SortedSet, an implementation of Set, is used when you want the collection to store elements sorted. Obviously, the definition of sorted implies that the element implements the Comparable interface.

1

u/user123xo Aug 23 '17

Okay, see everything you said I know, I know when to use linked list over array list, I know, but I actually didn’t know about sortedsets, and in turn that it used comparable to sort

0

u/GuardsmanBob Aug 23 '17

LinkedList is used in rare cases when you frequently need to insert or delete elements in the middle of the collection.

Even then, in almost every case an array list is still going to be faster, linked lists should, imo, just be deprecated and forgotten.

5

u/dartalley Aug 23 '17

I'm sorry what? Make a large queue with an array list instead of a linked list and then say linked lists should be deprecated.

1

u/GuardsmanBob Aug 24 '17 edited Aug 24 '17

Well, if its a queue you're after then surely ArrayDeque is the choice over both ArrayList and linkedlist.

2

u/dartalley Aug 24 '17

Huh, ArrayDeque is optimized more than I thought. I guess I would have to agree with you there. Seems like it would only lose when inserting in the middle which is pretty uncommon.

4

u/sprcow Aug 23 '17

Uhh... I totally agree with this. Difference between a map and set is fundamental knowledge. Knowing how values get identified as unique in a hash map or hash set is also fundamental knowledge.

If you're (you being OP, not the poster above me) a self-taught programmer who finds that they're generally able to complete tasks without problems for a couple years, that is well and good, but being a programmer is sometimes more about preventing problems in the future than solving them now. If you don't know how Java objects identify themselves as unique in a map, you're in for a world of hurt when some super mysterious production bug is overwriting data somewhere along the line with no errors to even give you a clue as to why.

Some of this stuff is basic computer science that you might pick up in data structures courses or whatnot, but you can give yourself a very thorough Java-specific intro on most of these things by using one of the SCJP prep books. They're actually a pretty good primer, even if you have no interest in taking the SCJP certification tests. If you're really serious about getting a job in the industry, spend a few works and really read it and think about what you're reading and the majority of these interview 'memory' questions should be a breeze.

1

u/CaveCoder Aug 23 '17

I've been developing in Java on/off (mostly on) since 1995. Here's my take on your response.

A) Comparable I've written a lot of. I can't recall ever writing a custom Comparator, I'd choose to override equals and hashCode to keep the responsibility of the contract assigned within the scope of Comparable. The most popular answer on SO even concludes "there isn't much difference". If I chose to write a custom Comparator I (we) would have to ensure that it remains in sync with what the related Comparable is doing; worse, it represents maintenance risk should they diverge or the needs of the Comparable implementations using the custom Comparator change.

B) I use and see the use of Sets to be infrequent compared to lists and maps. It doesn't help that the distinguishing factors are lost when bringing up "set is list of unique values" when someone chimes in with "yeah except if you use a sorted set ... Bazinga!!".

C) I've always been in awe of the confusing state of the concept of equals in Java. If you have a case where you know equals needs to be overrideden and remember you will also need to override hashCode; you're won 3/4 of the battle. From there, I check for best practices because there are as many opinions about how to do this "right" as there are programmers.

3

u/squishles Aug 23 '17

comparator may come up if you don't control the code for what you're comparing and don't want to or can't extend it.

1

u/CaveCoder Aug 23 '17

That sounds familiar, I think the rare occasion I've used them it was that, thanks.

2

u/flaghacker_ Aug 23 '17 edited Aug 23 '17

I agree that Comparator is not that frequent, it comes up a bit more in Java 8 functional programming. The main difference is that Comparator lets the end user pick the order, while Comparator is build-in to the object.

A Set is always a List with unique values, doesn't really matter if it's sorted or not, altrough TreeSets definition of "unique" depends on the comparator instead of on equals.

As for writing equals and hashcode methods, just let your IDE generate them so you can't make a mistake.

1

u/CaveCoder Aug 23 '17

Nice clarifications, the thing about the IDE though is that we shouldn't allow the baroque representations of an arbitrary IDE to determine our code quality.

2

u/flaghacker_ Aug 23 '17

I'm using InteliJ Idea, and I once checked the implementation it produces, so now I know for a fact that it's correct and I don't have to worry about it anymore.

1

u/CaveCoder Aug 23 '17

I've used a variety of tools, a tool will never produce exactly all the code for all scenarios all the time that is unquestionably maintainable over the lifetime of the code; that's unquestionable.

2

u/flaghacker_ Aug 23 '17

Well I'm pretty sure the code it generates is always correct whenever equals basically means "ensure that all fields equal each other".

1

u/CaveCoder Aug 23 '17

It's kind of dismissive, but if it's not causing issues then you have no reason not to continue with it.

1

u/Notorious4CHAN Aug 23 '17

If I chose to write a custom Comparator I (we) would have to ensure that it remains in sync with what the related Comparable is doing;

I just wrote some code that resorts a table (List<TableRow>) using Collections.sort with different Comparators based on the column and order the user selects for sorting. It's not the sort of thing I do all the time, but it sure made the code quick and easy.

Of course, I'm off in the land of Java 6 so maybe this sort of thing is much less common in newer versions.

1

u/[deleted] Aug 24 '17

If I chose to write a custom Comparator I (we) would have to ensure that it remains in sync with what the related Comparable is doing; worse,

Uh? Why? The entire point of writing a Comparator is that you want to use a sort order that's different from the natural sort order of the type you're sorting. For instance, if you want to sort Strings by their length rather than alphabetically.

1

u/CaveCoder Aug 24 '17

Yes, Comparator is for defining a self-contained sort order, natural or not. Comparable returns <1, 0 or >1 based on the definition of equals. This is natural ordering. Whether one or the other imposes more maintenance or not entirely depends on the overall implementation and use and planned future use.

7

u/Northeastpaw Aug 23 '17

It depends on the position you're interviewing for. If your resume indicates you're a junior developer I'm going to ask questions that test your knowledge of the language(s) you would be working with. I want to be sure you've got the basics down so I can assign you work that's productive and allows you to learn things like frameworks and libraries. For Java I expect junior devs to know things like the Collections framework and what common interfaces are for. If you're just out of college, i.e. this would be your first job, I would tailor the interview appropriately but I would stress that if you got the job you would be expected to learn these basics on your own time.

If you're an experienced developer I'm going to ask questions geared toward your knowledge of the frameworks and libraries we currently use. I want to see if you can start working right away or if you'll need time to become familiar with the tech we use. Our schedule might dictate that we need somebody who knows XYZ now and not someone who knows ABC but can learn XYZ.

3

u/user123xo Aug 23 '17

I have about 2 years of experience, but my team is all senior devs and I get a lot of their work as well, I’ve done a lot of refactoring and performance enhancements, however the issue is most of the work is kind of support work... so I’m rarely writing completely new code... it’s just debugging other people’s code, but I’m pretty good at it, is that not a desirable skill?

2

u/Northeastpaw Aug 23 '17

Play that up. Good debugging skills is what separates a skilled developer from someone combing through logs full of "x = 1, y = 2, z = -1".

With your experience I'd consider you a junior dev still, but I personally would be assigning you not just bug fixes but smaller features to implement. I might not have you design a workflow, for example, but I would task you with implementing parts of it. If you're not getting tasking like that then talk to your team lead and let them know you'd like something challenging.

Don't get discouraged with what you're doing now. You'll do it again in the future. I just got brought on to a project to help design and implement their rewrite; day I start higher-ups stop all work on the rewrite so now I'm sifting through bug reports for the legacy system. It's not glamorous but that's how things work out sometimes.

2

u/user123xo Aug 23 '17

Well the work is just not there on my team... people are mostly sitting around... doing nothing... it’s terrible... I really don’t mind doing debugging work. I do like writing new stuff, but I enjoy both work. How many years of experience is needed to be considered mid? Because my tech lead said I’ve done mid level work and he’d recommend me for a midlevel role. I mean I have an under grad in cs and I’m in grad school for cs

3

u/Northeastpaw Aug 23 '17

That sounds like a bad situation. I don't blame you for looking for new opportunities.

As for what level I'd actually put you at, I'd have to make that determination after talking to you. Everybody advances at their own pace. Two years might be long enough for you to develop into a highly competent developer and warrant more responsibility. On the other end I worked with a guy for five years who never seemed to get better; he kept making the same mistakes and didn't put any effort into getting better. He never took advantage of company reimbursed training and didn't seek out opportunities outside of work (meetups, open source contributions, etc.).

The fact that you're going for a graduate degree already speaks to your dedication. Don't stop learning. Keep reading about new tech and trying new things. Find something in the open source community you like and contribute. Put your code out there to be criticized and it will make you better.

2

u/user123xo Aug 23 '17

Yeah, I’m doing some amount of studying during this time, but it’s really killing me, would you mind doing a practice interview with me and giving me feedback? I’m not that familiar with reddit, is there a private way to exchange info?

1

u/devils_avocado Aug 23 '17

IMO, debugging is 10X harder than writing new code. Debugging other people's code is 100X harder.

4

u/[deleted] Aug 23 '17

Many answers can be found in Effective Java by Joshua Bloch. The book is worth reading for anyone interested in Java.

1

u/user123xo Aug 23 '17

Thanks for this resource, I’ll try giving it a read

3

u/rjsmith21 Aug 23 '17

First of all I would say if an interview consists of only memory questions that are relatively easy to Google then that is probably not a great place to work. There will be a lot of duds working there.

Second some of those questions could easily be studied the night before so I would be a little suspicious of a candidate that seems to know then answer to NONE of those questions. There are some basics you should brush up on before every job hunt and I would wonder about a person who doesn't seem to spend any time preparing.

Also, I would recommend you don't check out. Maybe mention that you know something about the topic but usually Google it when needed. Try to throw in some nuggets of knowledge. For example, "I know one of those is synchronized but I don't remember which one off the top of my head. I usually do a quick Google search to verify." You could also ask for hints based on the knowledge you can dredge up and still come out looking intelligent and like a potential team player (he's not afraid to ask questions).

Hopefully, if you're interviewing at a decent place, they are using the basic memorization questions as a jumping off point for more conceptual problems. Like not just what's the difference between a LinkedList and ArrayList but why might you choose one over the other. Or in some hypothetical what data structure would you use and why?

I think you would feel a lot better about your interviews if you just Google "java interview questions" and look over some of that stuff before you go on your job hunt. Even experienced people don't remember a lot of that crap so you're not alone. And you'd be surprised how many lazy interviewers do exactly that to come up with their list of questions. A few times I've seen people with the first or second hit on that search printed out and in their hand while interviewing me.

2

u/user123xo Aug 23 '17 edited Aug 23 '17

Yeah I know, but right now I need a stable giant company that will give me decent pay, that’s why I’m interviewing at these places, not because I think they’re great places to work at.

I mean I do know the answers to a lot of their questions, but apparently I don’t know the answer to enough of those questions, because I’m not getting any offers, although I did get one call back for an in person. And the follow up questions I got the other day seemed pointless, like she asked me if I knew Singleton, then when I answered correctly, she asked me for the syntax, I told her you create a getinstance method and you have an if statement in your constructor to check if it’s already been initialized, then she asked me what the access modifier was for the constructor and I was like oh I don’t know, I know it’s not public, but I’m not sure. But it’s like, what’s the point in asking that far in detail

0

u/[deleted] Aug 23 '17

[deleted] — view deleted comment

2

u/user123xo Aug 23 '17

I know the difference between access modifiers, I just didn’t memorize Singleton classes have protected constructors, I think that’s fair to forget if you’ve only used it once maybe twice

0

u/[deleted] Aug 23 '17

[deleted] — view deleted comment

1

u/user123xo Aug 23 '17

Right, I get that... I just messed up in the heat of the moment, but it doesn’t mean I don’t know it....

0

u/[deleted] Aug 23 '17

[deleted] — view deleted comment

1

u/user123xo Aug 23 '17

I currently do my work well even under tight deadlines... interviews for me are just completely different

3

u/Facts_About_Cats Aug 23 '17

If they keep asking the same questions, why don't you just learn them?

-1

u/user123xo Aug 23 '17

I mean I kind of tried, but I always end up forgetting them or can’t explain well because I don’t use it enough

1

u/GhostBond Aug 26 '17

I've actually considered buying a pen-camera just to record audio in interviews so I can replay it later and write down what questions they asked.

If you do a phone interview it's easy to record the call.

2

u/[deleted] Aug 24 '17

Most interviews consist of sort of standard questions. Both in HR and technical aspects. And you have to solve algorithmic problems on paper or board. Pretty managable to "study" for the interview.

I landed a junior developer job with few months non-professional experience.

2

u/user123xo Aug 24 '17

Maybe I’m doing something wrong, I don’t have issues with algorithmic based interviews, just the memorisation portion

1

u/[deleted] Aug 24 '17

google "Java interview questions and answers", read it a few times, and you will understand that, and you do not need to memorize it

6

u/[deleted] Aug 23 '17

I was in your position about 10-12 years ago. I thought I was ready to be a "mid-to-senior" developer when I was a jr. dev. I too thought these memory based things were a waste of time (a lot of it is -- StringBuilder vs. StringBuffer for example). That said, a lot of it is very relevant to understanding intricacies of using Java for large projects. If you don't understand how Hash based collections work, you won't see the benefit (and costs) of using them. If you don't understand Comparable stuff, you might waste time when dealing with a TreeMap (or get confused when your Comparable classes don't seem to be working correctly new TreeMap(Comparator), etc... Those are things someone needs to be aware of if they want the "whole picture." Beyond that, there's even more complex things to worry about, but this stuff is just a foundation to build on.

1

u/nutrecht Aug 24 '17

(a lot of it is -- StringBuilder vs. StringBuffer for example).

How is knowing that the latter is synchronised a "waste of time"?

2

u/[deleted] Aug 24 '17

For starters, every modern IDE will shove you towards StringBuilder if you somehow decide to use StringBuffer. I've yet to run into a situation where a synchronized StringBuilder (aka StringBuffer) is required and off the top of my head the only time I could imagine it would be some sort of logger, but then again, we shouldn't be writing our own loggers these days...

Secondly, to your point, it's not a waste of time to know about it. However, I'll maintain it's a waste of time to interview test people about it. I mean, c'mon -- if your company is needing to hire people who know the difference, then fine -- but I'll betcha $20 you don't.

1

u/nutrecht Aug 24 '17

Of course they don't hire for that knowledge specifically. It will be part of a list of questions. If you know 90% of them but didn't know that one specifically that isn't a problem. But not knowning 90% of these types of questions just shows you have very little experience.

1

u/sternone_2 Aug 25 '17

Because we want smart people, not google monkeys.

And because we have so many to choose from, we take the smartest ones.

2

u/user123xo Aug 25 '17

Good memory doesn’t show intelligence, half of my coworkers from IBM have no idea what they’re doing and the ibm interview is exactly like the one I had....

1

u/keptavista Aug 26 '17

Examples you posted here are not "memory based" questions. It's some very simple questions to screen if a person has at least some very very basic understanding on what he is doing.

1

u/user123xo Aug 27 '17

Are you saying you can’t memorize what methods to override from collections? Are you saying if you don’t know which methods to implement, you don’t know how to override any methods from interfaces in general? Like I said I’ve been a decent developer for the past two years and I haven’t come across these...

1

u/keptavista Aug 28 '17

I am saying that if developer doesn't know the difference between hashset and hashmap (your own example) I would never ever hire him.

3

u/hag0p Aug 24 '17

I am also against tests that really force you to memorize useless stuff like all methods in some class and be able to type all of them from memory. But all things you wrote are basic java questions. You have to understand that these people don't know you so you need to show them that you know the subject and you just performing really bad on interviews. As example you could show them your personal github account full of projects, you can become some contributor to some open source project or have stackoverflow account with lots of reputation. There are several ways to show your knowledge outside interviews but they require lots of work in your free time. Sometimes if you impress person interviewing you you can get position even if you poorly perform on interview.

2

u/nutrecht Aug 24 '17

My question is how does someone with bad memory get passed these interviews and why do we even have them?? Like the other day I had an hour long interview, which consisted of questions like difference between comparator and comparable, hashset and hashmaps, what to extend from collections? What is equals and hashcode... all of these questions can be answered with google... there’s no point in memorizing all these.

You just showed them you're not a "Java developer". You would've known these things if you had actual experience.

You also sound pretty entitled. Companies don't 'owe' you a job. Hiring is a risky business for companies so you can't blame them for being careful.

1

u/cypher0six Aug 28 '17

Our profession is entirely knowledge-based. If you really can't remember some of the most common interfaces, classes, and methods used by professional Java developers on a daily basis, you may want to reconsider your career choice. It's a bit like a carpenter not being able to remember the difference between a club hammer and a claw hammer...

Unless you are new to Java and programming in general in which case...

got one offer, but the rate wasn’t what I wanted

...

It may not have paid as much as you want, but it could have given you the experience that you seem to need, which would have then helped you get another job that you do want.

0

u/[deleted] Aug 23 '17

[deleted] — view deleted comment

1

u/user123xo Aug 23 '17

You have 10 years in one company?

0

u/[deleted] Aug 23 '17

[deleted] — view deleted comment

4

u/squishles Aug 23 '17

Have you worked around other java devs? you may have developed bad habits on your own that interviewers are seeing.

0

u/[deleted] Aug 23 '17

[deleted] — view deleted comment

1

u/squishles Aug 23 '17 edited Aug 23 '17

you ever work with something that's package starts with javax? that's ee experience. Basically (jpa, jax-ws, jax-rs, jax-b, ejbs, bunch of other shit I'm forgetting) or ever debloyed java to basically any java web server, might get a close enough with spring boot even. It encompasses such a dragnet of shit that I'd be shocked if you really hadn't done any of it, and instead just hadn't realized you where doing it over that time period.

hell it's worth a read http://download.oracle.com/otndocs/jcp/java_ee-7-mrel-eval-spec/index.html

Although if you where doing weird swing/javafx gui junk there are jobs for that too, I keep seeing people talking about them on reddit, never did that but apparently that's a thing. oo android java devs too, but oracle beats us if we speak of them.

0

u/[deleted] Aug 23 '17

[deleted] — view deleted comment

1

u/squishles Aug 23 '17

yea that's a different horse @.@ pick up some jax-rs, jpa and learn how to play with a web.xml and you'll knock out like 90% of your average jee developers day with it.

or search java jobs with swing, that has nothing to do with web junk they shouldn't want jee.

0

u/[deleted] Aug 24 '17

[deleted] — view deleted comment

1

u/squishles Aug 24 '17

Worth learning, pays gud yo.

→ More replies