Re: [stella] OT: Programming, CS theory

Subject: Re: [stella] OT: Programming, CS theory
From: KhrysSun@xxxxxxx
Date: Fri, 26 Oct 2001 06:08:14 EDT
I have no CS degree and I learn to program with books. I discover computer programming reading science magazines when I was 14. I found this stuff so fantastic that I learn the BASIC reading the codes printed into those science magazines.... while dreaming the day I'll have my first computer to write my first games.
I owned a C64 3 years later.  and I jumped into langage machine immediatly...  many years later I learn Pascal and C++.

As I said I have no CS degree but I find this topic interesting as I can compare the results of my programming experience with theory.... Just for fun.

THEORY: Recursion is great!
My P.O.V. : I find Recursion fun to play with, but I rerely use it.

THEORY: Avoid the use of global variables, only use local variables!
My P.O.V. : I prefer to use less variables declarations as possible.
                Using locasl, usually, make the code Loud to read.
                I think it's easier to use globals for code                                               
                writing/reading.
                But, it's necessary to use Global variables wisely, so to
                avoid to be lost into the vars to use temporally and the
                others I place a underscore in front of the temp vars :  
                _I.

THEORY: Never use GOTO statements!
My P.O.V. : I never (or very rarely) use goto when programming In
                C++.
                 I Use it to optimize the code when programming in
                 machine language.

THEORY: Never learn to program in BASIC, it ruins your brain and
               prevents you from learning how to program "properly"
My P.O.V. : I don't agree, each language own it's logic programming.
               So I don't approach a problem the same way when
                programming in C++ or in Machine Language.
               (I'am always surprised to notice how a (low base) function
               is much more compact/easiest to write in machine language
               compare to C++

THEORY: You can combine several statements together, like
for(++i;i<lseek(fp)) {i+=lseek(fp+i)};
My P.O.V. : Not the best way to have an easy to read code.
                 To use in the small programs only.

>>Erik :
> The one thing BASIC has done to me is make me unable to program
> in C++ without constantly tripping over the syntax.  I can't logically
> follow the trails of braces and ampersands and the "maybe it'll
> work if I put the asterisk _here_" factor.  No matter what style
> of indenting and braces you use, I'll never follow it as closely as
> I can IF,THEN, END IF.  FOR/NEXT is much more intuitive than
> for (;;) {} .

I think everything becomes natural when practicing enough and have a clear idea of the syntax. When programming in C++, just forget the BASIC and don't try to compare the 2 language... it will be easier.     

my advice : Imagine you are reading a book, and consider { }; as a paragraph and have a visual look on it to understand the code.
so ...
if (a==b) {
              if (b<10) {
                            }
              else        {
                            };
               };
...become immediatly very easy to understand for


the asterisk : * is used pointers (I think that's wahtt you are talking about.
Consider that it refers to the address, not the var itself.

hope this help.
Current Thread