8
$\begingroup$

I'm not sure if it's the right place for this question. Sorry if going a bit off-topic.

Choosing a suitable Language for the first programming course is one of the most important things that every related teacher/lecturer should bear in mind; especially if the students are young or having a limited math knowledge.

I'm currently teaching a group of highly enthusiastic young people (about 16 to 17 years old) with a medium knowledge of math. They're attending High School at 10th grade class right now. I'm going to start teaching a programming language for the upcoming semester.

They're a group of handpicked students throughout the city with a extraordinary level of creativity and diligence, so i see that working with a real programming language would not be a hard task for them. So, choosing simple graphical and drag'n'drop solutions like Turtle Art, Scratch, and Tynker are not considered as options.

There are a few factors that should be checked before making a choice:

  • Simplicity: Most of them probably have not experienced any kind of real coding action before.
  • Simplicity, Again: One of the main ideas is teaching how to think algorithmic. Having a sophisticated or hardly-syntaxed language will divert them out of the path.
  • Generality: It's better that the language not be designed for special development cases. Take PHP and MATLAB as examples which are respectively designed for Web Development and Calculation/Modeling.
  • Minimum Objective stuff: No forced OO programming (like Java). Or at least with the minimum dependency to OO concepts.
  • Platform: It's important to have Windows as a supported dev environment, as neary all of them are on Windows.
  • Easy to Set-up: It's better to have a straightforward way of setting up the dev environment.
  • Industry preference: Not a serious problem. But it should be at least a currently-active language allowing students to reach nearly-real dev experiences.
  • Hardware Portability: It's important (but not required) that the language be flexible enough to be used on Hardware programming. (I'm not speaking of Hardware Description languages like Verilog and VHDL.) The aim is programming for more simple processor-based hardware like AVR Microprocessors or Raspberry Pi GPIO interface.

I want to know that

  1. is there any other factors that i'm missing?
  2. And, what languages do you suggest as choices?
$\endgroup$
4
  • 2
    $\begingroup$ For other criteria that you might be missing, see this question. $\endgroup$ Commented Dec 5, 2016 at 21:09
  • 1
    $\begingroup$ @DavidRicherby I had seen it before posting the question, and of course, it helped much. $\endgroup$
    – zxcmehran
    Commented Dec 5, 2016 at 21:19
  • $\begingroup$ Give Lua a try. $\endgroup$
    – Ankur
    Commented Dec 6, 2016 at 15:21
  • 1
    $\begingroup$ @zxcmehran On the topic of programming paradigms, I came across this on Wikipedia today and thought it might be relevant to your question: Comparison of multi-paradigm programming languages $\endgroup$
    – tehDorf
    Commented Dec 14, 2016 at 23:28

7 Answers 7

10
$\begingroup$

My answer? Python.

Let me explain by tackling all your points.

  1. Simplicity. Python code reads like English. Seriously, how simple is print("Hello World!")
  2. Generality. Python can be used for web development (via. Flask/Django), data analysis (via. NumPy/Pandas/SciPy), games (via. PyGame), as well as a multitude of other tasks because of the sheer amount of libraries there are.
  3. Minimum Objective stuff. You can do some OOP in Python but it isn't required.
  4. Platform. Python2.7 is in pretty much on every Linux distro and there are plenty of YouTube videos on setting it up on Windows/Mac. If anything, you can use the online interpreter that Repl.It offers.
  5. Industry Preference. Correct me if I'm wrong, but Python has consistently been ranked as one of the most popular languages.

In my experience teaching, it is extremely important to make sure that the syntax is as easy as possible to write and understand. For a new programmer, it can be pretty discouraging when he/she writes code only to see an error message (especially if he/she does not have the skill to read an error message and debug).

Side note, PythonTutor will be really helpful in explaining some major computer science/programming concepts.

$\endgroup$
5
  • $\begingroup$ Thank for sharing. I agree with you and think about Python as one of the best choices. $\endgroup$
    – zxcmehran
    Commented Dec 5, 2016 at 21:24
  • 1
    $\begingroup$ Speaking of PythonTutor, JetBrains PyCharm Edu is also a good tool to start with python. $\endgroup$
    – zxcmehran
    Commented Dec 5, 2016 at 21:30
  • $\begingroup$ I work in research into programming languages and I believe that good general-purpose programming languages should be statically typed, but I also think Python is a great learning language, especially for young students. There are many factors that others have pointed out, but let me also say this: in my experience a beginner needs to see their program crash and burn with their own eyes. If the big bad compiler keeps telling it "you can't do this because it will crash and burn" that's of little help. A bit like my telling my kids "don't touch the oven, it's hot." $\endgroup$ Commented Dec 6, 2016 at 14:08
  • 1
    $\begingroup$ And never ever understimate the fact that in Python the indentation of blocks makes the program structure self-evident. Just having to type { and } or begin and end to delimit blocks of code is a significant cognitive burden on a beginner student. If you think otherwise, switch to scheme and see what you think about the parentheses. $\endgroup$ Commented Dec 6, 2016 at 14:11
  • $\begingroup$ You can also program in python on the raspberry pi, which is nice. $\endgroup$
    – auden
    Commented Dec 26, 2016 at 20:29
10
$\begingroup$

Background

This question raises its ugly head every 5 or so years at our department. We had Miranda and Pascal ages ago, then we had Haskell, now we have C because thee EE dept decided to send us their students as before but demanded "something practical such as C" and our spineless leadership had nothing better to do than comply.

Why not any of those recommended above?

I've taught some of this and seen students come out of it over close to 20 years. The one thing that stood out was that the language hardly matters as long as it allows you to express fundamental concepts of computation with sufficient ease and that if you didn't do the right thing, you'd get good error messages, preferably from the compiler. That's where python fails. Types are important! That's where C fails: types are important and polymorphism is important! (And no, making everything have type void is not a solution. You merely move to python land.) That's where java fails: programs don't fit on slides - there's just too much boiler plate and verbosity.

So personally, I would not go with any of the answers above. I'd go with Haskell. It is beautifully aligned with mathematics. It's more concise than any of the others. You can focus on the essentials of computation. And ghc tends to produce better and faster code than C compilers do for the feeble attempts at optimization I witness every time I let students use C.

But really..

Having said that, in my experience the most important thing is though that the teacher actually knows the language better than from just a few online tutes. First languages are just that, first languages. If your students are serious they are going to pick up many more along the way. Focus on concepts rather than syntax.

$\endgroup$
7
$\begingroup$

This question is highly opinionated, in my opinion. There's nothing which can trigger an holy war like "which language is the best for X". Still, I'll bite.

  1. is there any other factors that i'm missing?

First, I would recommend you read what Dijkstra said about teaching. It's old but still relevant -- possibly much, much more relevant today than it was in the past.

Second, I would also recommend reading a blog post by Joel Spolsky on the same topic.

Third, and less importantly, my very own criteria for a first language would be:

  1. Any runtime error must be reported with a clear error message.
  2. It should be typed.
  3. There's no single programming language that can make you understand all the programming aspects. To become a real programmer, one needs to learn many languages, especially radically different ones.

Point 1 is very, very useful to a beginner. Most languages satisfy that, with the notable exception of C and C++. While I think that C is a must-know language for any programmer (see point 3), I think it's unnecessarily harsh for a beginner. Garbage collection is pretty much a prerequisite for point 1.

Point 2 is the most controversial. While I believe that one should also learn to work in an untyped language (again, point 3), I think starting with types is more beneficial. Even in an untyped environment, programmers often think about which kind of data should be passed to a subroutine. Further, detecting errors earlier than runtime is nice.

Point 2 rules out a lot of languages. Note however that Python is not ruled out: while Python is untyped, there's the wonderful mypy project which allows one to use a typed Python. Further, Perl6 has optional (gradual) typing, so that would still be in. Typescript also adds types to JavaScript. Even if Lisp and Scheme are ruled out, there are many typed functional programming languages to choose from (Ocaml, Haskell, F#, ...).

Point 3 is important as well. One needs to learn a lot of things to be a good programmer. From low level stuff (pointers, C) to the highest level (recursion, closures, parametric polymorphism / generics, ...), different paradigms (imperative, functional, logic, ...). This can't be taught in a single course, of course. As a first course, you should pave the way to the full road.

$\endgroup$
1
$\begingroup$

I would go with the Python answer, but I also like to recommend an alternative: C.

My first programming language was C and at the time learning it I really enjoyed it. The teacher (and some fellow students) would have taken Java as first programming language but it was set to take C. The teacher used to show some Python examples to show benefits of a more modern programming language. Anyway, back to topic:

  • Simplicity The C syntax is pretty small, but from time to time kind of strange. You are not forced to take the vodoo approach, but you might.

  • Simplicity, Again As result of the first points, algorithms can be implemented pretty compact and understandable. Think of Fibonacci or more advanced the Knight's Tour.

  • Generality Using C you might implement what you want. You can also use some subsystems like scripting languages (Lua).

  • Minimum Objective Stuff C talks for itself here. You have to have some good knowledge of C to implement OO stuff.

  • Platform Every major platform supports the language, take a compiler of your choice and start coding.

  • Easy to Set-up C does not need a IDE with plenty of buttons and a fat toolchain. Simply take a make file (or a script) and comile your code with some commands. You can use an IDE (Codeblocks, ...) if you want to.

  • Industry preference Linux, Windows, ...

  • Hardware Portability It is working good on AVR microcontrollers or take Arduino, which is also programmable using plain old C.


As an alternative, what about developing on an affordable platform like Arduino (there might be better alternatives). You might show them all algorithmic stuff using simple stdout prints or you might put some hardware to work. It might be of benefit if the resulting code does not only print some text (or picture, or gui, or stuff...) but also lets an LED flash or something. In my company there are sometimes pupils courses where they code some stuff on a pretty basic Arduino board and we receive good feedback from attendants.


I think you are asking the right questions and I wish you all the best for teaching yours students.

$\endgroup$
3
  • $\begingroup$ The only negative point of C and C++ is that the coder needs to understand some of advanced syntax structures (like pointers) to be able to build something that seems like a real action. In C Family, you cannot reach fancy GUIs or Network magic power without understanding the hard parts of the language. As a student, it would be boring if all of the efforts through a semester just result in some logic running inside a black console window with a odd typeface. Thus, I think using a language with a higher level can be more interesting for them and encourage them to continue the road of coding. $\endgroup$
    – zxcmehran
    Commented Dec 7, 2016 at 22:14
  • 1
    $\begingroup$ @zxcmehran Right, that's why I suggested something like Arduino as an alternative approach. $\endgroup$
    – maxik
    Commented Dec 7, 2016 at 22:29
  • $\begingroup$ C is simple like "manage your memory yourself" is simple. Lots of undefined behavior is a problem. $\endgroup$
    – djechlin
    Commented Dec 18, 2016 at 15:39
1
$\begingroup$

I'd go for Swift, using Swift Playground. You might want to check how many people have either a Mac or an iPad. Among students it's 90% in some places. It's also available online at http://iswift.org/playground , so you need nothing more than a browser. You can use it on your phone if you don't have a computer.

Swift is a modern language, it's a safe language, and it's a language that will get you a job if you master it. (Any new code that Apple writes is written in Swift. )

$\endgroup$
0
$\begingroup$

Edit: Sorry, about that - I misread your point about the platform. I basically thought you said that it only had to run on Windows, but I see now that it is just the majority of your users that are using Windows.

Microsoft has been building support for Linux and Mac and VS Code and Visual Studio for Mac, respectively, and .NET Core so I think this is still a valid answer, albeit perhaps not as strong.


I would suggest you look into C#, the .NET framework, and the Visual Studio IDE - they cover pretty much all of your 7-8 points. (depending on how you count the first two ;D)

  • Simplicity: The syntax is fairly easy to pick up, and there is a large amount of information on the web for beginner tutorials.
  • Simplicity, Again: C# is a strongly-typed language, which helps highlight errors before the application even runs. Visual Studio is arguably one of the best IDEs you can get with great syntax highlighting, Intellisense, and debugging support.
  • Generality: While it may not be the best choice, I've personally used it for a wide variety of applications - from websites and desktop applications to robotic equipment.
  • Minimum Objective stuff: Edit Object Oriented Programming is a style of programming focusing on encapsulation, abstraction, inheritance, and polymorphism. C# has features that make writing OO code easier, but it does not require that you use them. You can write a C# program procedurally.
  • Platform: Edit The .NET Core is the cross-platform version of the .NET Framework. It works on Mac, Linux, and Windows.
  • Easy to Set-up: I don't think you can find an easier language and IDE to get setup on Windows. Edit As for Mac and Linux, I don't have any experience with it, but there are VS Code (Win/Mac/Linux) and Visual Studio for Mac (Mac Only). I would assume these would be relatively easy as well.
  • Industry preference: C# is definitely a professional language, though you can take a look for yourself by searching for jobs in your area based on whichever languages you are considering. Using Dice, I got roughly equal results for C# (6,548) and Python (6,639) across all of the open job postings, but I don't know if Dice has a bias one way or another, or if there are significant regional differences.
  • Hardware Portability: Maybe half a point here - I don't think there is a lot of support for programming microcontrollers with C# other than a couple specialty .NET boards like the Netduino, but the Raspberry Pi is supported.

As an added bonus, Microsoft has a program called Imagine (previously DreamSpark) where they give away a lot of free software for teachers and students in high school and college. They also have some contests for the students as well.

$\endgroup$
3
  • $\begingroup$ Only for Windows guys. Also, entirely OOP $\endgroup$
    – Eugene
    Commented Dec 6, 2016 at 9:13
  • $\begingroup$ @Eugene My mistake, I misread the point about the Platform, so my answer was definitely only concerned with Windows. I've updated it to address Linux and Mac. As for "entirely OOP", I've also addressed that in my updated answer under "Minimum Objective stuff". Please let me know what you think. $\endgroup$
    – tehDorf
    Commented Dec 6, 2016 at 18:59
  • $\begingroup$ Even though C# is a mature language, it was out of my list; since i was assuming that it has a limited scope on platform and hardware. Appreciating you, it's back on the list again. Thanks for the links, I'll check 'em out. $\endgroup$
    – zxcmehran
    Commented Dec 7, 2016 at 22:24
-1
$\begingroup$

Take a look at Lazarus:

http://www.lazarus-ide.org

Lazarus is a programming environment based on Free Pascal Compiler (FPC). It runs very smoothly on Windows, and also available for other major platforms. FPC supports a modernized version of Pascal, which is called Object Pascal.

Object Pascal is a multi-paradigm programming language. You can write code in standard Pascal, then start using OO features when you need it.

Real world applications can be developed using Lazarus/FPC. They are both quite mature, but you can also use Delphi as a commercial alternative.

FPC can cross-compile your programs to devices like Raspberry Pi or Android.

Besides, future of Pascal is bright. Oberon programming language will eventually take over as the most productive way of developing software:

ht tp://www.projectoberon.com

Hopefully, tools to develop in Oberon will mature in time. There is already a cool compiler for Win64 target:

https://github.com/congdm/AyaCompiler

$\endgroup$
2
  • $\begingroup$ The question mentions as a criterion: "Industry preference: Not a serious problem. But it should be at least a currently-active language allowing students to reach nearly-real dev experiences." It doesn't seem like Lazarus/Pascal fits that one so well. It would be nice to document in your answer which criteria Lazarus does well in and which it does not. $\endgroup$
    – D.W.
    Commented Dec 18, 2016 at 7:28
  • $\begingroup$ en.wikipedia.org/wiki/… <br/> wiki.freepascal.org/Lazarus_Application_Gallery <br/> delphi.wikia.com/wiki/… <br/> jonlennartaasenden.wordpress.com/2014/11/06/… <br/><br/>When Lazarus reached 1.0 milestone, it gained a lot of interest. Popularity has not decreased since then.<br/>Delphi/Lazarus is one of the most popular tools for developing desktop applications. Frameworks to use FPC in server and mobile applications are also being developed. $\endgroup$
    – srcstorm
    Commented Dec 18, 2016 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.