5 ms·
If this article is targeted at people with no experience (ie it mentions learning how to use IRC), is recommending that they fix bugs in C++ code really the rig
by asolove 16y ago
If this article is targeted at people with no experience (ie it mentions learning how to use IRC), is recommending that they fix bugs in C++ code really the right answer?
Why not start with a Python project or something more realistic?
- strlen 16y agoLearn the difficult fundamentals of programming first (pointers, data structures) first. Experience with C/C++ and user-level systems programming (IPC, pthreads, BSD sockets and/or their Windows equivalents) makes you stand out amongst job applicants; writing database driven web applications in scripting languages does not. If latter is ultimately your passion, you'll have no trouble transitioning: successful web companies seek out developers who understand more than a thin segment of the full stack (see Brad Fitzpatrick's interview in Coders at Work for a good discussion of this). I suspect there are also plenty of bugs in Chromium et al which require non-trivial scripting to find and fix (who does exclusively manual testing any more?)
- mechanical_fish 16y agoExactly. Do you want to force the interviewer to spend 45 minutes trying to divine, unreliably, if you know what a pointer is, and that you won't go into the fetal position when you see your first segfault? Or do you just want to email some links to the online discussion of your patches in advance and spend the interview talking about something else?
- strlen 16y agoNot to mention Python, Java, etc... still have pointers and memory leaks (at least in Java, everything is pass by value, but with the exception of the primitives, every value is a pointer). They will also suffer memory pressure when you allocate objects without thinking (which is rather easy to do if you never had to think about what the runtime does when you say "obj = Foo(bar)"). I'm not a C/C++ bigot, my "favourite language" is currently a three-way tie between Scala, OCaml and Lisp. Plenty of real programming gets done in other languages (plenty of people also think that C is the secret sauce for performance, but that's not the case), but C is important for two reasons: it's the lingua franca of programming and it's a great language for learning how computers work. Pascal may have been another option twenty years ago, but there are hardly any interesting open source projects being done in it today.
- jrockway 16y agoJava is pass-by-reference. Pass in object foo, call smash_with_hammer on foo in the called function, and the caller finds that his foo was smashed by a hammer when control returns to him. You might not have noticed this because, as a Scala, Lisp and OCaml programmer, you don't let your objects smash themselves with hammers :) (Though it is hard to avoid in Java; seems like everything useful takes a StringBuffer instead of a String. Java -- the high-level language with about as much abstraction as assembly.)
- aaronblohowiak 16y agoYou missed the part in strlen's comment where strlen says that every non-primitive value is a pointer. This also explains the behavior that you describe, with the caller's version of a variable being modified by a callee. However, this is different than pass-by-reference. With pass-by-reference, if i assign a new value to the callee argument variable, that value also replaces the value in the caller. This is not true in java/python/ruby where it is termed "call by sharing" http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sha...
- strlen 16y ago> Java is pass-by-reference. Pass in object foo, call smash_with_hammer on foo in the called function, and the caller finds that his foo was smashed by a hammer when control returns to him In agreement here, the state of the object changes according to a message passed to the object. In this case, the value we passed is a pointer to the object. We can't, however, change what object the pointer points to in Java, which is why I call it "pass by value". E.g., I can't do equiv of this Perl code. sub bar { my $foo = Foo->new(a => "a"); foo(\$foo); } sub foo { my $arg = shift; $$arg = Foo->new(a => "b"); } On the other hand, in Perl even though I am passing a reference by value, I can still mutate the state of the object: sub bar { my $foo = Foo->new(a => "a"); bar($foo); } sub foo { my $foo = shift; $foo->set_a("b"); } (Please excuse my Perl, I haven't written OO Perl in over a year now). In any case, I think this is a pedantic point. Both of us agree that other than in few cases (algorithms/data structures that are difficult to express in a functional way), objects shouldn't be smashed by hammers: whether internal or external. I also don't understand why Java's standard library authors didn't do what Scala did and provide both mutable and immutable versions of collections. Java 5+ added great lock free data, concurrent data structures, but much like they have a ConcurrentMap, they could have added a "ImmutableMap"/"ImmutableList" interfaces (especially given the fact that some data structures e.g., CopyOnWriteArrayList behave like this internally). I really like Scala's "functional objects": objects that upon receiving a messages, create new objects. In Java, an object may be final, but it will still (as you put it) "be smashed by a hammer" as long as the hammer smashing was invoked by a message. Same thing happens in C++ with const methods, in objects passed as const& references which contain objects that mutate their state upon a message being passed. Rich Hickey discusses this much better than I do in his famous talk: http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey http://www.infoq.com/presentations/Value-Identity-State-Rich... (although I may not agree with all of his conclusions) > seems like everything useful takes a StringBuffer instead of a String That's a textbook example of premature optimization :-) The compiler will convert string concatenation to StringBuilder. See: https://gist.github.com/670577 https://gist.github.com/670577 It does makes sense to use a StringBuilder when you are doing concatenation inside a loop (and don't want the overhead of allocating a new StringBuilder inside), but otherwise there's no advantage to it. (Oddly enough, in this example the default optimization level did not unroll the loop itself. OCaml, on the other hand, despite having a much more compiler-friendly type system than Java, doesn't perform the equivalent optimization on string concatenations with the '^' operator. I am pretty sure g++ will do both, despite C++ being lower-level and having weaker typing than OCaml and Java). For another example of this kind of premature optimization, see people using inline in C++ code when the gcc/clang will have a much better idea than the developer on when to inline a function call and when not to :-)
- jrockway 16y agoI disagree. Work on what you're interested in. If you're an expert on data structures but can't write programs, you're useless. If you can write programs but don't know data structures, you can pick up a textbook and solve that problem in a week. Now, in my current position, I wouldn't hire someone that didn't have a solid understanding of data structures already (unless they were an intern)... but at other places I've worked, I would hire you in a second. The thing that will make you stand out in an interview is a proven track record of writing software. Other stuff can be fixed later. (A lot of people that work as "software engineers" cannot write or engineer software. They kind of open up the Eclipse project, click shit, write status reports, and call it a day. This is what I want to filter out in an interview.)
- strlen 16y ago> If you're an expert on data structures but can't write programs, you're useless. I agree here, which is why the author of the original post suggest contributing to open source projectors. The projects that he suggests require getting more than a surface knowledge of how data structures are implemented. There are certainly programming jobs that don't require knowing data structures, but if you're a good programmer and you understand data structures and algorithm, the total pool of jobs open to you is much higher (and you're much less immune to being treated as a commodity, although in my experience that has more to do with the company and the industry rather than specific work). But overall, seeing the software a candidate has contributed to (fixing bugs, implementing new features, starting new projects) is a much more reliable indicator than whether they can white board an algorithm to detect a loop in a linked list without using any additional storage. You can minimize false positives and false negatives, but you're going to get them.
- aboodman 16y agoI specifically chose Chromium (or another browser) because it is one of the few pieces of open source software that normal people would have direct experience using. Seeing your fixes shipped to you and your friends' browsers is an awesome motivational tool. It's true that it's harder, but it seemed like a reasonable trade-off. My main concern with picking a browser wasn't the difficulty it was the expense of having a good machine to work with. Sadly this applies to all browsers that I'm aware of. Building Mozilla is terrible. WebKit is probably the best; it just contains less code (you only build the rendering engine when you work on WebKit, not the browser).
- swombat 16y agoGranted, but the learning curve to pick up all that's required to becoming an active committer to the Chrome codebase (command line, VCS, UI programming, OOP, Pointers, C++, and so on) is more like a vertical cliff than a curve. Out of 1000 non-CS people who try to do this I'd be surprised if even 10 make it through to compiling the Chrome source, and I'll be stunned if even 1 makes it through to the end of your "5-step plan". It's a noble aim, and the idea in general is right (learn to program and contribute to open-source software) (though I can't quite agree with considering their education a "sunk cost" - you need to build on what you have or you'll always be disadvantaged), but there are better, easier ways to achieve that objective than going straight from "I've never seen water in my life" to jumping into a pool infested with shark, mutant piranhas and man-eating giant squids.
- dmethvin 16y ago> I'd be surprised if even 10 make it through to compiling the Chrome source, and I'll be stunned if even 1 makes it through to the end Isn't that part of his goal, though? It's great to find people who are that passionate about the work. Somewhere out there a developer is drooling to work on a browser project and would be in heaven if they could prove themselves good enough to make the team.
- swombat 16y agoI'd argue that in this case, he's not helping them (the 1000) to get a job, he's helping himself (the Chrome developer) to get an extra committer or two.
- guelo 16y agoC++ isn't that hard, I got a pretty good hang of it after a couple months on my first project out of college. Why is a Python project "more realistic"? the learning curve is probably similar.
- jordanlev 16y agoMemory management. I think this makes it about twice as difficult to get up and running in c++. Not saying it's better or worse or going to make you a better programmer or not, but I don't think anyone could argue that it's easier to learn C++ than python/ruby/php/etc. Also see: http://www.joelonsoftware.com/articles/fog0000000006.html http://www.joelonsoftware.com/articles/fog0000000006.html
- guelo 16y agoTwice as difficult? Not likely. There are 14 year old kids making million dollar apps using Objective C and managing the memory. It's not that hard, you just have to learn a few rules. I'm not saying you'll be an expert but you should be able to start fixing simple bugs in an open source C++ project within a month unless you were born without that part of the brain, as Joel says.
- Jabbles 16y agoI think you have an unrealistic view of 14 year olds. Just because 1 in 100,000,000 can do this does not mean C++ is as good a language for a beginner as Python.
- jrockway 16y agoI'm going to agree here. C++ is the first language I really did anything with (a sierpinski-trinagle generator for KDE, when I was in 7th grade) and simply didn't understand, at the time, what the memory-related issues were. I allocated stuff, and it worked. I returned pointers to the stack, and the code worked. Sometimes I got segfaults, but if I changed the code a bit, they went away. This is not the sort of understanding you want people you're paying to write software to have. (And yes, I do see this from time to time. "Do you know anything about programming!?" "Yes, just enough to be dangerous.")
- Tycho 16y agoMy friend is quite impressive at the guitar despite never having lessons. He says the day he went from beginner/average to pretty damn good was when he decided to learn a Hendrix part way beyond his then skill level.
- jrockway 16y agoThis would be a great story if the ending was, "read a music theory textbook and proceeded to mint his first Platinum album" :)