You are not logged in.

#26 2013-01-31 21:17:55

Odaer
Member
Registered: 2010-08-14
Posts: 87

Re: learn programming.

drcouzelis wrote:

Here's something to consider: Learning Python after years of programming in C has made me a better C programmer.

Would Python still have made me a better C programmer if I had learned it before learning C? smile

I think you learn new thing every time you learn a language. Especially if it has another philosophy and programming model than the language you are comfortable with.
I have more or less only used c and c++ without stl before. Now I half way through the SICP book and I really think I have learned a lot.( Or maybe its delusion. The book is fun at least. wink the plan was really clojure but I suppose mit-scheme is near enough)

Offline

#27 2013-01-31 21:55:31

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: learn programming.

I'm gonna have to go with the utility-based recommendation here: Everyone's got different methods, preferences and levels of knowledge.  If the ultimate goal here is to learn the fundamentals of programming, then it would do to learn a high- or mid-level language first, such as Python or BASIC. Python is far more practical than BASIC, but both BASIC and Python have mountains of freely available docuentation aimed at everyone from professionals to people who've never seen a programming language in their lives.  Go with the language with the manual--official or otherwise--that best makes sense to you.  Personally, learning C as my first language would be out of the question, but for others that may differ.

Offline

#28 2013-01-31 22:06:05

MrCode
Member
Registered: 2010-02-06
Posts: 373

Re: learn programming.

C++ was arguably my first "real" language (I actually started with a proprietary C-like language that was tied to a specific game/graphics dev suite), and I think the thing that took the longest time to really "click" for me was pointers, although once you do "get" it, it's really quite simple when you start thinking in terms of linear memory and bits/bytes rather than arbitrary "variables".

I'd go with the option of learning whatever language you think you'll get the most use out of.  If you think you'll be doing a lot of low-level programming (e.g. for real-time applications where performance is crucial, or for kernel/OS-related things such as drivers), C and other compiled languages are definitely the way to go.  I personally like C because it forces me to think about how the machine works at a lower level (I could go further down to asm, but in today's world, hand-coding assembly is mostly irrelevant and a waste of time), but I wouldn't expect to use it for everything.  I've actually been writing a lot more shell scriptlets than C programs as of late. tongue

Last edited by MrCode (2013-01-31 22:07:05)

Offline

#29 2013-01-31 23:09:04

Nisstyre56
Member
From: Canada
Registered: 2010-03-25
Posts: 85

Re: learn programming.

On the subject of teaching Haskell to beginners: it is possible, and many universities (including the one I am at) do teach it to first years. The trick is to only teach a subset of Haskell, which is very simple to teach and learn, and naturally builds on their experience with mathematical reasoning and notation.

Also I disagree that assembly is the "Latin of programming", first of all Latin is pretty fundamental to our morphology (we get quite a few words from Latin), but not *that* fundamental to our syntax (people thinking it is leads to a lot of silly made up rules like that you cannot split an infinitive in English), and assembly syntax is not fundamental to the syntax of most higher level languages (except possibly Forth). Thinking assembly is somehow fundamental to higher level programming languages is equally as silly as thinking Latin syntax is fundamental to English, they are related but one does not need to know the former to learn the latter well. You could easily implement every higher level language on a computer that does not use the traditional form of assembly/machine code.

Last edited by Nisstyre56 (2013-01-31 23:36:22)


In Zen they say: If something is boring after two minutes, try it for four. If still boring, try it for eight, sixteen, thirty-two, and so on. Eventually one discovers that it's not boring at all but very interesting.
~ John Cage

Offline

#30 2013-02-01 00:46:11

Grinch
Member
Registered: 2010-11-07
Posts: 265

Re: learn programming.

Ah, this question. I think it boils down to how 'serious' you are in your quest of being a programmer. If you would like to make a living of programming, the kind of 'revelatory knowledge' you get about the cpu and memory through assembly language (and to a lesser extent, high level languages like C) is in my opinion a huge advantage, as has been stated by many others in this thread.

I've sat in on interviews were guys have come in applying for 'system level' programming jobs who are unable to implement a doubly linked list without using std::list' and obviously that's not going to fly.

Then again I've had colleagues sorely lacking in this respect (like them breaking out in a cold sweat as soon as pointers are mentioned) who are still great within their 'domain of programming'.

Basically it all depends on what your aims are, if you are strictly aiming for high level programming then I (like many other here) think you can do little wrong with choosing Python as a start language. It's also a great language to combine with lower level languages (like C), should you later want to delve in such.

I'd also like to pass a vote for Go, it's a (relatively) new language which sits somewhere between C and Python, it has conveniences like garbage collecting, run-time reflection, automatic bounds checking, concurrency primitives etc, while also exposing lower level concepts like pointers.

I'm quickly falling in love with the language with the only caveat being that I am (as for now) only getting to use it during my limited spare time.

Offline

#31 2013-02-01 01:09:13

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: learn programming.

chris_l wrote:

The computer processor works in opcodes, and assembly is the direct translation of them. Is not just a language for another tasks; is THE direct translation of the language the processor actually "speaks".

Nope. Processors speak electronics. Assembly reveals only one small portion of what's "really" going on. Stacks aren't "real", but the presence of a stack is nevertheless important to an assembly programmer. Subroutines aren't "real" either. Neither are interrupts. Opcodes themselves are no less arbitrary than function names or ASCII.

[C]ertainly assembly is more "real", by defining "real" as "closer to what the computer processor actually does". And C is an abstraction of what a processor does, to the point C is sometimes considered a "highlevel assembly".

I could write an ARM interpreter in Java, and run it on my desktop. Then would Java be "closer to what the computer actually does" than the assembly? Assembly makes use of one kind of abstraction of the machine, C makes use of another abstraction, Java uses another, Haskell still another. They're all different, all functionally equivalent, and all designed to help (human) programmers make a CPU do what they want. None of them tells you what "actually" happens when two numbers get added together. For that, you need at least a sound background in digital electronics and some computer architecture.

But I digress. What I mean to ask you is, so what? Why should I care, when I'm writing Python, what signals are running back and forth inside my CPU? When I'm driving, I don't need to know whether it's a Rolls or a Chevy to press the pedals and turn the wheel; those are an abstraction of the physical machine. If I need to care about what's under the hood to drive my car well, it's because the abstraction has failed. Knowing C doesn't inform Python; if anything, it's the reverse -- understanding high-level concepts informs low-level software design. Re-read the Story of Mel; Mel wrote his assembly programs innermost-loops-first so they would run faster. Do you think that would make Mel a good Python programmer?

Programmers need practice, using languages that they will use in the real world; they don't need pedantic knowledge of languages they don't use on platforms they won't be working with. Again, I wouldn't discourage anyone from following in my footsteps down the "low-level" route, but I do discourage people from taking it solely out of a misguided attempt to become better at using Python or Perl or whatever.

Offline

#32 2013-02-01 07:18:50

chris_l
Member
Registered: 2010-12-01
Posts: 390

Re: learn programming.

Grinch wrote:

Ah, this question. I think it boils down to how 'serious' you are in your quest of being a programmer. If you would like to make a living of programming, the kind of 'revelatory knowledge' you get about the cpu and memory through assembly language (and to a lesser extent, high level languages like C) is in my opinion a huge advantage, as has been stated by many others in this thread.

Well, I think he said it better than me.

Oh remember, I never said it should be the first language, ok? My recomendation is hackety hack, to learn ruby. But, python or perl are as good to me as first languages options.

@Nisstyre56: Yeah, normally metaphors don't stretch well. It was only in the sense of "you don't speak latin, but still useful to learn". (and I didn't originally say it, I just readed on some site and agree with it)
I wasn't talking about syntax. Hmm, on syntax maybe it would be C the closest to latin, I guess. Several other languages syntax is quite similar to C. Or maybe they are influenced for some other, older language. But I don't really know.
Which one you think would be the closest to be called latin of languages, exclusively on the "syntax similarity" sense?

@Trent: ¯\_(ツ)_/¯ Ok.


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

#33 2013-02-01 10:00:58

Nisstyre56
Member
From: Canada
Registered: 2010-03-25
Posts: 85

Re: learn programming.

chris_l wrote:

Which one you think would be the closest to be called latin of languages, exclusively on the "syntax similarity" sense?

http://en.wikipedia.org/wiki/ALGOL


In Zen they say: If something is boring after two minutes, try it for four. If still boring, try it for eight, sixteen, thirty-two, and so on. Eventually one discovers that it's not boring at all but very interesting.
~ John Cage

Offline

#34 2013-02-01 13:20:31

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: learn programming.

I took 2 years of Latin in high school. Now I wish I'd taken German, or Russian, or Korean, or just about anything that is still spoken, instead of wasting my time on a purely pedantic language. Not that it didn't improve my literary skills -- it did! But it didn't improve them any better than any other language would have. There's probably a lesson in that.

Offline

#35 2013-02-01 16:04:45

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: learn programming.

ANOKNUSA wrote:

... it would do to learn a high- or mid-level language first, such as Python or BASIC. Python is far more practical than BASIC,.


I would avoid BASIC.  It is highly non-standard with literally thousands of dialects.  It also, IMHO, teaches and reinforces really bad habits.  I learned BASIC on an ASR33 teletype communicating with a mini over an acoustic coupler (circa 1974).  It took me years to unlearn what I thought was programming.

If you want an interpreted language first, I recommend Python.
If you want a compiled language, then C.

Eventually, Learn both.

Last edited by ewaller (2013-02-02 00:40:07)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#36 2013-02-01 17:34:59

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: learn programming.

ewaller wrote:

It also, IMHO, teaches and reinforces really bad habits.

Eight year old me wrote:

GOTO 25
...
GOTO 300
...
GOTO 1030

Ahhhh, good memories... smile

Offline

#37 2013-02-01 22:42:06

bsilbaugh
Member
From: Maryland, USA
Registered: 2011-11-15
Posts: 141

Re: learn programming.

Perhaps it would be advantageous for the OP to establish some concrete learning goals; e.g. articulate what he/she specifically wants to understand in the form of questions, or enumerate the kind of skills/abilities he/she specifically wants to develop. Then, set out to design an appropriate study plan.

If the OP is seeking answers to questions of the form "why does this work?", or "why do it this way?" Then, perhaps a bottom approach to programming would be an appropriate choice. That is, start by reading up on how a computer works, what a program is, and the basic methods in which a program can be defined. Then, as the motivation develops to seek more productive (tangible) methods for creating non-trival computer programs, move up to the more abstract/virtual programming models and the languages that support them.

If, on the other hand, the OP is seeking answers to questions of the form "how do I do this?", or "how can I solve this problem?", then perhaps a top down approach would be an appropriate choice. That is, start with high-level (more expressive) programming models and languages. Then, as the motivation develops to better understand the inner workings of the machine, or understand how to develop highly performant applications, start pealing back the layers of abstraction and work towards the more primitive constructs and underlying theory.


- Good judgement comes from experience; experience comes from bad judgement. -- Mark Twain
- There's a remedy for everything but death. -- The wise fool, Sancho Panza
- The purpose of a system is what it does. -- Anthony Stafford Beer

Offline

#38 2013-02-04 20:34:08

stringchopper
Member
Registered: 2009-02-19
Posts: 38

Re: learn programming.

I saw that Jeff Duntemann updated his (somewhat famous) book, "Assembly Language Step by Step: Programming with Linux" -geared for teaching the new programmer the fundamentals about computers, memory, etc, as well as programming.  If you decided to consider assembly, I highly recommend this book.  I used the old version (dos) and found it to be excellent.
http://www.amazon.com/Assembly-Language … +duntemann


Regards,
Brian

Offline

#39 2013-02-04 20:41:46

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: learn programming.

Learn JavaScript. It's all the rage!

Offline

#40 2013-02-06 14:02:04

dysoco
Member
Registered: 2011-10-11
Posts: 43

Re: learn programming.

I'm going to suggest you this path:
Python -> C -> Scheme
Why?

Well, first with Python you will learn the basics of programming (Conditionals, variables, functions, etc.) It's also a really fun and used language, tons of Python projects out there.

Then with C you learn the low level concepts of programming (Pointers, memory allocation, segfaults, stack overflows, etc.) and it's probably the most used language in the Linux world (Basically everything you can think of was written in C: Linux, GCC, Vi, Nano, ls, cat, grep, etc. etc.)

After you know your stuff with Python and C (But don't spend years in both, just know enough of them) jump to Scheme using a book like Structure and Interpretation of Computer Programs and/or How to design programs, this will open your eyes and see how easy everything really is: you'll learn functional principles and you will apply all this concepts to all the other languages you will learn.

After learning this you can learn practically every other language easily (Depends on the language), you will have OO experience, low level experience and functional programming experience.

Note: The order can be modified if you want, you can do C -> Scheme -> Python or Scheme -> C -> Python , I don't think it really matters a lot.
Note2: I'm a bit tired and I'm not English so bear with my syntax/ortographic errors.

Offline

#41 2013-02-08 12:31:42

Odaer
Member
Registered: 2010-08-14
Posts: 87

Re: learn programming.

drcouzelis wrote:

Learn JavaScript. It's all the rage!

Why not? It should work as a first language as good as python.
It usable and a bunch of big companies burn very much money to get it to perform   well.
If you use gnome and search for a language to do something usable in short time without any experience it's probably a good choice.
In the end you are almost forced to have some experience of it today. It is everywhere.

Offline

#42 2013-02-12 12:12:01

blackout23
Member
Registered: 2011-11-16
Posts: 781

Re: learn programming.

Is there some must-have book on Python 3? Like what "Kernighan/Ritchie - The C Programming Language" is for C?

Offline

#43 2013-02-12 12:18:19

kaszak696
Member
Registered: 2009-05-26
Posts: 543

Re: learn programming.

Dive Into Python - free
Python 3 Object Oriented Programming written by Arch developer.
Learning Python and Programming Python are really good, especially the second one is useful to have at hand.

Last edited by kaszak696 (2013-02-12 12:19:43)


'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard

Offline

#44 2013-02-12 13:05:14

theGunslinger
Member
Registered: 2011-05-20
Posts: 300

Re: learn programming.

drcouzelis wrote:
ewaller wrote:

It also, IMHO, teaches and reinforces really bad habits.

Eight year old me wrote:

GOTO 25
...
GOTO 300
...
GOTO 1030

Ahhhh, good memories... smile

Linus is feeling pretty strongly about using goto being bad is just a myth.

http://kerneltrap.org/node/553/2131

Offline

#45 2013-02-12 13:22:40

kaszak696
Member
Registered: 2009-05-26
Posts: 543

Re: learn programming.

theGunslinger wrote:

Linus is feeling pretty strongly about using goto being bad is just a myth.

No tool is wrong by itself, it's the usage of that tool that might be.


'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard

Offline

#46 2013-02-12 13:47:52

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: learn programming.

theGunslinger wrote:
drcouzelis wrote:
ewaller wrote:

It also, IMHO, teaches and reinforces really bad habits.

Eight year old me wrote:

GOTO 25
...
GOTO 300
...
GOTO 1030

Ahhhh, good memories... smile

Linus is feeling pretty strongly about using goto being bad is just a myth.

http://kerneltrap.org/node/553/2131

I'm sure gotos are really elegant in the hands of an artist but once you try debugging any code by a normal programmer that uses goto, you start to see what Dijkstra was talking about.

Offline

#47 2013-02-12 14:35:45

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: learn programming.

jakobcreutzfeldt wrote:

I'm sure gotos are really elegant in the hands of an artist...

If they're really sloppy, one could still maybe print the source out on a sheet of paper and, following each GOTO with a pencil, end up with some Spirograph-type fractals.  tongue

Offline

#48 2013-02-12 14:46:28

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: learn programming.

Not to further derail this thread, but case in point:

   int i;                                                                                                                   
   double p=alpha, g=ln_gamma_alpha;                                                                                        
   double accurate=1e-8, overflow=1e30;                                                                                     
   double factor, gin=0, rn=0, a=0,b=0,an=0,dif=0, term=0, pn[6];                                                           
                                                                                                                            
   if (x==0) return (0);                                                                                                    
   if (x<0 || p<=0) return (-1);                                                                                            
                                                                                                                            
   factor=exp(p*log(x)-x-g);                                                                                                
   if (x>1 && x>=p) goto l30;                                                                                               
   /* (1) series expansion */                                                                                               
   gin=1;  term=1;  rn=p;                                                                                                   
 l20:                                                                                                                       
   rn++;                                                                                                                    
   term*=x/rn;   gin+=term;                                                                                                 
                                                                                                                            
   if (term > accurate) goto l20;                                                                                           
   gin*=factor/p;                                                                                                           
   goto l50;                                                                                                                
 l30:                                                                                                                       
   /* (2) continued fraction */                                                                                             
   a=1-p;   b=a+x+1;  term=0;                                                                                               
   pn[0]=1;  pn[1]=x;  pn[2]=x+1;  pn[3]=x*b;                                                                               
   gin=pn[2]/pn[3];                                                                                                         
 l32:                                                                                                                       
   a++;  b+=2;  term++;   an=a*term;                                                                                        
   for (i=0; i<2; i++) pn[i+4]=b*pn[i+2]-an*pn[i];                                                                          
   if (pn[5] == 0) goto l35;                                                                                                
   rn=pn[4]/pn[5];   dif=fabs(gin-rn);                                                                                      
   if (dif>accurate) goto l34;                                                                                              
   if (dif<=accurate*rn) goto l42;                                                                                          
 l34:                                                                                                                       
   gin=rn;                                                                                                                  
 l35:                                                                                                                       
   for (i=0; i<4; i++) pn[i]=pn[i+2];                                                                                       
   if (fabs(pn[4]) < overflow) goto l32;                                                                                    
   for (i=0; i<4; i++) pn[i]/=overflow;                                                                                     
   goto l32;                                                                                                                
 l42:                                                                                                                       
   gin=1-factor*gin;                                                                                                        
                                                                                                                            
 l50:                                                                                                                       
   return (gin); 

Offline

#49 2013-02-12 15:07:05

blackout23
Member
Registered: 2011-11-16
Posts: 781

Re: learn programming.

kaszak696 wrote:

Dive Into Python - free
Python 3 Object Oriented Programming written by Arch developer.
Learning Python and Programming Python are really good, especially the second one is useful to have at hand.

Thank you. I'll go this road. Python -> C -> C++ -> Assembly (Basics) while learning a bit of Shell Scripting on the sideline.
I learned a bit of Java and OOP during an university lecture already.

Offline

#50 2013-02-12 15:14:49

theGunslinger
Member
Registered: 2011-05-20
Posts: 300

Re: learn programming.

jakobcreutzfeldt wrote:
theGunslinger wrote:
drcouzelis wrote:

Ahhhh, good memories... smile

Linus is feeling pretty strongly about using goto being bad is just a myth.

http://kerneltrap.org/node/553/2131

I'm sure gotos are really elegant in the hands of an artist but once you try debugging any code by a normal programmer that uses goto, you start to see what Dijkstra was talking about.

Misuse of any tools results in a mess, but when you feel it would do the job better than anything else, don't let Dijkstra be the judge of that is all I'm saying.

Last edited by theGunslinger (2013-02-12 15:16:00)

Offline

Board footer

Powered by FluxBB