LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   New to both Linux and Programming (https://www.linuxquestions.org/questions/linux-newbie-8/new-to-both-linux-and-programming-4175436710/)

ramos26 11-11-2012 07:18 PM

New to both Linux and Programming
 
I'll give you some background info before I start asking away.
I have my CCNA & A+ certifications. Not the best certs, but it's a start. My main goal is to broaden my knowledge, learn to program, and to learn Linux.

I have used Linux in the past, but know virtually nothing about it. I have used and installed Ubuntu, but only as a GUI, and have never touched the CLI. Knowing my goals, which distro do you guys think would I learn more from? At the same time, which distros are more programmer friendly (Come with IDEs or pre-installed programs to help me learn, if any?)

While I do know that a lot of programming languages can be similar, I'm still wondering which to approach first. I would like to start out with a language that has an easier syntax and fairly easy to pick up. Hopefully after mastering one, I can pick up others with ease. So my second and final question is simple and I know it gets asked a lot. Which programming language is easiest to learn first, and why?

Also if anyone knows of any tutorials that aren't completely boring and mind numbing, that would be awesome as well. Thanks in advance for all of your input!

chrism01 11-11-2012 07:31 PM

Any distro gives you access to the cmd line aka cli, so if you like Ubuntu, you can stick with that (to start).
All the major distros have stuff like IDEs (may need to install with GUI).
See www.distrowatch.com

At work I'm used to only having the cli env and using vim :)
Historically, real servers don't have a GUI ...

You'll need to learn a shell lang which is used at the cmd line. There is more than one available, but the default for Linux is usually bash, so I recommend these links
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

Along the way, you'll also pick up the basics of awk and sed.

For a more advanced scripting/programming language, I like Perl, but (like editors) you can start a flame war if you're not careful ;)
Try a few, its all free :)

It depends what kind of programming you want to do.
low-level/heavyweight stuff, I'd go C.
For RDBMS' you need SQL ...

Incidentally, here's a website with a load of free to read manuals/books: www.linuxtopia.org

Welcome to LQ :)

ramos26 11-11-2012 07:39 PM

Wow, Thanks for the quick response!

Bash is going to take a little getting use to, or so it seams!

I am looking to learn an actual programming language as well. I've read up a bit on python, perl, and C. However, I know nothing about Perl. It's worth looking into though. It's a little overwhelming, having so many options available, to be honest.

Thanks for all the links and response. Looks like I have some reading to do!

One other question, though. How do you feel about running Ubuntu, or any other distro, on a VM? I currently Virtual Box on my PC. Are there any major drawback, or do you suggest just installing it on another partition?

Thanks!

btmiller 11-12-2012 12:41 AM

For what you want to do, running it in a VM should be fine. The only time I might recommend against it is if you plan to be doing heavy graphics work (there can be issues with virtual graphics cards, or at least there were back when I looked into it).

As for programming, what do you want to develop? I personally like Python a lot (good for rapid development and IMO easier to read than Perl), however it's not ideal for everything. For example low level system programming or very performance critical code would probably be better written in C or even assembly (but of course a Python or Perl interface can be built to C code).

ramos26 11-12-2012 01:11 PM

I actually think I'm going to start with Python. I don't have any goals in mind yet. Just trying to broaden my horizans and learn new skills. I've only played with Python and Java so far, but Python just seems easier and more straight forward. It seems like I spend too much time defining classes and what-not in Java. Python just feels "right" somehow. Thanks for your input!

johnsfine 11-12-2012 01:29 PM

I think Java has a cleaner syntax than most programming languages.

Java needs an unfortunate amount of stupid looking overhead to make a minimal program. It is easier to copy someone else's "hello world" program in Java and then edit it to do whatever simple job you want, vs. write a simple Java program "from scratch".

Java also has a significant amount of declaration overhead (certainly compared to Python) to add the simplest variable or function to a program.

But Java is a much better language than Python and those overheads are a large part of the reason.

The design of Python encourages you to slap together a mess of a program quickly. For the simplest programs that design just makes it quicker to get from zero to trivial, and you won't see the flaws in the language design.

But as you try to get from trivial to real, the design of python and the bad habits you pick up writing trivial Python programs will lead to badly structured programs that are hard to grow and enhance.

Java is a much better language than Python. C++ is a much better language than Java, but enough harder to learn that I wouldn't try to give C++ as the answer to your request.

Bash is a programming language with such a nasty unreadable syntax, it is almost the opposite of your request for an easy syntax. That may be a necessary consequence of bash's role as a simple command line syntax that extends smoothly up to a full programming language.

You asked about learning command line Linux as well as asking about learning a programming language. But if you would use bash just as a command line processor, there is little point to even learning command line Linux. You could do almost everything easier and better in GUI mode. For the occasional thing you need to do by command line, you could just paste some command you found online (such as in an answer here at LQ) into a terminal window and not worry about why it works. To get real benefit from command line Linux, you should learn bash as a programming language, despite its nasty syntax.

btmiller 11-12-2012 03:43 PM

I strongly disagree that Java is unconditionally a much better language than Python. Sure, you can write absolute sodden messes of unmaintainable Python code (I've done this, I'm rather ashamed to admit), but the same can be said for Java. At the end of the day, it's down to the skill of the programmer, not the language, although I agree some languages (e.g. Perl, bash) make it much easier to write unreadable masses of code. I'd disagree, however, that Python falls into this category. Sure, it has the (minor) disadvantage of not being strongly typed, but this should not be a large issue to a careful programmer. Python contains much of the same structure as Java (object oriented with classes, inheritence, etc.). It doesn't necessarily force the programmer to use it the same was as Java does, but the structure is there and IMO much easier to deal with for a beginner (and even a more experienced programmer) than Java. I'm much more of a system admin than a programmer, but I've used both languages extensively. I'd be interested in being shown why I'm wrong, but what you're saying does not square at all with my own experience.

For similar reasons, I dispute that C++ is a much better language than Java. More powerful, definitely, but by that logic the most powerful language would be real mode assembly since you can, quite literally, do anything you well please to the hardware with no pesky OS or libraries to get in your way. However, C++ commits many of the same sins that you ascribe to Python. To wit, it does not force the user into an OO paradigm. Witness the fact that most valid C programs (even those written in a purely procedural style) are also valid C++ programs and you'll see what I mean. C++ has some nice features (e.g. multiple inheritence), but Python also has this (whereas Java does not AFAIK -- just a way to both inherit and implement an interface; what C++ or Python would call an abstracy base class). So your ordering of languages Python < Java < C++ makes even less sense to me and IMO is not particularly helpful to the OP. What criteria are you using to judge here?

johnsfine 11-12-2012 04:27 PM

In each of Python, Java and C++ I have done far more maintenance of terrible code written by others than I have done creation of new code. So that has colored my opinion of the three languages.

In any of these languages, a maintenance programmer frequently comes across a reference to a member of an object and has no clue of the significance of that member. Who set it to what value, where and why?

In Java or C++, one can pretty easily find the declaration of that member through the declaration of the class or its base classes. Similarly an IDE can navigate the class and find you all references to that member.

But in Python, the member is not declared anywhere. You can't even find its type. You can't find all references (assuming like most problem members in most bad code it has a common name for which grep would find a hundred non references for every reference). It is likely only a member of the specific object instance that is being referenced and isn't even a member of other objects of the same type as that instance.

Java and C++ code has much more statically determinable meaning. Looking at the relevant declarations is generally enough to tell you the meaning of a chunk of code. But Python code has meaning much more often determined by the execution history of the program. Without knowing everything the program will have done before reaching a specific point, you often have little clue what the code at that point would do.

There are certainly counter examples: Java or C++ code where you can't begin to guess what might get called at run time by some call in the source code and the only hope of finding the meaning is to set a breakpoint there and run the program in a debugger. But the language design tends against that kind of confusion, where the Python language design favors such confusion.

clocker 11-12-2012 04:48 PM

Now that you have all these folks answers just put some mud on youe hands and start coding. c++ is faster and direct and a true example of object oriented language.

kindofabuzz 11-12-2012 05:11 PM

Just my 2 cents, but if you are smart, you shouldn't even have Java installed on your computer. Java is for phones, that's about it.

framp 11-12-2012 05:49 PM

That's a very interesting discussion going on here ...

Quote:

Originally Posted by ramos26 (Post 4827300)
...I would like to start out with a language that has an easier syntax and fairly easy to pick up. Hopefully after mastering one, I can pick up others with ease...

C++ has no easy syntax and a much more complicate semantic. That's why I don't suggest to start with C++.

See my following pro/con list of Python vs Java

Java:
+ Statically bound (if you don't use reflection ... and you will not use if you start with JavA ;-) )
- Compilation step needed (alternative: Use groovy - but then you will not use Java any more ...)
- Coding overhead in particular for collection handling

Python:
- Dynamic binding - allows much more relaxed coding but is difficult to maintain
+ No compilation needed. Just execute the program
+ Powerful collection handling

Frankly I suggest to start with Python - but the drawback will be - you're not forced to get familiar for strong typing. If you will participate in big projects strong typing will be used (Java and c++). If you know you will work in a big development project just start with Java and you will get used to strong typing. If you're supposed to create code for smaller projects I suggest to start with Python. But be aware you'll hate Java later on because you will get used to the freedom you have in Python with typing.

ramos26 11-12-2012 07:24 PM

I didn't intend to start a flame war here!

But thank you for all of the insight and wonderful opinions. I took Java in college and hated it for the reasons above. I do see myself moving on to more powerful programming languages in the future, though. I don't know if anyone is familiar with this or not, or if it's even relevant, but I have programmed in a proprietary language called "DM" to make byond games. I did it for a few years while in college and picked it up rathe quickly. They describe their language as :

Quote:

The language is called DM, and was created specifically for BYOND. It is object-oriented and extremely flexible, using a C/C++ inspired syntax, but without any of the confusing aspects of C++ or Java. People new to programming will find this about the friendliest language around, while experienced programmers will find they can do pretty much anything with it.

To provide a slightly more technical summary, DM is a dynamic-binding, introspective, fully-polymorphic, single-inheritance language. Objects know what they are, can be queried at run-time as to their attributes, and lists can contain arbitrary sets of objects. Thus there is no need for templates. DM has no concept of protected or private functions, and there is no custom operator overloading (though BYOND has some built-in operator overloading). You can extend or override almost any object or function in the system.
With this being known, does anyones opinion change? Would I be easier just continuing with what I know and starting with C++ (Since it is object oriented) or is this going to be a completely different monster than what I have experience working with??

TobiSGD 11-12-2012 07:40 PM

I find it rather strange that you state that you are new to programming when you already had classes in Java and several years experience in another language.
But anyways, in your case, since you don't like Java and have experience in a C/C++ like language it would think that you should try C/C++.

btmiller 11-12-2012 09:45 PM

Personally, C has been and remains my favorite language (with Python being #2). Most people don't realize that it's possible to do many OO tricks (including inheritence, polymorphism, and even exception handling) in C, it's just that the language doesn't provide any syntatic support for them (and doing exceptions via setjmp/longjmp is just incredibly ugly, error prone, etc.). Still, I don't necessarily recommend it as a starting language, especially if one wants to learn objected oriented programming, design patterns, etc.

@johnsfine -- interesting perspective. I don't agree with your opinion, necessarily, but you definitely raise a good point about members of any object that can be essentially created in a free-for-all process.

@kindofabuzz -- actually, most of the Java programming I've done is J2EE server side stuff (EJBs, CORBA, and all their friends). It was a long time ago in a previous life, and I always thought that it was a bit over-complicated. Still, lots of big business systems definitely still rely on Java; it's not just for mobile phones!

freelinuxtutorials 11-13-2012 12:24 AM

if i have to recommend, it would be C, perl and python. good luck :)


All times are GMT -5. The time now is 08:11 PM.