Questions for all programmers willing to help a beginner

lazer1 lazer1 at blueyonder.co.uk
Wed Apr 28 23:16:35 UTC 2010


on the degree there were 2 kinds of students, those who had programmed before
the

degree and those who hadnt.



the people who gained were the ones who had programmed before, as the 

degree showed them the bigger picture. the people who hadnt programmed before

were completely lost. The degree is about theory and there is a huge amount

of theory. Every day another 2 or 3 hours of lectures. But I reckoned that

1 hour of lecture could take 3 hours to study especially some of the heavy
going

theory. Which means you have to quit all hobbies if you want to do well or you

have to spend your holidays studying.




thus you need to teach yourself to program first, initially your coding

will be really dreadful. But gradually it will improve until eventually

it becomes very good.

teaching is best when you have first hand experience of the subject.



At school we learned BASIC, but those were just exercises, like

print out the numbers from 1 to 100. I played around with graphics

in my spare time on the school computers using BASIC with line numbers.

eg rendering a 3D pyramid rotating, and gravity: a planet revolving 

around a sun. with the latter the errors gradually add up and the planet

veers off. At the time I never used subroutines as we werent taught about

them but used a lot of goto's.

Years later we learnt about numerical analysis which is about

the problems of errors. numerical analysis is another meta technique where

you use mathematics outside the program to minimise the errors or to 

evade overflow.






years after BASIC I learned C from the first edition of Kernighan & Ritchie's

The C programming language, Ritchie is the inventor of C around 1978, which
was

invented to basically create Unix. C wasnt meant for the general public, but

was created to deal with a particular problem of making a portable OS.

A lot of commonplace programming ideas that people use are from that book.




I wrote a public domain utility in C which took 2 weeks, in the holidays.


years later I then spent some months improving the utility.


And then I enrolled on the degree. 


For me the degree was major enlightenment because by then I had plenty of
experience

as a computer user, and had done a substantial amount of hobbyist programming.

I had the basics of C programming under control. But there was a huge amount I


didnt know. I had tried to code my own pattern matching a bit like *nix
regular expressions

and couldnt see how to code that. But on the degree they taught us the
theoretical

basis for coding such. Thats an example where you need to know theory to code
something.



On the degree we were now being taught the theoretical basis of the stuff

I already knew as a user and had programmed but in an ignorant way. 

It was like the lecturers were talking to me directly about my experiences

and showing me a new dimension. It was like being abducted by some
extraterrestrials

and being taught how to control gravity.





when I completed the degree my programming dramatically improved because 

now I was looking at the meta level. But ironically we were never 

taught how to program! But we learned many languages eg ML, Prolog, Modula,

C which I already knew, lisp. Modula is the most useful language to learn

as it FORCES you to write good code. There is only one way to code with Modula

which is good. Learning Modula is the best way to understand modularity

as the language has THE best interpretation of modularity.



its actually dangerous to teach someone how to program, as programming is 

an extension of the personality. If you got taught it will prevent you 

developing your own style. All that matters about a program is that it 

functions correctly. How you achieve that is entirely a matter of 

personal taste and experience. programming is a form of prose, and everyone

has a different style. For example I use a lot of my own personal eccentric

idioms when I code. And I never use comments, except where there was a bug

OR the code is too complicated to follow. The reason for this is that 

comments are a visual burden to the code. I only use them where there is 

danger. But some people like to comment every statement, and 90% of their

programs are comments.




programming is a bit like pop music, the best pop music is self taught

and DIFFERENT from the other pop music.






instead its better to teach yourself, and then you learn by discussing

your work with others and also learn when you listen to others discussing

their work. ie if you have written some code and run into many different 

problems, you will then understand advice as you have a frame of reference.



you will also learn when you read code by others, but only if you have

coded your own stuff. eg I learnt from some open source code how to 

do variable argument macros. But I learnt that because I had needed

variable argument counts somewhere and didnt realise there was a way to do it.







but you cannot learn out of a vacuum, learning is an accretion process

where new ideas accrete to existing ideas.


the best ideas are always from discussion, either from discussion with

other students, or discussion with the lecturers or today I learn a lot

from email discussion with other programmers.


eg I was coding some x86 asm and wanted to code some multiprecision addition.

unfortunately the carry flag CF gets trashed by the loop instructions, in

particular cmp the compare instruction changes the CF. With multiprecision 

addition the carry flag needs to be propagated leftwards.


I asked someone in an email how to do the loop instructions without

changing the CF. Some days later he replied that I need the jrcxz instruction.

jrcxz compares rcx with 0 WITHOUT changing any flags at all!










On 28-Apr-10, Daniel wrote:
>lazer1, thank you so much for your reply. You have an interesting point of
>view and I shure had a lot to learn from your reply. Thank you very much
>sir!







More information about the ubuntu-users mailing list