4 ms·
Coding one's own own data structures/routines for common data structures is probably suboptimizing. There are debugged modules available in most languages. Do s
by giardini 13y ago
Coding one's own own data structures/routines for common data structures is probably suboptimizing. There are debugged modules available in most languages. Do students get an extra 10 points if they use a debugged tested solution from a library? e.g., http://stackoverflow.com/questions/6831231/should-programmers-use-stl-or-write-their-own-code http://stackoverflow.com/questions/6831231/should-programmer...
- jordanthoms 13y agoYes, in production code you'd usually use a library implementation - although if you had specific requirements you would still need to build your own. That's beside the point though - any decent engineer should still understand how they work and be able to write a implementation of them fairly easily.
- dragonwriter 13y ago> Coding one's own own data structures/routines for common data structures is probably suboptimizing. There are debugged modules available in most languages. But if you can't code common data structures on your own, you'll probably have trouble coding the more advanced data structure that you found a paper on describing (possibly described in part by replacing parts of a more common data structure) with some code, but not in your language of choice, that would be, from its description, far better than the common data structure for your problem, for which there is not a debugged library for your platform of choice.
- doktrin 13y agoYou're describing an edge case. While certainly true, it doesn't represent the current needs of the job market or the realities of the industry.
- hajile 13y ago80/20 It's the edge cases that separate a good engineer from an average engineer. When that good engineer runs into that problem, he/she will solve it quickly and move on. An average engineer will spend days or weeks struggling with the solution -- costing lots of money and potentially delaying schedules.
- tptacek 13y agoI'm really having trouble with the notion, common on HN, that programmers don't need to understand or be able to code simple data structures. Hash tables, simple binary trees, and heaps are extremely basic computer science. You may never use a DIY binary tree container library, but if you can't comfortably write a binary tree or a heap, you won't be able to understand or implement advanced or domain-specific algorithms either. This is a learning task that might take a competent developer all of 2-3 days. If you're rationalizing not figuring out how to write a heap or a hash table, consider asking yourself whether you actually want to be a developer. You might feel OK about what you're doing now, but a career spent redesigning unit test suites and coming up with ever- more- elaborate HTML templating schemes is unlikely to be fulfilling.
- napoleond 13y agoI've expressed disagreement in another sub-thread with the idea that programmers need to understand or be able to code simple data structures, not because I think that knowledge is unimportant, but because "need" is a very strong word. (My previous objection was in the context of hiring--for 99% of CRUD web apps being built, the ability to use or implement a binary tree won't matter, and even when it does matter it won't need to matter for more than a few members of the team.) It's very possible to make a positive programming contribution in a professional context (and in a wide variety of fields) without having ever implemented a hash table (I had not, before just now). Obviously it's more important in some contexts than others, and that's fine, but the suggestion that programmers who don't have that experience are not programmers or that they're incompetent programmers is nonsensical--the context in which they work makes the difference. Now obviously, it's been a bit embarrassing making essentially this same post multiple times recently, so I just implemented a hash table and read a few sources for heaps and binary trees--yay! But this isn't rocket science--if I ever encounter data which doesn't conveniently fit in the basic structures available in my environment, I go find out what works (so, for example, I'm working on a project where I need to find the closest points in a data set according to Euclidian distance, and discovered that VP trees fit the bill). It is entirely possible that the ability to synthesize a simple data structure is a valuable signal of programmer competence for people with a formal computer science education (because they were presumably taught and tested against that knowledge multiple times, and if they can't reproduce it afterwards they might be bad at learning) but my suspicion is that the implementation of domain-specific algorithms is more often limited by a lack of domain knowledge than a lack of CS knowledge.
- wglb 13y agoThe realities of the industry would seem to be to write code that doesn't collapse under the slightest strain. In order to write code that doesn't fall down, or that does what it purports to do, the coder needs to understand how stuff works. If you don't understand how to build a linked list, or other common data structures, it is quite likely that you won't know how to use it. Or where it can go wrong. Or where it is not the correct thing to use. The realities are more stark in our breach-infested world. Sloppily implemented systems put companies in the headlines. Examples abound, not only with data structures, but also with algorithms. Someone who has written a compiler is far less likely, in my estimation, to try to "parse" a URL with a regular expression, with negative consequences. Someone who has written a hash table is less likely to be surprised when the insertion behavior ends up being n squared.
- doktrin 13y agoYou're describing the difference between a "good" and "bad" programmer. That's not at issue. Are programmers better off having a deep working knowledge of data structures, algorithms, compiler & OS design? Sure. Do they need to, in order to be (paid, professional) programmers? No.