LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-25-2007, 04:05 PM   #1
vashsna
Member
 
Registered: Oct 2006
Location: USA
Distribution: Mint, FreeBSD, Gentoo
Posts: 50

Rep: Reputation: 15
What was your first language to learn?


I've talked to people about this and most seem to point me to C++ as the language to learn and branch out from there. In your opinion what is the best language to build a solid foundation of the fundamentals of coding? As of now am more interested in security and non-gaming applications.
 
Old 05-25-2007, 04:27 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Without having much experience to back me up, I'd hafta say C in one of its forms, if you're looking to do Linux programming in the areas you mention..

My first language was BASIC, followed by assembly (both many years ago) and of late I got into PHP. I don't do much programming any more, not like I used to, but it's mainly BASH these days, since getting into Linux.
 
Old 05-25-2007, 04:36 PM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Well, you've opened the proverbial "can of worms."

For my , when I hired programmers, I always gave a big plus to anyone with solid assembly language experience.

But the programming world has changed a lot since I managed a programming group in the 1970's. Still, without assembly, you might have a hard time understanding how a high level language is converted to machine instructions, and why some construction that worked well on some piece of hardware might not work so well on another.

Since C can easily be converted to assembly code, it's a good second choice for a "first language." (The first C compilers were derived from the B compiler, and that "complier" was, I believe, just as set of assembly macros that directly expanded B statements to assembly code. I'm not sure about this, but I think that the A language was "assembly.")

Since C++ is, as it's name implies, an "increment" on C, learning C is implied by learning C++, and it used to be true that some schools make C a prerequisite for C++. (I don't know if that's still true.)

You should note that the Linux kernel is still written in C.
 
Old 05-25-2007, 04:56 PM   #4
vashsna
Member
 
Registered: Oct 2006
Location: USA
Distribution: Mint, FreeBSD, Gentoo
Posts: 50

Original Poster
Rep: Reputation: 15
Thank you for the reply, am reading about assembly language and it's uses in making you better in HLL's with knowing what the complier is doing, although the article is 10 years old. Do you think assembly language would still be applicable in today's world in building a foundation of knowing what the computer is doing with that code and/or doing with anything for that matter? Oh and learning a language is just for fun.
 
Old 05-25-2007, 05:44 PM   #5
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Quote:
The first C compilers were derived from the B compiler, and that "complier" was, I believe, just as set of assembly macros that directly expanded B statements to assembly code. I'm not sure about this, but I think that the A language was "assembly."
BCPL -> B -> C

The first was BCPL and not B. And even BCPL wasn't directly assembly 1:1 related. BCPL was a simplified version of CPL... which was designed with compilers and system programs in mind... so it was low level... but again, not directly related to assembly. There was no "A" language in the series.

C++, also, does not teach good C skills. A C programmer can move to C++ fairly easily (mainly because C code still compiles in C++) but the reverse isn't always true.

EDIT: http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.html
Add link to reference on BCPL which links to B, which led to C...

Last edited by frob23; 05-25-2007 at 05:47 PM.
 
Old 05-25-2007, 06:05 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Amiga DOS was originally written in B.

I think the first language to learn is the bash shell. It will familiarize you the unix philosophy and improve your productivity.

The C Language was written to compile Unix. So the language and its libraries are tightly coupled to the unix OS. For example, look how some files in /etc/ are the database files for standard C library functions:
hosts gethostbyname(3)
networks getnetbyname(3)
passwd getpwent(3)
shells getusershell(3)
nsswitch.conf nsdispatch(3)

Generally for programs that operate in the shell, use C. For programs that run in the desktop, the C++ language is best because the desktop frameworks are written in C++. It is still possible to use other languages using wrappers for these C++ libraries.

Last edited by jschiwal; 05-25-2007 at 07:50 PM.
 
Old 05-25-2007, 06:36 PM   #7
vashsna
Member
 
Registered: Oct 2006
Location: USA
Distribution: Mint, FreeBSD, Gentoo
Posts: 50

Original Poster
Rep: Reputation: 15
Thank you all for your comments and a little insight into other aspects of coding for i didn't even know about B. I've been learning bash just by using Linux which i try to do things in the shell instead of point and click. That point and click doesn't necessarily emerge into a deeper understanding of the computer. One may argue why do you need to know everything, surely you don't need to know what that register does or some other obscure thing, but i say why not. Although as of now am like the child asking what does the color blue taste like.
 
Old 05-25-2007, 08:21 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
What was your first language to learn?
Fortran: circa 1967, using an IBM keypunch.
I'll bet that does not help you one bit.....

Seriously, I think now the place to start would be C.
 
Old 05-25-2007, 08:32 PM   #9
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
The historic languages like BCPL and B aren't really things you need to concern yourself with. But I felt compelled to correct the history a little there. The following language recommendations are roughly in order of how I would recommend learning them.

If you are going to do a lot of shell scripting, learn bash... but also know where it deviates from the original bourne shell. Many systems do not have bash installed and keeping scripts as compatible with the bourne shell (as possible) will make portability less of an issue. Shell scripting is an important step for really improving your productivity at the command line so I can't encourage learning it enough. What you learn in scripting will pay off in your daily use. Just keep in mind the portability issue.

I would recommend python as a good language as well as perl. Python because I happen to like it better, perl because it is pretty much the standard language for complex tools these days. It helps to understand and be able to read some of the code. Although, perl can be written so "well" that reading it becomes an absolute chore if it even remains possible.

I also recommend learning C and lisp (not as first languages though). They are both very important languages and will teach you a lot. C is very hard to keep secure if you don't know what you are doing, though. So it doesn't fit in well with your original criteria. These languages remain the two I am most likely to use when a task becomes more involved than a shell script.

Assembly... the second "language" I learned after BASIC. And it did provide me with a good understanding of how programs worked at the lower levels. It may be beneficial for you to learn (if you are planning on doing some systems programming). But it is very OS and hardware dependent. Even the manner that different versions of *nix use to make system calls changes at the assembly layer and any code which pretends to be portable will have to account for that. Interesting to learn... impractical for general use. Still, for very specific use and within strongly defined confines... a good thing to know.

Recap:
Shell scripting: /bin/sh & bash
Basic programming: python & perl
Other languages: C & lisp
Optional: assembly
 
Old 05-26-2007, 08:40 PM   #10
cfaj
Member
 
Registered: Dec 2003
Location: Toronto, Canada
Distribution: Mint, Mandriva
Posts: 221

Rep: Reputation: 31
Quote:
Originally Posted by frob23
If you are going to do a lot of shell scripting, learn bash... but also know where it deviates from the original bourne shell. Many systems do not have bash installed and keeping scripts as compatible with the bourne shell (as possible) will make portability less of an issue.

More importantly, learn the POSIX standard for shell scripting. Every system for at least the last 15 years has a POSIX shell. The POSIX shell offers important improvements over the Bourne shell, making it a much more efficient programming language. It is more of a guarantee of portability than even the Bourne shell, where there are incompatibilities between versions.

Whenever possible, use a Bourne-compatible syntax, but don't hesitate to use POSIX features where they make a difference to the script.

Learn also the extensions found in Bash (and Korn Shell 93), and use them when they improve the script, not just because you can use them.

Encapsulate the non-POSIX code in functions that can easily be replaced by POSIX (or even Bourne) code if it should become necessary.

 
Old 05-28-2007, 02:13 AM   #11
masagung
LQ Newbie
 
Registered: May 2007
Posts: 3

Rep: Reputation: 0
i say so, C is the basic that we have to know first
 
Old 05-28-2007, 03:05 AM   #12
easuter
Member
 
Registered: Dec 2005
Location: Portugal
Distribution: Slackware64 13.0, Slackware64 13.1
Posts: 538

Rep: Reputation: 62
I started of with BASIC (Gambas), and now I'm moving onto C.
 
Old 05-28-2007, 11:26 PM   #13
varun_shrivastava
Member
 
Registered: Jun 2006
Distribution: Ubuntu 7.04 Feisty
Posts: 79

Rep: Reputation: 15
hi

the very first language i learned was C(just after my high school) and 8085 assembly language. Then next i learned C++.

I think C is the best programming language to start with, learning it on Unix or Linux platform is more advantageous.

It has been almost 8 years, and i m still learning C.
 
Old 05-29-2007, 04:32 AM   #14
g4j31a5
Member
 
Registered: Sep 2006
Distribution: open SuSE 10.0
Posts: 116

Rep: Reputation: 15
Does a DOS Batch Script fit the bill? That and QBasic were my first programming language. Learned them from some books.
 
Old 05-29-2007, 06:10 AM   #15
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Nobody should start learning with C. Start with BASIC or PYTHON (the BASIC of the new century) and when you get bored then move on to C, C++, etc.

Edit: Nobody should start learning with C or Perl unless you want them to never code again.

Getting started means needing to understand basic concepts. C and Perl are MUCH too terse and can do way too much without you understanding anything about them to be useful as teaching tools. Those languages are expert's tools to get a lot done with not much code and to be able to do sytems programming (in the case of c).

BASIC or PYTHON let you start gently with the idea of variables, control structures (different types of loops) flow-control (if this, do that) while at the same time being more READABLE. You have to start with the basics or you will get lost quickly and if it's not fun you won't learn and you won't continue.

Last edited by Randux; 05-30-2007 at 06:34 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what language is best to learn io13 Programming 4 07-09-2006 09:17 AM
What Language Should I Learn? KungFuHamster General 45 04-25-2006 02:10 PM
Which C language to learn? Heiland Programming 10 08-14-2005 08:03 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration