Working in Linux, New to coding

EAGLEye52

Member
Jun 10, 2013
87
0
0
So I am currently a junior in high school and want to learn to code. I took a Computer Science intro class freshman year but that was in Visual Basic. I am running linux on my laptop. I've spoken to friends and they've said that in order to learn it would be a good idea to find a small project. I just don't know where to start.I have no idea what language I want to learn or what type of project want to do. Different people have recommended languages such as C++, Java and Python. Can you guys just give me somewhere to start to learn a language and maybe a recommended project idea.
 

sbpromania

Senior member
Mar 3, 2015
265
1
16
www.sbp-romania.com
You can take a look at the *************** or the one below:
HTML5 - HTML5Rocks

HTML5, CSS3 and JavaScript - TheCodePlayer

Wide range of programming languages - Programr

HTML5, CSS3 and JavaScript - Code Avengers

Ruby, JavaScript, HTML/CSS and iOS - Code School

JavaScript, Python and Ruby - LearnStreet

Wide range of porgramming languages - Khan Academy
 

chrstrbrts

Senior member
Aug 12, 2014
522
3
81
I'm not super experienced, so take everything I say with a grain of salt.

But, in my humble opinion, I wouldn't start with HTML (or web development in general).

It's called a markup language for a reason.

It's not really like a true computer language.

Don't get me wrong; it's easy to learn and can get you immediate results.

But there are peculiarities to web development that might obfuscate the basics of computer coding.

Java or Python would be better places to start.

However, the vets here may have a different opinion.
 

dealcorn

Senior member
May 28, 2011
247
4
76
While I also am no expert, I say no to C++ because the learning curve is too steep. Wikipedia is your friend and I would start by looking at the other two there. You should be aware Python's web site provides good quality instructional material for free. I assume the same is true for Java. I suggest for a first project you find something you are interested in. Motivation aides success. My first learning project with Python involved building a GUI app to interact with a SQL database. SQL is widely used and familiarity is often helpful. Ideally, as you work your way through the site provided instructional materials, your project idea will come to you.
 

Gryz

Golden Member
Aug 28, 2010
1,551
204
106
Python is probably the best option these days.

I'm an old-school C-programmer. I think C is still an excellent language to learn programming. You will get an understanding of how a machine works, what if-then-else and for-loops are, what functions are, how memory is used, what pointers are, etc. C is also strongly connected to Linux. Most of Linux is written in C.

C++ is an extension of C. Imho if you are a decent C-programmer, you will be able to pick up C++ pretty quickly. The other way around is not so certain. The benefit of starting with C++ would be that you get object-oriented programming in your blood earlier. (Note that not everyone is a big fan of OOP. I'm not a fan myself). But if you want to pick up OOP early, then you could just as well start with Java or Python.

Java can be a bit overly complex. And lots of the complexity is hidden under the table. And you need the run-time environment. I think Java is the main language for teaching programming in universities these days. But personally, if you wanna go OOP, I think Python might be the better option these days.

So yeah, I think you should start with Python. If you want something a little more hardcore, go with C.

An idea for a project is a bit harder. But the one thing to understand is: don't be over ambitious. Go with someone small. Go with something easy. Programming in itself can be hard enough. Don't try to solve something that is mathematically complex. Don't start with a graphical user-interface, just use simple I/O in a terminal-window. Once you get going, you'll find new idea on how to progress.
 
Last edited:

DrMrLordX

Lifer
Apr 27, 2000
22,377
12,191
136
Question: are you going to be coding only in Linux, or do you want to be able to run the programs you write on other operating systems as well? If so, both Python and Java should be very portable across different operating systems.
 

nrobidoux

Member
Nov 2, 2015
28
0
0
I think C is still an excellent language to learn programming. You will get an understanding of how a machine works, what if-then-else and for-loops are, what functions are, how memory is used, what pointers are, etc. C is also strongly connected to Linux. Most of Linux is written in C.

I agree. Many languages hide some of these things like Java (pointers), PHP (data types).

I learned C originally off of some floppy disk my dad had laying around but I found this great book many years back. If you can find it I would buy it. It takes you from C, to C++ to advanced C++ concepts to the STL (at the time of publishing). Basically zero-to-hero in one book with plenty of practice problems for everything. Any question I had this book could answer and I usually could find it faster than going through Google and Stackoverflow. (I did a lot of flipping :) )

Ivor Horton's Beginning C++ : The Complete Language ANSI/ISO Compliant (Wrox Beginning Series)
ISBN: 186100012X
 

sm625

Diamond Member
May 6, 2011
8,172
137
106
You have to start with something you'd like to do with a piece of software. It helps to have hardware associated with it. For example, would you like to control your lamp using your PC? If so you would buy a cheap usb relay board

$_35.JPG


and you download the drivers and libraries that you need to communicate with it. Then you write your own little dialog app that starts with simple ON and OFF buttons.

Later on let's say you'd like to add the ability to turn that light on from your phone. So you begin to look for software and bits of code that will let you do that. If you keep doing this and keep adding little bits and pieces you eventually end up with a project that is actually pretty elaborate and powerful and you learn a lot along the way. But the most important skill is being able to clearly define the type of problem you would like to solve with a piece of code. That's always where it starts.
 

wiseguyin

Member
Nov 2, 2015
27
0
0
You have to start with something you'd like to do with a piece of software. It helps to have hardware associated with it. For example, would you like to control your lamp using your PC? If so you would buy a cheap usb relay board

$_35.JPG


and you download the drivers and libraries that you need to communicate with it. Then you write your own little dialog app that starts with simple ON and OFF buttons.

Later on let's say you'd like to add the ability to turn that light on from your phone. So you begin to look for software and bits of code that will let you do that. If you keep doing this and keep adding little bits and pieces you eventually end up with a project that is actually pretty elaborate and powerful and you learn a lot along the way. But the most important skill is being able to clearly define the type of problem you would like to solve with a piece of code. That's always where it starts.

I liked this suggestion but dont think this is what OP meant in his question. The best way to learn something is of course to have goal oriented tasks completed with the language you want to learn.

When I was beginning I used to frequent various forums and see if people wanted programming help and then work on those problems to see if I could come up with any solution. The other way (also done when I was beginning) was to join an open source project and contribute.
 

KIAman

Diamond Member
Mar 7, 2001
3,342
23
81
The best way to get your feet wet is to do a real project that meets a real requirement. If you ask around, there are plenty of people, local business, mom-pop places that have some sort of pain point that can be solved with a tool. This is how you get the idea for the project.

Get really focused and deep into making this tool. Use the appropriate resources for the tool, don't be completely brainless (if the tool is a site, obviously use a language that produces markup for example). Don't worry about "broadening" your learning and just REALLY focus on making this tool address the problem then once you are done, give it to them and ask for feedback. Based on that feedback, refine it then give it to them again.

Once you got an understanding of how to go from a problem to a solution, then you can start broadening your understanding of coding including the development process, requirements, design, implementation, testing, validation, apply it to what you did and how you could have done it differently/better. Because you went deep into your tool, now is a good time to broaden your understanding of the concepts you needed for your tool (structures, complex conditions, algorithms, whatever it is).

The point is, my philosophy of "jumping" into the coding world is from a "bottom-up" approach. You focus and go deep on a very specific a limited and narrow task then slowly add the layers of understanding from there and move your way up to the bigger and broader picture. Too many times, I see people take the high level approach and learn about concepts, patterns, methodologies, project management, theory, etc, all before they do any practical implementation and end up being overwhelmed or simply just not "getting it" and go into a career of being an analyst instead.

TL;DR: Don't be an analyst.
 

Merad

Platinum Member
May 31, 2010
2,586
19
81
C++ is an extension of C. Imho if you are a decent C-programmer, you will be able to pick up C++ pretty quickly. The other way around is not so certain.

No offense but this an opinion that's 20+ years out of date. Modern C++ is a totally different beast from C, and the two languages have been on divergent paths since the 1980s. People who think "C++ is an extension of C" are usually the type who write C++ as "C with classes" and never touch the other 50% of C++.
 

Gryz

Golden Member
Aug 28, 2010
1,551
204
106
People who think "C++ is an extension of C" are usually the type who write C++ as "C with classes" and never touch the other 50% of C++.
Please enlighten me.
What is the "other 50%" of C++ that is so useful, that C misses ?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Please enlighten me.
What is the "other 50%" of C++ that is so useful, that C misses ?

Inheritance, polymorphism, strong encapsulation, operator overloading, templates... haven't written any C++ in four years so I probably missed a couple of things.
 

Merad

Platinum Member
May 31, 2010
2,586
19
81
Please enlighten me.
What is the "other 50%" of C++ that is so useful, that C misses ?

Stronger type system
Lambdas/anonymous functions/closures
Functions are first class objects
Basic templates (generic data structures, etc)
Template metaprogramming (templates are turing complete)
Type safe compile-type calculations without template metaprogramming (constexpr)
Range based for loops
Move semantics
Smart pointers
RAII
User defined literals
Standard library support for threading, atmoic operations, high quality random number generators, common algorithms

I'm sure I've missed a lot, I'm not totally up to date with the latest C++14/C++17 changes.
 

Gryz

Golden Member
Aug 28, 2010
1,551
204
106
Inheritance, polymorphism, strong encapsulation, operator overloading, templates... haven't written any C++ in four years so I probably missed a couple of things.
Four out of five of those I would call being part of "C with classes". Operator overloading is indeed nice.

Stronger type system
That would be nice. But I believe this has mostly to do with casting, right ? When you cast a type to another type in C, you are on your own. Mistakes are made easily. (This is the reason I seriously try to have as few casts in my code as possible). And C++ is smarter when casting. Did I miss something ? I like the strong typing of C (as compared to e.g. Python). It has saved my ass many times. If C++ improves that, I'm all for it.

Functions are first class objects
I would share this under "C++ is C with classes". :)

Basic templates (generic data structures, etc)
Template metaprogramming (templates are turing complete)
Type safe compile-type calculations without template metaprogramming (constexpr)
Indeed I am a C-programmer. And it's been a long time since I looked at C++. But one of the things I remember was the adagium: "if you want to use C++, that's ok. But please try to minimize the usage of templates".

Range based for loops
Very minor.

Smart pointers
I can do that myself. And probably better. Pointers (and my own memory management) are one of the main reasons I prefer to use C.

Lambdas/anonymous functions/closures
Move semantics
RAII
User defined literals
Standard library support for threading, atmoic operations, high quality random number generators, common algorithms.
These things seem to be too complicated for me to figure out quickly. So I'll believe you when you say these are useful additions.
 

Merad

Platinum Member
May 31, 2010
2,586
19
81
That would be nice. But I believe this has mostly to do with casting, right ? When you cast a type to another type in C, you are on your own. Mistakes are made easily. (This is the reason I seriously try to have as few casts in my code as possible). And C++ is smarter when casting. Did I miss something ? I like the strong typing of C (as compared to e.g. Python). It has saved my ass many times. If C++ improves that, I'm all for it.

The opposite, really. C's weaker type system allows implicit conversions (without casts) where C++ requires you to cast. If you want to allow implicit conversion in some cases you overload cast operators to allow it.

I would share this under "C++ is C with classes".

Not quite. You can't implement clean function objects with simple classes - you need variadic templates.

Indeed I am a C-programmer. And it's been a long time since I looked at C++. But one of the things I remember was the adagium: "if you want to use C++, that's ok. But please try to minimize the usage of templates".

A common opinion of people who don't really know how to use C++. :) There's no reason whatsoever to avoid templates. They allow you to implement type-safe abstractions at compile time with zero overhead that have to be implemented at runtime or with some performance overhead in most other languages. It's possible to go a little crazy with them (Boost libraries are often guilty of this), but they are incredibly powerful even at the basic level.

I can do that myself. And probably better. Pointers (and my own memory management) are one of the main reasons I prefer to use C.

I don't think I've ever met a programmer who was bad at manual memory management. Yet somehow it remains an incredibly common source of bugs and security vulnerabilities.
 

Gryz

Golden Member
Aug 28, 2010
1,551
204
106
The opposite, really. C's weaker type system allows implicit conversions (without casts) where C++ requires you to cast. If you want to allow implicit conversion in some cases you overload cast operators to allow it.
Could you use this stronger type-checking in pure C programs too ? E.g. when you use gcc, can you add a flag at the commandline to force gcc to do this ?

A common opinion of people who don't really know how to use C++. :)
I'm not claiming I know enough about C++ to have an opinion. But I have read this argument often enough to believe that templates are a mixed blessing at best. (See my remark about the KISS-principle below).

I don't think I've ever met a programmer who was bad at manual memory management. Yet somehow it remains an incredibly common source of bugs and security vulnerabilities.
Sure, people probably over-estimate their own capacities. I used to work in an area where it was pretty important to have full control over your memory allocation and data-structures. E.g. the software would be running for months or even years, without a reboot. In a dynamic environment (with frequent mallocs and frees) that can cause severe memory fragmentation. So you need to do something special to prevent that. I think I'm pretty paranoid, and have enough experience to avoid making the common mistakes. (I've never had a memory-leak in my code). I think if you'd use C++ in my area, you get more headaches than you solve.

Of course, in most other areas, and for most programs, this would not be a problem. And C++ is a good option. But for some areas, people still prefer C.

Also, I am a strong believer in the KISS-principle. With all the extra rope that C++ gives you, it is easier to hang yourself.
 

nrobidoux

Member
Nov 2, 2015
28
0
0
Wowser. Lots of words.

Aside from STL I still consider C++ an extension of C.

STL has me thinking C++ is Java w/ C-like syntax.

Back to the OP. Noticed "working in Linux" in your title this time around.

As most people have mentioned, you need a goal or task. I've found from that you'll determine what language you'll use. If you truly end up "working in Linux" you'll probably be using a combination of shell-scripting calling modules programmed in various languages best suited to their particular tasks.

Having been exposed to and used: x86 assembly, C/C++, Java, PHP, and erlang, each has their strengths and weaknesses.

For instance, I like PHP when manipulating strings. There are many functions that provide much more complicated behavior for common tasks than other languages. Before classes came around I found it more intuitive to use PHP to organize more complicated sets of data into arrays because of its indexing mechanism.

I literally googled how to socket program just so I could use PHP for those very things and return the results to the calling program.

Java, for me, is just a "necessary evil" for pursuing android app development. (Also much faster to learn in that context as opposed to using C/C++ with the NDK. At least that's what I found.)

Assembly. I like to micro-optimize... also I like the complete freedom of it. Your code either works or it doesn't. There's not many compiler warnings / errors. It's a challenge and you need a low-level understanding of computer architecture to really squeak out all you can from your code.

erlang. Not the best for number crunching but crushes most other languages when it comes to threading. "Micro-threading" is what erlang does by default.

Got a little carried away... depending on your task, the modules called from your shell-script may interact with other apps or services that provide their own interface. Services like MySQL and Redis.

But in the beginning when you're learning things will be quite simple. I would suggest finding projects (i.e. google "simple programming projects") or coming up with your own. I use to TA an intro C class and one that I thought was interesting (and the only one that I can remember after 15 years) was writing a text-based calculator that can handle up to a 100-digit long number.

For that you need to handle I/O, re-/create the logic needed to handle these simple arithmatic operation, string manipulation, basic string parsing and more.
 
Last edited:

LevelSea

Senior member
Jan 29, 2013
942
53
91
Sure, people probably over-estimate their own capacities. I used to work in an area where it was pretty important to have full control over your memory allocation and data-structures. E.g. the software would be running for months or even years, without a reboot. In a dynamic environment (with frequent mallocs and frees) that can cause severe memory fragmentation. So you need to do something special to prevent that. I think I'm pretty paranoid, and have enough experience to avoid making the common mistakes. (I've never had a memory-leak in my code). I think if you'd use C++ in my area, you get more headaches than you solve.

Of course, in most other areas, and for most programs, this would not be a problem. And C++ is a good option. But for some areas, people still prefer C.

Also, I am a strong believer in the KISS-principle. With all the extra rope that C++ gives you, it is easier to hang yourself.
There's no requirement to do any dynamic allocation in C++. All my embedded real time projects are in C++, with no dynamic allocation at all.

IMO, the only reason to use C over C++ is if you don't have a C++ compiler or you don't know C++. Even in cases where you have to interface with a language that needs C (Fortran, etc), you can always use extern "C".
 

Gryz

Golden Member
Aug 28, 2010
1,551
204
106
There's no requirement to do any dynamic allocation in C++. All my embedded real time projects are in C++, with no dynamic allocation at all.
That's very cool.
However, not all embedded real time projects are the same.
 
Last edited: