3 ms·
> Do we honestly believe a beginning programmer will be better off reimplementing std::vector or just using a fixed array instead? I believe a beginning progra
by tsahyt 14y ago
> Do we honestly believe a beginning programmer will be better off reimplementing std::vector or just using a fixed array instead?
I believe a beginning programmer will be best off using fixed arrays at first, then reimplementing a basic version of std::vector when the need for it arises (which it inevitably will) and then use whatever vector datatype his chosen language offers him. This will give the programmer an understanding of what is actually going on and why the array is suddenly resizeable/resizes itself. That's the sort of attention to detail that separates a good programmer from a great one.
> do we honestly believe Linus never uses function pointers
Actually, they're all over the place in the kernel. They're used all the time when writing device drivers. I use them myself in every bit of quasi-polymorphic C code I write (although I'm not a kernel hacker). I think they're quite nifty actually although they can obscure things. Here we come back to how we're using constructs a language gives us. Used correctly, specifying well documented interfaces, they give birth to hardly any problems. Executed the wrong way, they give birth to all sorts of bugs and weird behaviour and obscure the code.
> the argument about the name of the function giving us a rough estimate of the overhead does not sound valid to me.
It only will if you know the function, yes. Otherwise it's a weird argument.
I think your opinion is just as valid as Linus' is. I think, larger languages open the flood gates for decisions which can come at a cost for performance or maintainability. Programmers should be aware of that and useful guidelines would definitely help.