Let Go, Standard Library From Community
Daniel Keep
daniel.keep.lists at gmail.com
Fri Apr 20 00:15:40 PDT 2007
David B. Held wrote:
> Daniel Keep wrote:
>> [...]
>> This is one thing I really lament about my uni education thus far. Two
>> topics that basically have *never* been covered in even minimal detail
>> have been optimisation and debugging.
>>
>> To be honest, I wouldn't know the most efficient way to return or pass
>> out a vector because I've never had any kind of grounding in the effects
>> of the various ways of doing it. For instance: at what point does
>> passing by reference become faster than by value?
>
> This is where it really helps to have some understanding of what a
> compiler actually does. The "Java Syndrome" helps students treat the
> compiler like a magical black box where text goes in and executables
> come out. While this is useful for cranking out thousands of
> entry-level programmers that assiduously follow design specs, it's not
> very good for creating engineers who are also artists.
Well, it's a good thing that I loathe Java, then ;)
> If you want to understand pass-by-value vs. pass-by-reference, it helps
> to understand how C works, and then how assembly works. Only when you
> get an idea for the actual instructions involved and how much time they
> take, relatively speaking, does it become practical to estimate these
> things. You can never be 100% sure what code a compiler is going to
> generate without looking at the output, but after you learn a few
> languages, you can make pretty good guesses.
I think I've got a fairly good understanding of *how* things work at the
instruction level. My current failing is, I believe, the part about
understanding their relative speed under different circumstances.
The example I gave in my previous posting was in regards to my vector
struct; I don't understand the relative speeds of copying the vectors
onto the stack and dereferencing pointers to them to be able to
comfortably make a decision on which to use.
> For function call performance, you need to understand registers, memory,
> stacks, call frames, and calling conventions. You also need to
> understand that references are just pointers that get automagically
> dereferenced on use. Once you put these things together, it starts to
> become fairly clear when one is preferred over the other (though there
> is definitely a gray area where it depends on the actual code generation
> and hardware characteristics).
>
> If you really want to be a good programmer, you need to take your
> education into your own hands. I would venture to claim that the
> majority of experts in the world learned most of what they know from
> self-study, and not from classroom lectures and textbooks. You are
> particularly lucky to be alive at this point in time because you have
> ridiculously more free information available to you than I did when I
> was growing up. I would have killed to have as much of the internet to
> access as you do.
>
> If you are really serious about your education, you will soon find your
> classes boring, because most of your learning will be self-directed. But
> you have to be fairly motivated to engage in that kind of learning, and
> everyone has different personalities. In the end, a diploma only proves
> that you will jump through hoops for The Man (which is important for
> getting a job in the corporate world, where docility is rewarded and
> innovation is discouraged).
>
> Dave
Well, I basically taught myself to program from books and online
tutorials. Sadly, my first languages were all BASICs (GWBASIC, QBASIC
and then Visual Basic 5 & 6), although I hope I've made up for that by
taking an interest in a wider variety of languages. My comp.sci. degree
was boring until about the third year when it finally started to get
interesting :)
That said, I don't think I'll ever really be able to learn enough... all
I can do is continue to read and experiment, hopefully bettering myself
in the process.
-- Daniel
--
int getRandomNumber()
{
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
http://xkcd.com/
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d
mailing list