Working through Advent of Code in a language I'm learning.
This seems cool I was trying to learn C++ using Topcoder archived problems which became a double whammy of reviewing algorithms plus learning new syntax. The adventofcode might be an easier introduction to the language as I solved a knapsack problem on Topcoder then continued to solve it recursively, with memoization, upper and lower boundaries and then gave up trying to work out the bit shift method. i.e. it went from a quick "I can do this in 10 minutes" to an hour or more of review, optimisations and standard library function lookups.
Wow good thing I did some of these tiny problems, I was kind of under the assumption that C++ had access to relatively simple functions like min() and max() of a number of elements or a tokenizer but it is limited like C yet at the same time provides some very powerful tools to allow optimal custom solutions.
I used the max command in my prior knapsack function as part of a more complex algorithm without checking the limitations, assuming it would work like Java rather than C.
Literally spent almost 2 to 3 hours trying to get my head around how to use hashsets and hashmaps for specialised types. Error messages from the compilers are almost unreadable and too verbose. The documentation sucks ass on most sites. I was very close to just switching to Visual Studio hoping to get better error messages.
Hashsets and Hashmaps are truly terribly described in C++ for how easy they actually are to use.
The 20 lines of error messages you get for missing a "const" is almost impossible to follow if you're learning it for the first time and expect it to be as easy as what you encounter in Java, Python or your own implementation in any language due to just appropriate documentation and / or compiler errors.
I'll probably switch to coding in Visual C++ if this happens again and change language there is genuinely poor documentation and compiler errors.
I'll probably switch to coding in Visual C++ if this happens again and change language there is genuinely poor documentation and compiler errors.
Just so you're aware there are coding practices that are valid in most compilers that will not compile in Visual C++. It's kinda like a weird MS subset.
If you think const related errors are weird, wait until you try debugging your template metaprogramming bugs.
From what I understand template metaprogramming wasn't the target intention of C++ standardisation, just an efficiency bonus if you want to dive in. However my issue was with a standard library data structure which I assumed (incorrectly) would have appropriate error messages across all compilers.
I'll probably switch to coding in Visual C++ if this happens again and change language there is genuinely poor documentation and compiler errors.
Just so you're aware there are coding practices that are valid in most compilers that will not compile in Visual C++. It's kinda like a weird MS subset.
Yeah I noticed this but the majority of the syntax is fairly similar and as I've only been using C++ for 2 weeks or so it shouldn't be too much of an issue (hopefully).
C++ can do very interesting things in far too many different ways, since C++ has three separate Turing-complete languages bundled together: C++ itself, the template metaprogramming language, and the compiler preprocessing language.
C++ can do very interesting things in far too many different ways, since C++ has three separate Turing-complete languages bundled together: C++ itself, the template metaprogramming language, and the compiler preprocessing language.
Yeah, just want I want to do. Write entire programs using only the preprocessor.
Hmm, from what I've seen and when I've talked to developers C++ seemed to be quite dominant amongst firms and big companies (or if they are web they seem to want at least Javascript).
Advice required: If you were to recommend a final year CS student to become very competent in a particular language to get a developer position would it be one of either C++ or Java or something else?
(I understand all languages have a purpose which is why I am trying to have competency in many and speciality in one, for example I am mediocre in C, Java, Python, C#, learning C++ at the moment, mediocre meaning I could and have in most cases written data structures up to the complexity of a red black tree and most common algorithms in them).
I would put an entire year into the learning and using that language for all tasks possible (both University, competitions and writing random stuff) except possibly the web design / coding.
I don't even know if this is a good idea or not but feel as if it would be helpful.
Learn whatever you want. I will just say that it's pretty easy to follow Python code or Java/C# code for interviews. But I learned JS at my previous job and am getting more into C++ at my current job. You'll have to learn new languages almost guaranteed. Like no one is really using Scala outside of production code.
Most languages are pretty easy to pick up and do some stuff right away. The other part of that is figuring out the nuances of that language. Usually that just takes time and is easier when you have someone sort of mentoring you.
I do a fair amount of interviewing for my team, and I will say that without a doubt, the people who code in either Java or C# have the easiest time of it. A lot of questions are really hard to do in C++ without having a firm knowledge of the standard library, which, for some reason, most candidates who choose to use it do not. In general, my answer is always to do Java because it seems to be the most well-known language, even if not the most used. Even if someone doesn't know Java, it is close enough to the other C-derivatives that they can read it.
However, this comes with a caveat. If you actually intend to make something with the language you want to learn, Java is really only a good choice if you're going to be making a server application. That is where Java is king. If you want to make a desktop application, you should go either C++ or C#.
EDIT: And as many people on this forum have said in one way or another, you are likely going to be learning a lot of languages over the course of your career, so it doesn't really matter where you start. Very few people are true experts in any given language, so don't sweat not going deep when going wide is just as good, if not better.
For purposes of getting a job, Java because virtually everyone who could possibly interview can understand Java and accurately assess your code. If you have a job, it doesn't matter and you learn by doing.
Thanks for all the great recommendations. I will try to get all the nuances of Java worked out and competent to the point where I can work out most problems even on an off day. I'll write a few Android apps (the xml is harder than the Java in my limited experience) and web apps for side projects.
I do a fair amount of interviewing for my team, and I will say that without a doubt, the people who code in either Java or C# have the easiest time of it. A lot of questions are really hard to do in C++ without having a firm knowledge of the standard library, which, for some reason, most candidates who choose to use it do not. In general, my answer is always to do Java because it seems to be the most well-known language, even if not the most used. Even if someone doesn't know Java, it is close enough to the other C-derivatives that they can read it.
I have recognised in my C++ adventures, things that should be fairly easily performed using most standard libraries is poorly documented or Stack Overflow answers tend to go with "use this external library". When you finally get to see how to use the STL it is very efficient so I can see how answers could be fumbled.
I do a fair amount of interviewing for my team, and I will say that without a doubt, the people who code in either Java or C# have the easiest time of it. A lot of questions are really hard to do in C++ without having a firm knowledge of the standard library, which, for some reason, most candidates who choose to use it do not. In general, my answer is always to do Java because it seems to be the most well-known language, even if not the most used. Even if someone doesn't know Java, it is close enough to the other C-derivatives that they can read it.
I have recognised in my C++ adventures, things that should be fairly easily performed using most standard libraries is poorly documented or Stack Overflow answers tend to go with "use this external library". When you finally get to see how to use the STL it is very efficient so I can see how answers could be fumbled.
I wasn't very clear with my previous statement. What I meant was, candidates who choose to use C++ as their interview language don't seem to know any of the STL or think they can't use it, so they end up doing everything the hard way. Candidates who use Java or C# or Python tend to be more comfortable using the built-in data structures and iterators. I also don't think I've ever seen a candidate use C++11 or C++14 features in an interview. Not sure if it's because they're not aware of their existence or their current companies are slow to adopt.
As an aside, a couple helpful tips for people are going in for interviews. One, unless the interviewer says otherwise, using standard library stuff is totally fine. Getting the problem correct is usually more important than doing it efficiently. A good interviewer will ask you to either make it more efficient or discuss how you can do so. Two, if you don't know if a certain function or class exists in the standard library, just write it out anyway and explain to the interviewer that you assume there is such a function or class and what it is supposed to do. Once you get to the end of the problem, you can then ask if you should implement that function or class just in case it's not in the standard library.
Let's say someone is giving you a programming test. They tell you to sort a bunch of integers from a database.
In the real world in Python I would do this:
import db_api
data = db_api.query(query_for_the_numbers) print data.sort()
Most real world development these days is importing client APIs and libraries, then using them and tying them together. Especially in the web department.
But since it is a programming test, are you really going to write that 3-liner? It's somewhat implied they actually want you to write a sorting algorithm of some sort, not just call the sort function. And that's one of the reasons that even people who know STL, aren't going to use it.
I don't really believe in giving people programming tests when hiring. It's obvious just from talking to someone whether they know what they are doing. But if I am going to test someone I'll say something like "Code like it's the real world, not like it's a college exam." Then you'll see some good stuff.
I did some hiring at the previous company I was at. Although I don't really like the typical topcoder-esque 'write me code to solve this algorithms/data structures' question, I do think programming tests have a place and can be really useful.
My favourite was basically a coding comprehension test. We gave them a shitty bug-ridden function (all fairly standard things - off by ones, missing else clauses, character encoding fuckups... ), and they had to find and fix them all.
The ones who were the most confident when faced with actual code tended to be the strongest hires.
I was once interviewing for a position where, due to my resume, the interviewer assumed I was a developer with a CS degree. (The reason being my title/role at IBM was technically "Software Engineer" even though I mostly did IT for them).
So the guy starts asking me to demonstrate a bunch of sorting algos and talk about their relative merits/performance. I tell him I've never formally studied computer science.
There is a long pause.
Then he puts a data set on the whiteboard and basically asks me to derive various sorting algorithms by asking me pure logic questions about the set. I actually learned a lot that day just by answering those questions, since I've literally never formally studied anything of the sort.
The initial purpose of the questions was, in his words, to quickly figure out if I actually paid attention at all in formal compsci. He would have cut me off if I'd shown even basic recollection of that stuff. So instead, he just used the questions to see if I possessed basic human intelligence.
I generally agree that coding problems are not a great way of determine if a candidate is worthwhile, but I don't really have a choice in the matter since I don't make the rules.
And Scott's example is why I don't ask problems that are as simple as implement a known algorithm or STL function. Most of the questions I ask involve some kind of string manipulation for which there are no standard solutions (unless you are really good at regex). I also prefer interviews where I get to ask about program design rather than code, since that usually tells a lot more about skill. Even so, simple coding questions are surprisingly good at weeding out people who claim to be developers but really aren't.
it's really sad if someone claims to be a developer, but isn't, gets past the phone interview and makes it to the in-person interview. That's why I'm anti-FizzBuzz. You should be good enough that you don't let someone who would fail a FizzBuzz even walk into your office. Making someone who passed your phone filter take a quiz is insulting. If you ask me to do that shit I'll show you my New York finger.
it's really sad if someone claims to be a developer, but isn't, gets past the phone interview and makes it to the in-person interview. That's why I'm anti-FizzBuzz. You should be good enough that you don't let someone who would fail a FizzBuzz even walk into your office. Making someone who passed your phone filter take a quiz is insulting. If you ask me to do that shit I'll show you my New York finger.
I was mostly referring to phone screens. I haven't had an in-person interview with someone who wasn't at least decent at coding.
it's really sad if someone claims to be a developer, but isn't, gets past the phone interview and makes it to the in-person interview. That's why I'm anti-FizzBuzz. You should be good enough that you don't let someone who would fail a FizzBuzz even walk into your office. Making someone who passed your phone filter take a quiz is insulting. If you ask me to do that shit I'll show you my New York finger.
I was mostly referring to phone screens. I haven't had an in-person interview with someone who wasn't at least decent at coding.
Wow, how do you give someone that kind of technical quiz over the phone? Usually just have discussions with people, and it becomes pretty easy to judge whether they know what they are talking about without asking some kind of formal technical question.
I too am a bit puzzled by the algorithm live coding portion of interviews.
Sitting an interview where I had to fix buggy code makes a little more sense and should be natural. I guess since a these types of interviews are a part of the industry I have to know them or be comfortable in doing them till I get enough experience to the point where I get jobs without proving how to do the basics.
So far my weirdest interview has been for a consulting firm Deloitte where we did these silly group problems while being observed by 2 people in their 20s who were being relied upon to work out if you were doing the right amount of active listening. After which they had a 1 on 1 interview.
I got to the stage of 3 people and found it hard to not laugh when they phoned me and told me my active listening wasn't up to par as this skill is 25 - 30% of a consult and I had been doing 20 - 30 consults a day for 7 years prior. Also there was no check on CS or IT knowledge for an IT position, I was the only one who turned up with any knowledge in the area the others were doing accounting, non IT engineering.
I also worked out real quick that my interviewers did not know anything beyond having some awareness of consumer technology. How do they even pretend to give technical recommendations to client companies? I'd rather not work at a company like that.
Comments
EDIT: I also just fixed my Twitter issue. Long story short, I'm an idiot.
The adventofcode might be an easier introduction to the language as I solved a knapsack problem on Topcoder then continued to solve it recursively, with memoization, upper and lower boundaries and then gave up trying to work out the bit shift method. i.e. it went from a quick "I can do this in 10 minutes" to an hour or more of review, optimisations and standard library function lookups.
I used the max command in my prior knapsack function as part of a more complex algorithm without checking the limitations, assuming it would work like Java rather than C.
Error messages from the compilers are almost unreadable and too verbose. The documentation sucks ass on most sites. I was very close to just switching to Visual Studio hoping to get better error messages.
Hashsets and Hashmaps are truly terribly described in C++ for how easy they actually are to use.
The 20 lines of error messages you get for missing a "const" is almost impossible to follow if you're learning it for the first time and expect it to be as easy as what you encounter in Java, Python or your own implementation in any language due to just appropriate documentation and / or compiler errors.
I'll probably switch to coding in Visual C++ if this happens again and change language there is genuinely poor documentation and compiler errors.
Advice required:
If you were to recommend a final year CS student to become very competent in a particular language to get a developer position would it be one of either C++ or Java or something else?
(I understand all languages have a purpose which is why I am trying to have competency in many and speciality in one, for example I am mediocre in C, Java, Python, C#, learning C++ at the moment, mediocre meaning I could and have in most cases written data structures up to the complexity of a red black tree and most common algorithms in them).
I would put an entire year into the learning and using that language for all tasks possible (both University, competitions and writing random stuff) except possibly the web design / coding.
I don't even know if this is a good idea or not but feel as if it would be helpful.
Make something cool. Maybe a web app. Maybe an arduino robot. Maybe stockfighter. Invent a toy programming language. Something fun for you.
Most languages are pretty easy to pick up and do some stuff right away. The other part of that is figuring out the nuances of that language. Usually that just takes time and is easier when you have someone sort of mentoring you.
However, this comes with a caveat. If you actually intend to make something with the language you want to learn, Java is really only a good choice if you're going to be making a server application. That is where Java is king. If you want to make a desktop application, you should go either C++ or C#.
EDIT: And as many people on this forum have said in one way or another, you are likely going to be learning a lot of languages over the course of your career, so it doesn't really matter where you start. Very few people are true experts in any given language, so don't sweat not going deep when going wide is just as good, if not better.
If you have a job, it doesn't matter and you learn by doing.
I will try to get all the nuances of Java worked out and competent to the point where I can work out most problems even on an off day. I'll write a few Android apps (the xml is harder than the Java in my limited experience) and web apps for side projects. I have recognised in my C++ adventures, things that should be fairly easily performed using most standard libraries is poorly documented or Stack Overflow answers tend to go with "use this external library". When you finally get to see how to use the STL it is very efficient so I can see how answers could be fumbled.
As an aside, a couple helpful tips for people are going in for interviews. One, unless the interviewer says otherwise, using standard library stuff is totally fine. Getting the problem correct is usually more important than doing it efficiently. A good interviewer will ask you to either make it more efficient or discuss how you can do so. Two, if you don't know if a certain function or class exists in the standard library, just write it out anyway and explain to the interviewer that you assume there is such a function or class and what it is supposed to do. Once you get to the end of the problem, you can then ask if you should implement that function or class just in case it's not in the standard library.
In the real world in Python I would do this:
import db_api
data = db_api.query(query_for_the_numbers)
print data.sort()
Most real world development these days is importing client APIs and libraries, then using them and tying them together. Especially in the web department.
But since it is a programming test, are you really going to write that 3-liner? It's somewhat implied they actually want you to write a sorting algorithm of some sort, not just call the sort function. And that's one of the reasons that even people who know STL, aren't going to use it.
I don't really believe in giving people programming tests when hiring. It's obvious just from talking to someone whether they know what they are doing. But if I am going to test someone I'll say something like "Code like it's the real world, not like it's a college exam." Then you'll see some good stuff.
My favourite was basically a coding comprehension test. We gave them a shitty bug-ridden function (all fairly standard things - off by ones, missing else clauses, character encoding fuckups... ), and they had to find and fix them all.
The ones who were the most confident when faced with actual code tended to be the strongest hires.
So the guy starts asking me to demonstrate a bunch of sorting algos and talk about their relative merits/performance. I tell him I've never formally studied computer science.
There is a long pause.
Then he puts a data set on the whiteboard and basically asks me to derive various sorting algorithms by asking me pure logic questions about the set. I actually learned a lot that day just by answering those questions, since I've literally never formally studied anything of the sort.
The initial purpose of the questions was, in his words, to quickly figure out if I actually paid attention at all in formal compsci. He would have cut me off if I'd shown even basic recollection of that stuff. So instead, he just used the questions to see if I possessed basic human intelligence.
And Scott's example is why I don't ask problems that are as simple as implement a known algorithm or STL function. Most of the questions I ask involve some kind of string manipulation for which there are no standard solutions (unless you are really good at regex). I also prefer interviews where I get to ask about program design rather than code, since that usually tells a lot more about skill. Even so, simple coding questions are surprisingly good at weeding out people who claim to be developers but really aren't.
Sitting an interview where I had to fix buggy code makes a little more sense and should be natural.
I guess since a these types of interviews are a part of the industry I have to know them or be comfortable in doing them till I get enough experience to the point where I get jobs without proving how to do the basics.
So far my weirdest interview has been for a consulting firm Deloitte where we did these silly group problems while being observed by 2 people in their 20s who were being relied upon to work out if you were doing the right amount of active listening. After which they had a 1 on 1 interview.
I got to the stage of 3 people and found it hard to not laugh when they phoned me and told me my active listening wasn't up to par as this skill is 25 - 30% of a consult and I had been doing 20 - 30 consults a day for 7 years prior. Also there was no check on CS or IT knowledge for an IT position, I was the only one who turned up with any knowledge in the area the others were doing accounting, non IT engineering.
I also worked out real quick that my interviewers did not know anything beyond having some awareness of consumer technology. How do they even pretend to give technical recommendations to client companies? I'd rather not work at a company like that.