ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Java is widely used as the language of choice in Universities / Colleges - it's pretty consistant, the Sun Java compiler gives very good error messages if your program fails to compile, and it's a real object orientated language.
I originally learned to program (BASIC excepted) with Ada95 in my first year of Uni, but I wouldn't recommend anyone goes near it without a compelling reason to do so.
To be honest, it doesn't *really* matter too much what language you choose. C/C++ is the language of Unix, but is a bit heavy going for a first language. Python is popular on Linux, and is easy to learn, but it's odd (e.g. whitespace in your source code actually alters the structure of the logic, which is unusual).
Get a good book on whatever language you choose, though. It's worth the investment. (This book: http://www.powells.com/biblio?isbn=0072230738
got me through University, for example)
At the moment, most of the programming I do is in the shell (I work for a Unix vendor), with a bit of Java if I want a GUI.
This is a tricky question to answer. I personally started with an easy language similar to Python. That said, C is really the language from which all other languages began and you can definately see the similarities.
I wouldn't try learning C as a first language outside a classroom unless you really enjoy 'jump in the deep end' style learning. First first time programmers even things like using GCC and writing basic Makefiles can be a major hassle, and you need that before you write a single line of C.
Since you're just starting out, you may want to look at languages such as Python or Ruby; they're both popular with a lot of documentation (both in books and online). Once you've gotten comfortable with those (or you simply wish to move on), you can tackle some of the more "mainstream" languages like C, C++, Java, or C# (using mono). If you want to deviate from the norm (or broaden your programming thought process) go for powerful, but different, languages like Lisp or OCaml.
...To be serious all the advice give is good. There is no one starting language, and the answer should come from your goals, as in what do you want to achieve. Each language has a purpose a specific niche that they address. C, Java, Ruby PHP, Python, could all be the ideal language, it all depends upon what you want to get out of it.
...To be serious all the advice give is good. There is no one starting language, and the answer should come from your goals, as in what do you want to achieve. Each language has a purpose a specific niche that they address. C, Java, Ruby PHP, Python, could all be the ideal language, it all depends upon what you want to get out of it.
I couldn't agree more. If you find a task you want to complete, then use the language most applicable to achieving that task.
For instance I started off with PHP because I wanted to make web-apps. I started making very procedural scripts, but now that I have completed a couple of projects, I'm learning Object Oriented Programming etc.
Sorry to continue an old post, but this is still an long time process thread since it ll be always new linux incomers.
After few step with bash and good knowledge of basic, I am pointing out myself :
ought I start learning gcc or python ?
I just need some playing around with the strings, files output, saving to files, records database, and scripting automatic stuffs ... nothgin very high-tech but just useful.
The python is said to be easy, I am not bored about sthg easy, just mathematic is always the best, for logic ... for programmnig
Hence, I would rather start with gcc, since it is like "universal" and allmighty ... but might be unappropriate between strings foolling around ...
DIfficult choice for the moment, python or gcc !
(Maybe I am wrong, I am n00b)
First minor point gcc is a compiler the language would be C or possibly C++
Given what you want to do I would suggest a scripting language like Python or Ruby (not to forget Perl or PHP either but a scripting language) The reason for this is that you "need some playing around with the strings, files output, saving to files, records database, and scripting automatic stuffs ... nothing very high-tech but just useful." A scripting language will get you results much faster than a compiled language such as C.
For example in C managing strings is (for a beginner) non-trivial, you need to allocate the memory (never use more than you have allocated!) then assign the data into the variable, remembering to ensure that the string is null terminated (thankfully the majority of the functions that you will learn to use do that for you) Then you will want to pass the string around and so you will need to remember to pass it by reference when you want to be able to modify it and... okay I guess that's sufficient for you to understand that C takes more effort to achieve a simple task and results are important.
Finally, by selecting a scripting language you will be learning more about programing and developing your skills in that area so if you then want to travel the path of C / C++ (Java etc) you will be able to reuse much of what you have learnt.
First minor point gcc is a compiler the language would be C or possibly C++
Given what you want to do I would suggest a scripting language like Python or Ruby (not to forget Perl or PHP either but a scripting language) The reason for this is that you "need some playing around with the strings, files output, saving to files, records database, and scripting automatic stuffs ... nothing very high-tech but just useful." A scripting language will get you results much faster than a compiled language such as C.
For example in C managing strings is (for a beginner) non-trivial, you need to allocate the memory (never use more than you have allocated!) then assign the data into the variable, remembering to ensure that the string is null terminated (thankfully the majority of the functions that you will learn to use do that for you) Then you will want to pass the string around and so you will need to remember to pass it by reference when you want to be able to modify it and... okay I guess that's sufficient for you to understand that C takes more effort to achieve a simple task and results are important.
Finally, by selecting a scripting language you will be learning more about programing and developing your skills in that area so if you then want to travel the path of C / C++ (Java etc) you will be able to reuse much of what you have learnt.
So a python (scripting) would be better than gcc ... hmm
The fear is that most of Unix & linux are written in C. Like ./configure ; make ; make install , the C would be so valuable to understand what is going on and what is happenign really & fix it.
Besides I found the C tootally pure langage : these { } ; are making it very well structured, but I still didnt look the strings HOWTO.
I am right there : http://www.eskimo.com/~scs/cclass/notes/sx4a.html
It goes fast since I know basic, pascal, vb6 ... and GFA Basic (ST). Damn if we had a gfa basic editor in this C langage that could be useful. It bound you to avoid any failures while programming. It obliges you to write correctly and obliges (oups obliged) you to have right tabulation...
which is pain in .... at the beginning but afterwards, you get a wonderfully well structured program that can be well readed after lines to years of code.
Anyhow, I fear that I havent look yet these Strings things with C....
Otherwise,
/usr/bin/run
as sth like:
Code:
#!/bin/sh
clear
gcc "${1}.c" -o $1 ; ./$1
might be rather fine no ?
Code:
run myfirsprogram
Oups for long code ...
==
btw you have strings examples in C... (?)
program.c:3:20: iostream: No such file or directory
program.c:4:18: string: No such file or directory
program.c:3:23: iostream: No such file or directory
program.c:4:21: string: No such file or directory
program.c:5:22: sstream: No such file or directory
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
Start simple, Python is a great choice, I consider it the BASIC of the new century. If we had Python back when I started it would have displaced BASIC. It can do a lot, but you can start simple and it's very readable.
You can learn shell scripting at the same time as you do administrative things with your system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.