Jump to content

Which code language should I learn?


mrmcp1

Recommended Posts

I have recently become interested in learning to code but I have no idea of which language I should learn. So I thought maybe I should ask which I should learn.

If it helps I am interested in learning to use and program an arduino board.

Sorry if this question is a bit vague.

Link to comment
Share on other sites

Depends on what you want to do with that language. If you want to script Excel, learn Visual Basic. If you want to write drivers, learn something like C.

I would learn C or C++. They are difficult languages to learn, especially as a beginning language, but a large number of languages borrow syntax and concepts from them, which opens the gate to easily learning a number of other languages. Of the two, I would try C++ as it is an "expansion" of C. i.e. anything that C can do, C++ can do exactly the same but with classes.

If you want to start slower, though, try something like Visual Basic. It's used for scripting Office applications, and the editor is available with any copy of Microsoft Office. It's a simple enough language that includes a large number of major concepts used in programming with miles of documentation around the internet. It's also JIT (Just In Time) compiled, which means that you can run through it line by line as opposed to all at once.

Though, if you're looking to program an Arduino, they appear to have their own IDE (Integrated Developer Envirnoment. The program you use to write programs): https://www.arduino.cc/en/Main/Software

So, if that's your only goal, pick a language supported by the IDE (which may be a language made specifically for programming Arduino).

Link to comment
Share on other sites

Java or C#. Both are easy to learn, and since they're so similar, knowing one of them makes learning the other one a breeze. As for the Arduino - I really wouldn't recommend using one. The Arduino language is VERY limited and lacks many of the basic functions you can find on other programming languages so it's only good for very simple things.

Link to comment
Share on other sites

Java or C#. Both are easy to learn, and since they're so similar, knowing one of them makes learning the other one a breeze. As for the Arduino - I really wouldn't recommend using one. The Arduino language is VERY limited and lacks many of the basic functions you can find on other programming languages so it's only good for very simple things.

I'd argue that for someone with no experience, Arduino's flavor of C is pretty good. It's simplified enough to make it easy and the majority of materials on learning Arduino are very good at holding a beginner's hand... Once you get the basics, it's close enough to "real" language for an easy jump if you're so inclined.

Btw, if going Arduino do yourself a favor and buy a couple of project books. Online tutorials are nice, but books tend to give you a more cohesive A > B > C > D lesson plan which you can supplement with internet later.

Link to comment
Share on other sites

Learn the language you need for what you want to do. For Arduino that's C++ or C. I'd go with C++ because I think you're better of learning an object-oriented language from the start. I grew up with procedural languages like Basic and have really struggled to understand OO.

Link to comment
Share on other sites

Learn (at least) 3: C++/C#/Java for an Object Oriented language, C for a procedural language (but more to understand memory management), F#/Haskell for a functional language. Learning ASM for some microcontroller is a good idea as well, the Atmel AVR instruction set is that used for the Arudino.

OO languages are popular, and generally pretty good. They solve lots of practical problems.

C is important to understand memory management. That's VERY important for good design (especially security), even when you've got a garbage collected language. It's also good to know because just about everything can call C and be called by C, so if you want to write programs that use different languages you'll use C as a shim. Assembly fits in here as well, for just about the same reasons. It's also useful to know for debugging and optimization, and if you're doing things with microcontrollers it's much more useful.

Functional languages (especially Haskell) are good for understanding the theory of computing. So if you want to learn computer science, learn one of them.

Rust/Scala/Erlang and other multi-paradigm languages are nice, but it's better to stick to a single core idea (OO, Procedural, Functional, etc) at a time when first learning.

Link to comment
Share on other sites

c++ seems to be the most versatile. its also good to know some c. i also like lua and think it is highly underrated.

- - - Updated - - -

Java or C#. Both are easy to learn, and since they're so similar, knowing one of them makes learning the other one a breeze. As for the Arduino - I really wouldn't recommend using one. The Arduino language is VERY limited and lacks many of the basic functions you can find on other programming languages so it's only good for very simple things.

"arduino language" is really just c++ with a couple of (sometimes annoying) transformations happening behind the scences. in many cases you can take the same arduino board and get a copy of avrstudio and program it straight c/++ without the arduino baggage.

Edited by Nuke
Link to comment
Share on other sites

I think C (and C#) is a versatile yet (more-or-less) easy language to learn. I started out with Pascal then Delphi, and after that I moved to C and C# (Btw, I'm not a programmer).

Edited by jmiki8
Link to comment
Share on other sites

tbh, I think it is more important to learn the concepts of programming rather then just a language. When you have grasped the concept it is not so difficult to change programing language, it is mostly diffrent syntax. The way you need to think and how you approach the problem will be very similar. I would say C# or Java as a first language as they have a quick and easy way to create a graphic user interface.

Link to comment
Share on other sites

-warning, this post contains big words, but the point is clear, I swear!-

C, or Python is where I would start for programming in general, but for eventually learning to use Arduinos specifically I might especially recommend C. (both are strictly procedurally driven if I recall, but Python is object-oriented, i.e different ways of doing the same thing)

Python is probably the simplest, but it neglects some important programming concepts (mostly in object-oriented programming, encapsulation, for example), but you can literally start programming Python as soon as you download a single file, whereas with C you may have to figure out how to use your IDE (like notepad, but fancier) (if applicable), or the proper command line syntax to compile .c (C language file extension) files. Once you've figured that out though, it's not a huge problem. Just a bit more of a barrier to actually starting to type code.

A quick pros and cons run down:

C:

Pros: Similar to the Arduino language, very powerful

Cons: somewhat complicated, low-level so some concepts (like pointers) may be confusing

Python:

Pros: Simple to download/use, more and more people are using it as their first programming language, simpler workflow (no compiling)

Cons: some things may be harder to do in Python than C, a bit different than most modern programming languages (whitespace indentation, no "private" or "public" variables, no explicit typing of variables, though these all do make the programming language easier to use)

And I would never, ever describe C++ as "C with classes", while most C code will run in C++, it'd be not idiomatic at all, and half of programming is knowing the proper idiomatic way to do things,

print("10") is nice,

-

x = (((3 * 3) + 1) / 2) * 5

print(x)

probably isn't.

But now i'm starting to sound like a crazy person, so i'll stop there.

Quick notes on C++, C#, Java, and other languages:

C++ is nice, but complicated. Multiple ways of doing things may cause headaches when you try to read code that has using namespace std and you can't figure out why it's not working.

C# and Java are very similar, so i'll approach them together, they're very strongly typed, meaning you'll be clarifying things to the compiler very often. Once you understand what all the terms mean though, they're very powerful (and readable!), where in python you'd say "x = 5", in C# you'll be saying "public int x = 5"

Extra resources specifically concerning C vs Python:

Python vs C: A Beginners Guide

As a beginner, should I learn C or Python as my first programming language?

Is it a good idea to learn Python before C or some other compiler language?

And whichever programming language you ultimately choose, remember this: whenever you get an error you don't/can't understand, always enter it into Google. Chances are, someone's had a "ClassError: 'foo' doesn't have permission to access 'bar' from parent class" before.

(personally I started with Python, then moved to C#, then to C and C++ (roughly around the same time))

Link to comment
Share on other sites

SfwhyBN.jpg

I would suggest Python, simply because it's one of the easiest to learn. And, once you've got one language under your belt, you can very quickly switch to another, simply by learning the syntax. Learning "how" to program is more important than learning any one language.

Link to comment
Share on other sites

http://i.imgur.com/SfwhyBN.jpg

I would suggest Python, simply because it's one of the easiest to learn. And, once you've got one language under your belt, you can very quickly switch to another, simply by learning the syntax. Learning "how" to program is more important than learning any one language.

For the first picture:

error C2065: 'cout' : undeclared identifier

Silly picture maker. Forgot the std namespace

Link to comment
Share on other sites

I agree with Prime flux ...

IMHO it is most important for a beginner, to learfn the concepts of objectoriented programming.

Therefore IMHO it would be best to learn Java as a first language ... more beginner friendly than C++.

C++ has a few topics ... for example pointers *wink* ... which may be easier to understand by people who already have exüerience with another OO programming language

Link to comment
Share on other sites

You should start with either COBOL or INTERCAL.

Once you have learned either one of those to a sufficient degree, switch to C. Once you switch, you'll be so happy to never touch the original language that programming will seem so easy.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...