PDA

View Full Version : Computer Programming (Teach me your ways, oh wise programmers)



Nominus Experse
07-25-2008, 03:45 AM
I am creating this thread in the hope that if there are any computer programmers on this site (of any type), that perhaps you could relay some tips on how you've come to be at the point you currently are. In other words, I am asking those that have experience, "How might I go about pursuing programming in the general sense of the word?"

The reason I ask this is because I am the crucial point in my life in which I must make pertinent decisions regarding my college and future life. Namely of which lies in which profession I will pursue. Computer programming is one of the options that I have considered (mostly considering C++, C#, Java, Ruby, and Perl)


Any and all information regarding computer programming will be relevant: you can never post too much information for someone curious.


And also, thank you for any that respond.

o_O
07-25-2008, 04:31 AM
Well, the best piece of advice anyone can give is to get classes, but it seems you're already doing that. :p

The first "language" I could fluently code in was HTML. HTML/Javascript/CSS/PHP/any other web languages are pretty useful to have, because the odds are that if you end up working in programming you're going to have to code for the web at some point. It could be anything from web services to having a (possibly compiled) language output HTML code for consumers (such as Java + JSP or PHP). I daresay that of all of the web languages you'll encounter, the most valuable is PHP.

You probably want to learn some database languages too. If you learn SQL and then move on to PL/SQL you'll be pretty much set, and luckily they're very easy to learn as far as programming languages go.

As far as compiled languages go, you're definitely going to want to have at least three if you want to get into application development. I'd pick C and C++, with Java, as a good range. These days, enterprise software is largely written in C# (which I hate, but it's useful to know), so if you're going to be doing database stuff definitely learn C#. The upside of that is that C is a subset of C++ which is a subset of C#. Don't bother wasting time trying to teach yourself these languages, since you'll pick it up so much faster with the aid of classes teaching the principles of programming as well.

Then there are scripting languages. Ruby, Python, Perl, PHP, etc. These are often used for web development, however they also get used a lot for regular programming. If I have the choice I'll use Ruby over any other language without hesitation. Compiled languages tend to be very picky about syntax and will throw back errors if you miss a semicolon or forget to initialise a variable, whereas scripting languages usually have more relaxed syntactical rules which allow you more flexibility. The beauty of Ruby is that you can put in the semicolons and the initialisations and whatever else you'd normally put in your C programs, for example, and it'll still parse and run correctly. Scripting languages are generally slower than compiled languages though, since they must be interpreted before running, instead of just running the compiled machine code.

Pretty much what I'd recommend is to learn a scripting language, since they're fairly easy to learn by yourself and save the heavy stuff for college. :p

Flying Mullet
07-25-2008, 07:50 PM
My choices in programming languages were pretty limited when I started as most of the courses were in C++ with some exploratory courses relating to other languages. I'd definitely suggest checking out at least one Object Oriented language like C++ or Java and one scripting language for the web, like PHP or Perl. Of course, the more you languages you learn the better, but I've found that once you learn a language pretty well, it's not that difficult to pick up new ones, as a lot of the language constructs are the same.

Nominus Experse
07-26-2008, 12:20 AM
Alright, thanks you two. I think I'll go ahead and learn PHP and Ruby first, as both of these would be the most useful for me (since they have some personal benefits beyond simply learning the constructs of code).

crono_logical
07-26-2008, 12:20 PM
I'd say learning how to write small algorithms to do things is more important than the language you pick - once you know how to program, I find the language I pick isn't as important since it's mostly syntax differences and other minor specifics to the language I then need to worry about :p Learn the basics of object-oriented programming and make use of splitting complex tasks into smaller functions, don't use GOTOs to jump around code, and you should be set for many modern languages :p

Namelessfengir
07-26-2008, 09:10 PM
ive forgotten more than most people know.... you should make sure that its what you want to learn. im a network database professional but ive spread out to hardware and security

Dr Unne
07-26-2008, 10:07 PM
A word about a career in programming... it's not for everyone. It takes a special kind of madness to want to program for a living. You're going to be sitting in front of a screen for 8 hours a day every day for the rest of your life. You will forget about such things as sunshine, fresh air, and physical exercise. You will forget how to interact with human beings. You will spend 3 hours looking for one bloody line of code in your program that's causing it to crash. You need an attention span and attention to detail that borders on mental illness. You need to make your brain think about things in a way your brain was not designed to operate. You need a lot of patience and a lot of tolerance for frustration. The money is good but it's not good enough to make up for doing something you hate. I have known many people who tried to go through CS in college and had to quit simply because it was so frustrating and unpleasant for them.

That said, I'm a programmer and I love it.

If you want to be a good programmer, you need to learn the concepts underlying programming. Learning the syntax and quirks and ins-and-outs of a single language is only a vehicle for learning the underlying concepts. The concepts are what's important.

At work I had to write a C# program, and I got it done in 3 days even though I'd never even seen C# before that point. I didn't know the multithreading library in C#, but I knew how threading works in general, how to use a mutex, how to identify and avoid race conditions etc. I didn't know the C# GUI toolkit, but I'd used GTK, Qt, Tk, Swing, and others before, and I knew generally how widgets work, how event handlers work, and so on. Understanding the broad concepts will let you learn a specific language quickly because all languages mix and match variants of the same concepts.

For learning concepts, the best thing is to start with a language that gets out of your way, so that you don't have to arm-wrestle with the syntax of the language, the quirks of the compiler, and other bullcrap. Specifically, a dynamically-typed language encourages quick exploratory programming in a way that a statically-typed language like Java could never do. I recommend Ruby or Python for this reason.

The best way to learn is to write a ton of code, and read a ton of other people's code. Write a program that renames all the images in a directory to number them, like "001.jpg", "002.jpg".. "100.jpg". Write a program that checks the weather for you by fetching it from Yahoo.com and printing the temperature. They're practical, hard enough to challenge you, but easy enough that you can complete them and feel like you accomplished something. Check out <a href="http://rubyquiz.com/">Rubyquiz.com</a>.

Get a good algorithms book. Learn the classic searching and sorting algorithms. Learn about data structures: linked lists, hash tables, trees, graphs, etc. These concepts are essential for every language. You can get away with using hash tables in Ruby without knowing what a hash table is or how it's implemented, but it will bite you eventually. Eventually, you'll want to learn about how programming languages work. Call-by-reference vs. call-by-value vs. call-by-name. The strengths and weaknesses of garbage collection. Dynamically typed vs. statically typed. Strongly typed vs. weakly typed. Compiled languages vs. interpreted languages.

Do NOT start with C++. C++ has too many dark corners and ridiculous syntactic quirks and unexpected behaviors. You will spend most of your time battling C++'s horrendous syntax and getting the compiler to work, and not enough time thinking about programming itself.

Eventually you absolutely must learn C, so that you understand what's happening under the hood. Interpreters for most other languages are written in C, for example. But do not start with C unless your goal for life is to be a systems programmer. C is too close to bare metal and encourages a certain kind of coding that doesn't work with higher-level languages.

If you're REALLY serious about learning programming, you should learn at least one or two languages from different families. Learn a "mainstream" workhorse language like Java or C#; learn a Lisp (Scheme or Common Lisp); learn a pure-functional language like Haskelll; learn a declarative language like PROLOG; learn a "pure" object-oriented language like Ruby or Smalltalk; learn assembler for your home computer's architecture if you can stomach it. Learn C++ last, so you can get a good laugh out of it. Learn SQL eventually, but given knowledge of other things, you'll pick it up along the way. Same with XML / HTML / other pseudo-languages.

MIT for a long time used a book called <a href="http://mitpress.mit.edu/sicp/">Structure and Interpretation of Computer Programs</a> as an intro to computer science. It uses Scheme. It's a good book and the text is free online.

tl;dr learn Ruby or Python.

Nominus Experse
08-03-2008, 06:05 PM
Thank you, God, that was quite informative and well-appreciated.

Ruby has been quite interesting to learn thus far, though the actual process is a little slower than I initially thought it would have been. I've made my way up to Arrays and Hashes now.

o_O
08-04-2008, 12:05 AM
<a href="http://www.ruby-doc.org/docs/ProgrammingRuby/">This</a> link will be your best friend while you learn Ruby. :p