Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
straight_stewie

How to Pick a Programming Language

Recommended Posts

Posted · Original PosterOP

There are constantly threads being posted that say "I'm new to programming and would like to know which language is best for me". Hopefully this thread can help you decide, as well as possibly give you some resources for learning.

Some Background

Spoiler

There are 1000's of programming languages. There are different types of languages. Each type is suited to a certain task, and inside each type, each language has different strengths and weaknesses, different syntax, and different ways of working "under the hood". This guide will not get into how a professional developer/architect should choose the best language for a specific task, rather it will focus on how the person who has never learned a programming language should choose their first language. Considerations will include price, difficulty, capability, and available learning resources. So let's get talking about the different categories of languages.

 

Categories of Languages

Spoiler

There are many different categories of languages. A language category is a family of languages that all share similar features. For example, the two basic families are Object Oriented Programming and Imperative Programming. In object oriented programming, you solve problems by creating, using, and modifying objects. Objects are just an abstract way of describing some "thing" that can both hold data and do actions. In Imperative Programming, the programmer must explicitly walk the computer through all steps of solving the problem (many object oriented languages must also be imperative, such as C++, C#, Java, and Python).

Here are some classes of languages that beginners should be concerned with or know about and a short description of each:

  • Imperative Languages Some examples are: C, BASIC, FORTRAN, COBOL. (only truly imperative languages are listed here). These languages are basic languages. The normally have a 1:1 representation in assembly. They are usually pre-compiled (although they can be interpreted) and the programmer must explicitly tell the computer every single instruction. They are good when you need to solve problems with speed or when there are certain, shortcuts you can use that won't work in other paradigms.
  • Object Oriented Languages Some examples are: C++, C#, Java, Python, Lua. These languages are based around making objects that can be interacted with. Objects can store "state" such as the color of a car, and can perform actions, such as turning the car on. Normally, the developer is also concerned with the imperative aspect, as that is usually how the objects are programmed to hold their data and do their actions. These languages are good for working in teams, or when modelling the real world (abstract objects can be made to represent real world items)
  • Functional Languages Some examples are: F, F#, Haskell. These languages are based around functions. They are based on the idea that programs can be expressed as the evaluation of functions on immutable data. 
  • Symbolic Algebra Systems Some examples are: MatLab and Wolfram Mathematica. These are very good at doing very complex and hard math. They will normally include plotting utilities and other special utilities related to doing math. They usually have very nice features that make working with arrays/matrixes easier.
  • Scripting Languages Some examples are: Bash, PHP, WinBatch. These languages are good for opening files, turning other programs on and off, reorganizing/naming files, and performing common maintenance/administration tasks.
  • Markup Languages Some examples are: HTML, XML, XHTML. These express the layout of a document. They are not very good for general programming, and most are not even turing complete.


Now, let's choose which language we want to learn:

Language Recommendations

Spoiler
  • Each Language is a link to that languages main website.
  • Do you want to solve complex tasks/learn a good understanding of how a computer works and why things are the way they are? If so, choose an imperative language like C.
  • Do you want to solve complex tasks by breaking down pieces of the problem into objects and then working with those objects while having some nicer features than Imperative Languages? If so, choose an Object Oriented Language like C# or Python
  • Do you want to solve problems by turning them into math problems and not caring about how the computer works under the hood? If so, choose a Functional Language Like Haskell
  • Do you want to do complex math for science or simulation (not game simulation). If so, choose a language like MatLab or Mathematica.
  • Do you want to automate administrative/maintenance tasks? Choose a scripting language like Bash or WinBatch
  • Do you want to learn how webservers work on the frontend to dole out webpages and handle connections to users? Choose a language like PHP.
  • Do you want to make webpages or markup documents so that computers can work with them better? If so, choose a language like HTML.

If you don't know what you want to do, choose python. It's free, it's easy, it's widely used, and there are many resources to help you learn it.


I hope this helps you get started, and answers atleast the general question of "which language should I choose". Programming is a very deep topic, and explanations of how things work or why they are the way they are are out of the scope of this post.


Teacher: Does anyone have a thin ruler?

Students: No.

Teacher: Ok. Does anyone have a nail file.

Students: Why do you need a nail file?
Teacher: I have a staple I need to remove.

Student: Oh. I have a staple remover...

 

People don't want power drills, they want holes.

Link to post
Share on other sites

This is an awesome summary, thank you for providing it! Perhaps you may also want to include notes on what can be done for free? I know if I was just starting, I'd want to start with something free to test the waters, per se, before diving in.

 

For example, Mathematica and Matlab are in the neighborhood of $300 and $1k USD respectively, so it may be worth noting that you can perform mathematical functions in Python and use something like MatLibPlot to get similar visuals with some extra work.

I think Mathematica offers a free trial, but I doubt it would be long enough to truly learn it well.

Link to post
Share on other sites

It's nice of you to try but I think you're overestimating the level that beginners are at. Most people who are new to programming will find your post way too complex and it'll just seem like a foreign language to them with all the terminology you're using. A few people may start looking up definitions and researching further on their own, but most people just want to be told a simple place to start. Programming can be confusing enough to start learning without compounding the problem.

 

 

Link to post
Share on other sites

Software? Python w/ R.PI or VB w/ WinForms. Web? HTML, CSS, JS.

 

???

 

Profit.


Eien nante naito iikitte shimattar  /  Amarinimo sabishikute setsunai deshou
Dare mo ga hontou wa shinjitai kedo  /  Uragirarere ba fukaku kizu tsuite shimau mono

Link to post
Share on other sites

I would argue that people getting their feet wet with "complex tasks" and getting low level should start wit C++, not C. You will get lost in a sea of code with C, and all valid C code is valid C++ code that acts pretty much as expected save for a few pointer aliasing rules. The era of C really needs to end in all fairness.


Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to post
Share on other sites

 

39 minutes ago, patrickjp93 said:

I would argue that people getting their feet wet with "complex tasks" and getting low level should start wit C++, not C. You will get lost in a sea of code with C, and all valid C code is valid C++ code that acts pretty much as expected save for a few pointer aliasing rules. The era of C really needs to end in all fairness.

Agreed. However there are quite a few things these days that are valid C but not C++. The biggest example I usually see are variable length arrays.

int someFunction(int n)
{
	int arr[n];
	//blah blah
	return arr[n-1];
}

Perfectly valid C but not C++. 


1474412270.2748842

Link to post
Share on other sites
35 minutes ago, fizzlesticks said:

 

Agreed. However there are quite a few things these days that are valid C but not C++. The biggest example I usually see are variable length arrays.


int someFunction(int n)
{
	int arr[n];
	//blah blah
	return arr[n-1];
}

Perfectly valid C but not C++. 

That is certainly valid C++. I just compiled and ran it.


Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to post
Share on other sites
8 minutes ago, patrickjp93 said:

That is certainly valid C++. I just compiled and ran it.

GCC supports it as an extension. It isn't standard C++ and as far as I know GCC is the only compiler that allows it.

 

edit: Clang may support it too, I don't remember.


1474412270.2748842

Link to post
Share on other sites
8 minutes ago, fizzlesticks said:

GCC supports it as an extension. It isn't standard C++ and as far as I know GCC is the only compiler that allows it.

 

edit: Clang may support it too, I don't remember.

Clang, ICC, and MSVC all support it with no flags needed. It is standard C++, because it is standard C.


Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to post
Share on other sites
45 minutes ago, patrickjp93 said:

Clang, ICC, and MSVC all support it with no flags needed. 

MSVC definitely doesn't support it, nor do they support a lot of C99.

 

51 minutes ago, patrickjp93 said:

It is standard C++, because it is standard C.

  That just isn't true anymore.

 

If you turn on strict modes for g++ or Clang they should give you a warning telling you it isn't standard. Here's g++s'

g++ -pedantic Source.cpp
Source.cpp: In function 'int someFunction(int)':
Source.cpp:5:14: warning: ISO C++ forbids variable length array 'arr' [-Wvla]
     int arr[n];

 


1474412270.2748842

Link to post
Share on other sites
22 minutes ago, fizzlesticks said:

MSVC definitely doesn't support it, nor do they support a lot of C99.

 

  That just isn't true anymore.

 

If you turn on strict modes for g++ or Clang they should give you a warning telling you it isn't standard. Here's g++s'


g++ -pedantic Source.cpp
Source.cpp: In function 'int someFunction(int)':
Source.cpp:5:14: warning: ISO C++ forbids variable length array 'arr' [-Wvla]
     int arr[n];

 

Pedantic is specifically for performance pessimisation warnings. It has nothing to do with the standard. If you use a constexpr variable in the function calls to it, the warning disappears because the function can be perfectly optimized for all inputs with no dynamic allocations. That's also a warning, not an error. The code compiles and runs just fine.


Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to post
Share on other sites
17 minutes ago, patrickjp93 said:

Pedantic is specifically for performance pessimisation warnings. It has nothing to do with the standard. 

Where are you getting that from?

 

26 minutes ago, patrickjp93 said:

If you use a constexpr variable in the function calls to it, the warning disappears because the function can be perfectly optimized for all inputs with no dynamic allocations. 

The point of VLA is you don't have a constant variable. If you pass a constexpr for the size it's no longer a variable length array, it's just a normal array.

 

27 minutes ago, patrickjp93 said:

 That's also a warning, not an error. The code compiles and runs just fine.

Because that's what the pedantic flag does, if you want it to be an error you can use --pedantic-errors.


1474412270.2748842

Link to post
Share on other sites
8 minutes ago, fizzlesticks said:

Where are you getting that from?

 

The point of VLA is you don't have a constant variable. If you pass a constexpr for the size it's no longer a variable length array, it's just a normal array.

 

Because that's what the pedantic flag does, if you want it to be an error you can use --pedantic-errors.

Chandler Carruth, Google Senior Developer and one of LLVM's chief maintainers. Also, one of my personal mentors in my clang code reviews.

 

It's a performance pessimisation to have variable length array functions (almost wrote methods, freaking Java...). You can ALWAYS predetermine the length unless it's a network, system, or file variable. The Pedantic flags severely slow down compilation because they force that extra analysis.

 

You should never be depending on a VLA. Name any operation you want and I can implement it in constant length and outperform you at runtime (yes, pedantic does metaprogrammatic analysis too).


Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to post
Share on other sites
54 minutes ago, patrickjp93 said:

 

I'm really not sure what flag you're thinking of but it isn't pedantic. Straight from Clang's manual

-pedantic
Warn on language extensions.

-pedantic-errors
Error on language extensions.

That's all it does and VLAs throw a warning/error because it's an extension, not part of the standard.

 

57 minutes ago, patrickjp93 said:

You should never be depending on a VLA. Name any operation you want and I can implement it in constant length and outperform you at runtime (yes, pedantic does metaprogrammatic analysis too).

VLAs are constant length, it's just a constant length that's determined at run time (it's not like a vector that keeps growing.) You can overestimate the size you need to make sure it fits at compile time and that may allow optimizations that make certain things faster but the point of VLAs is you don't know what size you need until run time so in many situations that won't work like you said.

 

And yes, VLAs suck. That's why they were considered a mistake in C and aren't a part of C++.


1474412270.2748842

Link to post
Share on other sites
Posted · Original PosterOP
8 hours ago, madknight3 said:

It's nice of you to try but I think you're overestimating the level that beginners are at. Most people who are new to programming will find your post way too complex and it'll just seem like a foreign language to them with all the terminology you're using. A few people may start looking up definitions and researching further on their own, but most people just want to be told a simple place to start. Programming can be confusing enough to start learning without compounding the problem.

Well, not to be a jerk, but if someone can't handle an "if you want this, then do this" statement including a link on where to start, then maybe they should reconsider whether or not programming is really for them. However, at your urging, I have added a statement to the OP that reads the following: "If you don't know what you want to do, choose python. It's free, it's easy, it's widely used, and there are many resources to help you learn it."


Teacher: Does anyone have a thin ruler?

Students: No.

Teacher: Ok. Does anyone have a nail file.

Students: Why do you need a nail file?
Teacher: I have a staple I need to remove.

Student: Oh. I have a staple remover...

 

People don't want power drills, they want holes.

Link to post
Share on other sites
12 hours ago, madknight3 said:

It's nice of you to try but I think you're overestimating the level that beginners are at. Most people who are new to programming will find your post way too complex and it'll just seem like a foreign language to them with all the terminology you're using. A few people may start looking up definitions and researching further on their own, but most people just want to be told a simple place to start. Programming can be confusing enough to start learning without compounding the problem.

 

 

Writing software is as much about doing things you don't know how to do than it is doing things you do know how. You're a problem solver. Even an advanced programmer is going to be consistently running into things they don't fully understand, or are new to.

Link to post
Share on other sites
6 hours ago, straight_stewie said:

Well, not to be a jerk, but if someone can't handle an "if you want this, then do this" statement including a link on where to start, then maybe they should reconsider whether or not programming is really for them. However, at your urging, I have added a statement to the OP that reads the following: "If you don't know what you want to do, choose python. It's free, it's easy, it's widely used, and there are many resources to help you learn it."

Agreed - simple logic statements are the base of any good programmers ability, so that shouldn't be a problem; I like the inclusion of the Python note here, which is a solid choice. Simple things, like requiring proper indentation teach good habits - there's nothing more frustrating than collaborating with a co-worker who has unreadable code.

 

Side note - not strictly necessary, but I know a lot of people also ask "what to write with" - any thoughts on telling newcomers what IDEs are more/less user friendly? Even recommending something like compile online is great for just testing if you even grasp the simple concepts without having the muck around with GCC, eclipse or netbeans options for the first week or so of typing " cout << "Hello world!"; " inside a for loop.

 

And I guess the python IDLE program is pretty easy to use if they're in the "don't know what you want to do category"?

Link to post
Share on other sites
12 hours ago, patrickjp93 said:

I would argue that people getting their feet wet with "complex tasks" and getting low level should start wit C++, not C. You will get lost in a sea of code with C, and all valid C code is valid C++ code that acts pretty much as expected save for a few pointer aliasing rules. The era of C really needs to end in all fairness.

I don't see why C has to go away just because C++ is "mostly compatible" with it. May as well say Windows 7 needs to go away just because Windows 10 is "mostly compatible" with it.

 

Also if you're "lost in a sea of code with C", you're obviously doing it wrong.

Link to post
Share on other sites
3 minutes ago, Clechay said:

Somebody ignored JS and Ruby as web-server langs despite PHP being incapable of creating functional server  

Node.js is a godsend. I was worried when I started dabbling in web development that I would need to learn a half dozen languages. Now I only need to learn JS (well, and HTML and CSS)

Link to post
Share on other sites
Posted · Original PosterOP
1 hour ago, Clechay said:

Somebody ignored JS and Ruby as web-server langs despite PHP being incapable of creating functional server  

Yeah, I also didn't mention SQL, mySQL, NoSQL (or any other "mini-languages"), ASP (and it's derivatives), or Perl. The goal here was simple, one answer solutions for someone who has never programmed and most likely doesn't really know what they want to do. If you have a specific recommendation that I should switch out one of my language recommendations for another I would love to hear it and reasons why it should change (better free support, better language, more people who know the language, ease of use... things like that)


Teacher: Does anyone have a thin ruler?

Students: No.

Teacher: Ok. Does anyone have a nail file.

Students: Why do you need a nail file?
Teacher: I have a staple I need to remove.

Student: Oh. I have a staple remover...

 

People don't want power drills, they want holes.

Link to post
Share on other sites
14 minutes ago, straight_stewie said:

Yeah, I also didn't mention SQL, mySQL, NoSQL (or any other "mini-languages"), ASP (and it's derivatives), or Perl. The goal here was simple, one answer solutions for someone who has never programmed and most likely doesn't really know what they want to do. If you have a specific recommendation that I should switch out one of my language recommendations for another I would love to hear it and reasons why it should change (better free support, better language, more people who know the language, ease of use... things like that)

And how does it make PHP description true?

Link to post
Share on other sites
3 hours ago, M.Yurizaki said:

Also if you're "lost in a sea of code with C", you're obviously doing it wrong.

I completely agree with this. Getting to such a point is definitely a code smell and usually indicative of a bad/convoluted design.

 

There's things that I don't quite agree with in this thread but I really don't have the time or energy to be inclined to care about them at this point.


The single biggest problem in communication is the illusion that it has taken place.

Link to post
Share on other sites
Posted · Original PosterOP
25 minutes ago, Clechay said:

And how does it make PHP description true?

Idk, does it?


Teacher: Does anyone have a thin ruler?

Students: No.

Teacher: Ok. Does anyone have a nail file.

Students: Why do you need a nail file?
Teacher: I have a staple I need to remove.

Student: Oh. I have a staple remover...

 

People don't want power drills, they want holes.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×