298 points · by ekosz · 14y ago · 195 comments
1. There are people who are so much better at programming than me, that I could work my entire life and never be as good as they are right now.
2. There are people who are so much worse at programming than me, that they could work their entire lives and never be as good as I am right now.
Its a continuum, a hill. Feel the gradient, walk uphill.
This isn't about race or gender or whatever - just innate difference between individuals.
Define intelligence.
But in fact, I believe with enough time you can get used to any level complexity and find your way through it. It is a bit like a big city: however complex it is (intertwined roads, subways, highways, etc.), if you live there long enough, you will get a precise mental model. Same with software projects: after some time, abstraction will not be those foreign short lived unstable concretions that you hold in your head and that vanish away if someone says hello. They will be good old friends and the sole invocation of their name will instantly call a lot of solid knowledge to the bar.
So in this line, I'd say clever guys are just faster and more agile (maybe both are the same thing). Above a certain level of tolerance to abstract thinking, anyone can understand and work on big complex projects, given enough time.
There is another difference between good and great developers, though. It is the "best path-finding skill". For instance, given enough time, I would probably be able to write a Python script solving most sudokus, but I fear I wouldn't find as elegant and straightforward a path as Norvig's. http://norvig.com/sudoku.html
Nobody can beat Chrissie Wellington. Nobody.
I don't think of it that way, at all.
Even if you are only moderately good, you'll have a unique combination of knowledge that allows you to see things that others can't, and that will enable you to do amazing things.
Of course you should always try to improve. But consider where you invest your time. If you know X well, and most people that know X well also know Y well; then maybe you should learn Z instead of Y. Don't always choose Z -- maybe X and Y are complementary and so it may make more sense to learn Y than Z -- but if you follow someone else's curriculum exactly, you will only be re-discovering what they already know.
As an aside, why do we beat ourselves up so much over this sh*t? We're the most self deprecating group of professionals I've ever met..
I can fluctuate between thinking I am a fairly competent developer to thinking that I am possibly the worst programmer there is. I'm not sure which is a better attitude to have, hopefully I am somewhere in the middle.
I think the issue with reading some of the discussion on HN is that you get people talking in detail about things like functional programming languages , systems with huge scalability , hardcore math problems and the finer points of memory management in the Linux kernel that you feel it is obvious that you should understand this stuff.
I have been trying to do some more book reading to improve, of course the issue is that whenever you read any book recommendation threads of HN there is always at least 30 or so recommendations of some pretty thick books and no chance I'd have time to read them all.
There is also a difference between having deep knowledge of the tools and libraries that you are using right now and having a deeper understanding of theory for example learning git vs learning graph theory etc.
I can't say with any degree of authority, but based on what I've read of his code, I'd guess he's self-taught.
My bigoted preconception is that when it comes to abstraction in code, people with CS degrees err on the side of doing too much, creating extremely elaborate object frameworks that close down options as much as they help reuse code. Self-taught folks, on the other hand, err on the side of doing too little, relying on cut and paste, util packages, and promiscuous sharing of data.
When it comes to algorithm design, people with CS degrees tend to pull in libraries of esoteric things, sometimes overengineered for the purpose at hand. Self-taught folks tend to write something from scratch that almost, but not quite, does the job right.
Based on what I've read from decompiled Minecraft, I'd guess Notch is self-taught. The abstraction is just barely enough to get the job done, and the algorithms are decidedly homebrew. That's neither praise nor criticism, just a comment on style.
Also the marking scheme will tend to favour a broken solution that is an attempt at an elegant abstraction rather than a more basic abstraction that is well tested and works.
There is a certain danger in being educated, for example a self educated programmer might have a problem and just implement a O(n^2) solution and move on whereas a college educated programmer might spend excessive time trying to work out a way to do it in O(log N).
Maybe my CS degree was unique (I don't think it was), but at the 400 level we had specialization choices including security, graphics, web development, databases, operating systems, embedded, software engineering, etc.
> A project that is done in the average CS class will be presented as a way to teach a design pattern rather than teaching how to solve a problem.
Design patterns != algorithms. My professors actually spent precious little time teaching me how to program, most of that was self-taught. What they taught me to do was how to solve problems, and that education has been very useful.
If your CS professors are spending most of their time teaching you design patterns, you should ask for a refund. The only CS class that taught me design patterns was my 400-level software engineering course.
The CS graduate will have covered big O classifications but if they immediately focus on this form of optimization it's probably because they have spent years reading blogs that tell them this is the nature of tests at places like Google.
If every CS grad automatically thought this way by virtue of their education there would be no reason to test for it in interviews simply because a CS degree is often a minimum requirement for the kind of job where you'll be asked these questions.
It's only a priority if you make it one and those self-taught guys can probably self-teach themselves big O.
A programmer today has a wealth of information they can pull from that does not require a single ounce of formal education. It takes dedication to the craft not bucket loads of money.
Well, I would have called you on this, but I guess I don't have to.
> The abstraction is just barely enough to get the job done [...]
Or, in other words, the perfect amount...
> Or, in other words, the perfect amount...
Well no, because the job doesn't end when it's "done". Minecraft is the perfect example:
In the earliest versions of the game, blocks were all basically homogenous cubes of some material, so they didn't need to be oriented. Later, blocks were added that did need to be rotated in various ways, e.g. torches, stairs. But each of these blocks had their own private system for choosing, storing, and rendering their orientation. These systems were often similar, but not identical. At this point, roughly half the blocks in the game are orientable in some way and there is still no generic orientation system. Such a system would have avoided massive amounts of redundant code, prevented many bugs, made the user experience more consistent, and made various 3rd party tools much easier to develop.
"You ain't gonna need it" is a cop-out. You are going to need some things. The trick is anticipating which things, and it will definitely pay off if you can guess correctly.
Philosophically, I agree. I view premature abstraction in the same light as premature optimization. I believe both abstraction and optimization are incarnations of your understanding of the problem. You want them in important places, not necessarily everywhere, and hence you want them late enough in the engineering process that you understand which places are important.
That said, within the comfort zone, there are high and low levels of abstraction. For example, in a project the size of Minecraft, I would expect CS major code to contain an ObjectFactoryFacadeCollection or two. Minecraft has nothing of the sort. It sticks almost exclusively to the Mob::HostileMob::Zombie inheritance we all grew up with. This is not bad or good[1], it's simply a reflection of the low-abstraction style of attacking problems that I associate with self-taught programmers.
On the other hand, its Magic Number to Constant ratio is downright scandalous . . . ;) Though it's possible that some of that is an artifact of the compilation/decompilation process.
[1] I'm lying, in this case it's a good thing.
> Or, in other words, the perfect amount...
... until your first hire
Abstractions reduce potential bugs by reducing the 'interaction-space' of a particular entity in your code. Think about a program that has 100 variables all in one function. That is potentially 100! interactions between entities in your code. When you make a change, you have to reason about all 100! interactions to be sure you're not introducing a new bug.
Abstracts greatly reduce this space. If instead you have 10 objects who each contain 10 variables, within the object you have 10! interactions to reason about. In the main function that ties each object together you now have 10! interactions to reason about. This is many many orders of magnitude easier than the original problem.
The more (natural) abstractions, the better your code.
How can you tell from decompiled optimized code? Not saying you can't, just interested. Haven't read much decompiled.
About a year later, we met again. I still didn't know him, but he sure felt that he knew me. I remember he greeted me with, "I love your sense of humor", and "If you really want to know someone, you should work on their code for a year." No doubt he knew me as a programmer much better than I know myself.
Talk to someone who's maintained your code. :)
If your work does not do reviews now, you can still ask a co-worker to look over you code changes. Many people would be flattered that you would ask for their programming wisdom. ;)
Wow.. actually your comment is EXTREMELY critical and very dishonest in the end claiming that its not a criticism.
I'm just curious, what software have you written, and how many millions of users does it have?
The two are not mutually exclusive.
I was talking with a friend recently who's working on her Ph.D, observing that everyone who thought I was so smart in college is now better educated, officially, than me. She was like "You're basically self-taught, but with a piece of paper that says you were willing to stick around in college for 4 years. Even in college you were self-taught."
One of my teammates at work recently said I should become a professor. I was like "Don't I need a Ph.D for that?" All my other teammates were like "Naw, man, visiting lecturer!"
If you're actually self-taught, you can treat formal education options as a menu that you might or might not choose to sample, depending on your goals at the moment. You don't have to define yourself as one or the other.
There were people who were self taught , either before they started CS or once they learned some programming at university they identified other areas outside the course that interested them and they could apply their new programming skills.
These people typically got jobs in the software industry after graduation and become software developers.
The other group of people were people who were just generally high achievers and learned enough programming to pass the course with good marks but nothing much else. They got equally high marks because they were good at passing exams.
Most of them either retrained for a career in finance , went into academia or got management gigs at tech consultancy companies.
I can't think of anybody I know who is a working programmer who is not self taught to at least some degree.
I don't understand how this makes sense, unless being "good at passing exams" means "cheating". Can anybody explain? I hear this said so often, and I usually chalk it up to the speaker rationalizing his own poor scores.
My CS exams were always hard, and the only way to "get good" at passing them was to learn the material.
My current solution to the problem of overwhelming interests is starting grad school in CS; by going through a program, I am forced to focus on certain things by outside forces, thus saving my sanity.
My day job is broad enough that I get to sate most of my professional desires in one way or another. Now I have grad school to explore some topics in depth and expand my education. It's working out very well so far.
I have a CS degree, and I'm 99% self-taught.
Also the smart comment writer is not a representative of the average HN visitor/population. There are always people who are expert in their niches.
The issue is deciding how much one should know about something before you confidently put it on your resume.
For example I would say that I am an OK Java programmer but I avoid using enterprise frameworks which are commonly used in many companies so there are many parts of the language which I am not familiar with simply because I have never had cause to use them, for example I do almost all of my persistence using a database and ORM so I almost never have to use Java's concurrency locking features in the wild as I do all my locking in the DB.
The same with functional programming, there is no reason to learn it for my job but I get a feeling it will become more important as time moves on so I should know something about it.
There is allot of stuff on HN with people saying that everyone should have implemented a toy compiler at somepoint and if you haven't then your not a serious programmer , or perhaps it is a Toy OS etc etc.
Is this a controversial stance? It seems like common sense, unless I'm misunderstanding something.
EDIT: To clarify: I assume he's saying "don't add accessors by default for all private members unless you need to, because you can always go back and add it if you really need it", which is common sense for any project, external or internal. I'm pretty sure he's not saying "don't add accessors, just use public members", which is controversial, IMO, even for internal projects.
That said, consider the following. I've got a renderer that accepts a sprite to draw.
Version 1: I pass the sprite object to the renderer, and the renderer gets the texture contained in the sprite and draws it, scaling it according to the sprite's size and position public members.
I then decide that all of my sprites draw slightly differently (different scales/glow effects/color tint/whatever).
Version 2: I pass the renderer my sprite, it gets the size and render settings members from the sprite, and then draws it.
Oops! I now decide I want a hierarchy of sprites, so that I can add hats.
Version 3: Same as version 2, but in the draw routine now the renderer asks the sprite for its parent to calculate its position and size, and now I've got more renderer code and more sprite code. I can't just use the exposed position member of the sprite--it has context and logic behind it that must be done.
Oh wait, I have a problem in which the sprite glow might change depending on how many times its been drawn.
Version 4: The renderer now has to keep track of how many times it's drawn a sprite. My renderer is getting a bit chunky now.
Did I mention scale should change according to time but also the sprite's velocity?
Version 5: Renderer grabs these variables directly, and does all that other stuff too.
...and that now I want to let that scale be overridden by a isConstantSize flag on the sprite?
Version 6: aaaaaargh
...and that now the sprite can decide it wants to defer to a parent sprite's settings sometimes?
Version 7: what did i do to deserve this?
~
Proper encapsulation and use of accessors is clearly a sign of paranoia. That said, as your code evolves, you might find that this paranoia is completely justified. Hiding queries behind interfaces lets you future-proof them and trivially add more advanced behavior and hooks.
Even when you are working by yourself on an internal project, you are never working alone. You are also working with your future self, and that person is guaranteed to want something different from you and to make assumptions that you are not.
This flexibility is not something you might think you need.
You might also never need to debug your own code, or check your assumptions about variables, or track who is accessing what when.
(for what it's worth, I don't use protection for data members of Plain-Old-Data types [say, messages or vectors] very often--they're too dumb to deserve this sort of extensibility or cost)
You replace
public var myAttribute:int;
with public function get myAttribute():int;
The caller uses both with the same "object.myAttribute", so you can just replace one with the other when the need arrives, without changing any other code.This allows you to use all sort of syntactic sugar ("object.myAttribute++", "+=" and other assignments), and for dynamic languages you can get and set values just from a reference to the object and the attribute's name. This last part is invaluable for animation engines.
So add it then. Don't pre-generalize everything just in case.
sprite.render(context);
or some such...You want sprites to be an array, and render that in one go.
(contrived example for making a point... visiting a draw() method with a solid renderer interface is the answer we usually use)
Suppose you have a member named "x." Someday, you might want to stop storing x, and instead make it a calculated value. At which point you'll need a method. Or, when setting x, you may someday want to increment a counter, or transform the input data, or take some other action. Again, you'll need a method.
Yes, it's very easy to add an accessor later. But then you'll most likely have to edit every line of code that accessed the now-defunct member variable. Your IDE may make this easy, but I'd still prefer not to have to do it.
That's not to say writing accessors is always the best choice. I'm just saying there can be good reasons to do it. Like all things in software engineering, there's no one-size-fits-all rule about this. Notch is right about the bloat accessors create, so you have to weight the advantages and disadvantages yourself in each case.
Then you can convert your public vars into properties at a later date.
This means that you will not have to (necessarily) rewrite your code as the language knows that
a = myobj.myvar
now should call getmyvar() in the containing class and:
myob.myvar = a
should call setmyvar(a) , I know that C# certainly allows this.
C# and Objective-C (And I assume similar languages too) can have public accessors which are not used like function. No need to add ()'s everywhere.
Vector v1(v2.getX(), v2.getY(), v2.getZ()); vs Vector v1(v2.x, v2.y, v2.z);
Most software are outdated after a couple of years.
But I still think that accessors are a must if you know that the software will be immortal (like Internet banking applications)
I can't say I know the average shelf life of a software component in various languages, but I can say that at least things like Java have managed to justify their use of accessors by that metric. Maybe the focus should be on writing less throwaway code than deciding whether to "invest" a few extra minutes or not on accessors.
tl;dr; Usually enterprise Java applications does have long "service life".
You'd be surprised. Tons of code runs in production, even in the latest of shiny systems, that was written 10 and 20 and 30 years ago -- either in whole or in parts, refactored etc.
From 1986's NeXT OS that is now OS X Lion and iOS 5, to Bill Joy's TCP/IP, to Emacs.
And tons of enterprise/banking/financial/military systems use ancient code, even 70's COBOL...
This makes the code neater and enforces the abstraction--the user of the property does not need to know whether you've implemented it as a simple variable or a complicated method.
A bunch of other language let you do this as well.
Easy is an understatement. It's 2-3 clicks away in Eclipse.
But yeah, its a bunch of ridicules, generated spam.
After reading the Eiffel book and thinking about things like programming by contract and class invariants, the bean pattern which constructs empty, initially useless (or at least unreliable) objects seemed like a huge step back.
(Mime aside, do we get to hear what the argument was?)
# Old
class Foo(object):
def __init__(self):
self.x = 0
foo = Foo()
foo.x = 1
# New
class Foo(object):
def __init__(self):
self.__x = 0
@property
def x(self):
return self.__x
@x.setter
def x(self, val):
self.__x = val
do_other_stuff()I don't think this is true. I'll concede that it may be a requirement for certain things like an ORM API, but in the general case, it's bad practice. The mere act of adding a getter violates immutability.
Uh what? No it does not. Writing stupid getters (or classes) might, but writing getters does not "violate immutability".
Naturally, getters are not of much use if all your fields are final and hold immutable objects, but the latter can be tricky in many OO languages.
Getters significantly improve the situation there, by providing a point at which you can clone your internal state and return a copy, letting you keep your object immutable even if you have mutable fields (of course this assumes you can deeply copy all your mutable member objects)
The intent of the comment you are replying to "best practice is if you would add a public member, instead add a private member and a setter & getter" which is generally correct.
I do agree that most modern languages have a much more elegant solution for this.
I found this worked very well in real life.
In practice, it's useful because it allows more easily for instrumentation later on. And you can easily throw a "synchronized" on the method if necessary.
This is the start of the 48 hour video showing him building a 2d game for the lundum dare compo.
Not many people would throw a non-sequitor out there that nonchalantly and have it work so well.
1. I think programming is a multi-disciplinary task. Notch is obviously among the best at "writing a lot of working code". He's pointing out that he could improve in software design. I've work with many folks who are obviously strong in one area but weaker in others.
2. I think his coding sloppiness comes through in minecraft: it's an incredible game, but I've stopped playing at times due to frustration with crashes and corruption.
...oh, and 3. My guess is that the "large US based game developer" was Valve.
I personally don't think working in a large group is particularly rewarding for a programmer.
I'm at the point know where I can build an E-Commerce site in an MVC framework and implement Client & Admin Logins , Stock management , product search and a shopping cart without having to engage my brain because the structure to me is fairly obvious.
On the other hand if I had to design a game I would have to think long and hard about how the different components would fit together and even then I would most likely get it wrong somewhere.
Point is, SOPA sucks.
I always assumed there were all these "real", "professional" programmers out there that really knew what they're doing, pick crystal clear abstractions, had profound knowledge of security implications, database optimization, data structure usage, good use of object orientation, introduced no memory leaks, knew just what algorithm to pick and wrote great, clear and understandable code.
I still kinda think I suck, but at least now I know that I'm not alone :)
Have the humility to know you can always get better.
The moment you believe your the best at anything it becomes very dangerous because you have no reason to improve, your the best. Generally speaking there are very few people that are the best at anything (In fact only one for each thing). Most likely there is plenty of room for growth.
I'm glad the author used the negative comment as motivation to get better.
YES.
Experience has taught me this:
Never build your self-esteem on comparison with another
And by that I mean, you should never judge your own programming abilities based on other peoples' apparent abilities. If you're programming new stuff regularly, enjoying it and listening to what other programmers have to say, then the chances are you're getting better at it, and that's enough.
If you have to build your self-esteem by comparing to others, do it by looking at what you've created, not what you know.
I think we can all agree that Notch didn't make any mistakes. Minecraft is a huge success.
They are called "best practices", not "the only practices". But good for Notch to want to be like everyone else.
I just hope people don't disagree with Best Practices just because they want to show their displease with the authoritative...
This is very interesting, and mirrors some thought I've been having myself.
I would like to see someone create a list of examples of uncommon design patterns, and list cases in which they might be warranted.
Just because minecraft is a success does not mean there are not going to be parts of it's codebase that could be improved in such a way that it would improve their ability to iterate and add more features quickly in future.
I admire well written code, but a lot of times I see gold plating where is isn't really necessary, because "maybe one day we could add X". You still have to maintain the knowledge of where that easy addition could be plugged in.
Code is great, we can just throw parts of it away and refactor it to add new features. Which is possible if you follow best practices. ;)
I think the issue is in designing the initial structure you have to make decisions about which parts of the code will be important and how the relationships of objects etc will work. Sometimes if you have something that differs massively from your initial assumptions then you are in for an enormous refactoring job (as well as often a big data wrangling job if your app is already in production).
When I have done work for clients I have had fairly simple feature requests which I had not anticipated which have required fairly fundamental re-structuring of the codebase, if I had known these in advance I would have designed it differently.
Even if I had not known the specific changes in advance but I knew how much it would be likely to change then there are places where I would have also altered the design , but of course having said that there were areas where I spent allot of time creating code that allowed for flexibility where it was simply not required.
They must be really good. :)
You're right that if you know C++ and you learn Java, you're not really learning all that much. But if you've spent your entire life programming in those types of language, and then learn Lisp, or Forth, or even just assembly language, your entire mental model of computation is turned on its head. Heck, learning C would be an eye-opener for someone who has known only Java.
You can go even further. My own trade is ASIC verification - writing testbenches to test functional correctness of chip designs. I've done a bit of FPGA design, too. I've chatted to software guys far above my humble skill level who don't grok either of those two domains because they're completely foreign to their way of thinking. But I'd file both under the broad umbrella of "programming".
I think you can learn constantly for a lot longer than a year or two without learning any new languages or tools, just working on different project, in different domains, using different paradigms. [EDIT:clarification]
I still have the Osborne 1. I last powered her up in 2005, when Adam Osborne passed away.
How you approach a 1000 line project is different from a 100,000 line project.
The best practices for a good solo developer are different from a team developer.
And most importantly, the internal elegance of your code is independent from how useful / cool your product is.
It's sort of like posting a long list of your accomplishments and then saying "but I don't consider myself special, and I have much more to learn". If the sentiment was true, you probably wouldn't say it, and almost certainly wouldn't say it this particular way.
Is that the only reason? Probably not, but when someone famous says something it will get a lot more attention than if a nobody says it. Cet par.
He's a decent comedian it seems.
Than { Does it really matter? :Bool }
Return: Nope.