For many years C++ has been the dominating language to start with. Recently Python is getting an edge over C++ and Java as the most popular programming language. Is it a good idea to switch to Python as a start instead of C++?
I think it's a good idea, because as bloody beginner there is no benefit in learning most of the features of C++. In my opinion C is preferrable to C++ and Python is preferrable to C.
It is frustrating to learn things like pointers, references, headers, compiling stuff etc. and their sense theoretically without understanding in practice why we really need them.
Concluding, I think it makes more sense to get started with some simple and funny programming instead of hard work.
I think it's a good idea, because as bloody beginner there is no benefit in learning most of the features of C++. In my opinion C is preferrable to C++ and Python is preferrable to C.
It is frustrating to learn things like pointers, references, headers, compiling stuff etc. and their sense theoretically without understanding in practice why we really need them.
Concluding, I think it makes more sense to get started with some simple and funny programming instead of hard work.
From my personal experience, Python is preferable compared to typical C/ C++ programming languages. Helps in getting student the feel of Object Oriented Programming. Making the latter love it instead of finding it boring.
I recommend to start with python as a programming fundamentals course, and how they could practice code reuse without teaching them object oriented. With Python students understand programming concepts more, since python syntax is easy and it has a large standard library that enables students to do real applications, students will feel that they do something useful not just calculation and output of control structures( selection, repetition )
The second course I recommend C++ course that teach them syntax of C++ , then deep them to C++ object oriented programming.
I think you should start with C++. Do not use C, there's no point. Python might be easier, but just using simple C++ with STL isn't that complicated and teaches good habits while giving a deeper understanding of programming principles.
Thank you for your answers they are all valuable arguments. I am glad you are sharing your experience on the matter with us. There are opposite opinions on the matter here in our department as well.
I guess to some extent the context matters here. If this is a course in a series of courses designed to teach Big Data, Big Data Technologies and/or Data Science, Python might be a better choice over either C or C++, if these are our only choices.
Markus' response leaves me with more questions than answers. I agree that "...it makes more sense to get started with some simple and funny programming instead of hard work" but if its "... frustrating to learn things like pointers, references, headers, compiling stuff etc. and their sense theoretically without understanding in practice why we really need them"
why teach C with its memory allocation and lack of garbage collection? Other languages do that for you behind the scenes and unless the students are likely to work in the C environment long term, these lessons may be lost any way. That's not to say that knowing C is a waste of time, since many languages are C-like and that will allow for an easier acquisition of other languages in the future if C is already known.
It is more preferable to start off with C and move to C++. I use python for quick and dirty coding on the fly for some project. However, it is always good to pick up all sorts of coding languages and practices. It'll make you more equipped to tackle harder problems, but will allow reform you thinking strategies in practically every general situation. I learned Java as my first language and moved to C, C++, Python there after.
My recommendation would be Java. It causes the student to think about the actual data being manipulated more carefully, and reports errors early if they make a mistake. C/C++ also require the user to think about the data, but it makes it more difficult to determine the cause when things inevitably go wrong. Python students get stuck easily when you ask them to change a program to carry even slightly more than the minimum data around.
Both are all for completely different purposes but python has more practical usage in real life application. Most of the people who know C/C++, they don't even use it after education.
If the students are from computer science, I recommend C/C++. C/C++ is good to give an understanding that how a program works at a low-level (assembly is relatively too low for beginners). However, if the students are from other fields just to learn programming, I recommend Python. Python is easiser to learn than C/C++, and it does not make students frustrated for pointer or template metaprogramming. Python can be more practical than C/C++ when we consider learning curve. Java is also a good choice, but I think, it is too "object-oriented" for beginners.
There are many good points here on both sides, and as we all know programming can start from a variety of different points. I would have once said start with C or C++ as both of them provide a very solid foundation, but the past few years has taught me that this may not be the best functionally for the individual.
Today we live in a society which consumes information quickly and attempts to produce results in just a short period of time. Having had the opportunity to work in both the commercial and academic settings, C and C++ were languages I never had to deal with, rather I have had to focus on learning new languages on the job in order to perform the work which needed to be done. One language which kept popping up was Python due to the sheer number of libraries available for a variety of different uses. I have seen people move from C# and MATLAB for different reasons because Python fit the bill better. So I would say it is important to have a language that is multifunctional at the core of ones learning experience which can be used as soon as the student has taken on their first language.
C and C++ did not get me my first programming job, Java did, and I have never used any of these in my career. All of them lead to Python. In a world where skills need to have applicable use immediately, and the common audience is growing younger, I would recommend start with something easy to understand with robust capabilities that can be used right off the bat.
Thank you for the insight.. I kind of share the same history as a starting programmer. Now the times are different and Python is now the most popular programming language. For programmers the shift to Python is far more easy if they are professional with c/c++ or Java. However starting with Python especially for future programmers is still an issue.
[TL;DR]: Nothing to add with respect to the (mostly shared) opinion (Python it is ... pretty please); and even if you have in mind to make your students think close to the machine, still NOT C++. +1 to Markus Weber, I second his first paragraph!
---------------------------
I shall add in prelude that C++ was my first learned language, I loved it since day one and still do (even when I wander off and come back to it), taught it in academia, and am currently earning my living writing just it (99.5% of my programming nowadays). But still ... damn!
Now, I am NOT proficient in Python, I never taught it, and I use it only once in a while for some small stuff. So, I'm basically being a "reverse-flame warrior" here.
One of the most important parameters for beginners' success is the level of gratification they get in the learning process. It usually boils down to the equation (just for fun) : E = G - D + f(P(t),F); with:
E: fuel (or energy) to keep going, keep learning, keep improving on the path of coding.
G: level of gratification
D: perceived difficulty level.
f: a function of passion [P] and Freedom [F]. P is a function of time [t]. Freedom is influenced by the course being an elective or not, the student taking the course in a life or death setting (e.g. CS or CE major), etc. From my experience, f usually substantially dials down P(t) (even very high P) for so many students that its positive impact on E is very dim. For simplicity, let's just write E = G - D
The problem, IMO, does not reside in C++ being difficult (in an isolated manner) or non RAD. It resides in C++ not providing enough gratification to keep most people going; i.e. C++ provides a pretty low E compared to Python. I once told middle-schoolers, during a presentation about coding, that programming is the closest thing to having a super power in the real life (talking to machines, being just like a wizard, etc.).
Consider this: Python --> (and quickly on their own) Python + Django, Python + Kivy, Python + Matplolib, etc. and they might be willing to talk to Raspberry Pi and Odroid devices. That's some compelling and visible "might" that comes quickly and is capable of a lot of visible things. Now with C++, if you toss aside QT (the only serious, steadily maintained thing out there to close the gap to some extent), good luck with convincing beginners that they're actually building superpowers :). Basically, no web and no mobile; and for the better or worse, these (web, mobile, gadgets, tiny single-board computers) are the true shiny programming superpowers nowadays (not the hidden system-level stuff that nobody sees). Everything else being equal, you'll give your students more fuel to keep going and improve if they can quickly do things that they could brag
about and get gratification from.
Now, if you were thinking of "raising" CS folks and want to teach them system-level thinking through a programming language, I would still not recommend C++; make it straight C. C++ is a close-to-the-metal language but it is not that much of a language that helps the programmer learn about and draw his thinking close to the hardware. Here are a few reasons why it is better NOT be C++:
Constructs and programming practices that force the programmer to think close to the metal are actively frowned upon in production in C++. And IMHO, it is "unfair" for beginners to be taught X now just to teach them later on that Y should be used instead because X is evil. A lot of the things that lead to close-to-the-metal thinking in C++ are said to be evil. Unlike C where most of those Xs are accepted as just the way the language works, C++ has an inordinate amount of those Xs that are part of the language but are recommended against. This is just not a learning-friendly situation. C is small (number of concepts to learn), straightforward, clean and map you to the machine with minimal "distraction".
Stepping through a program in a debugger and looking at raw memory is an excellent way of learning machine-thinking; and while C is amazing on that front, C++ is just unwieldy for that purpose. Good luck asking beginners to mentally abstract away all those stuff that clutters the class view
of std::array or a std::string in a debugger. Another example, iterators, for instance, do not ease memory observations in a debugger. Good old integer indexes do; but then you're not writing good C++ code if you're using
raw loops (they are said to be evil). So either you teach them bad C++ (especially in the post C++98 thinking) just so they could see things close the metal OR you teach them good C++ (iterators, range-based loops, etc.) and bye bye straightforward memory visualization.
The language itself (C++) seems to be proactively moving away from machine-level thinking at coding time (without sacrificing performance, of course). That's part of what C++11 and beyond is achieving.
Now, I have long been an advocate of the opinion which states that it is better to learn lower-level languages (C or C++) first and then higher level languages like Python later. "Guilty" of that for a long time (maybe biased by how I, myself, evolved), but I changed tune a while ago. "Please give the kids the possibility of creating value" is what I would say today! After a few years of programming in any general purpose language, any other language can be learned pretty easily if required. So, as far as I'm concerned, Python first, then C ... and C++ later if required.
I think the answer may lie in the end career goal? If the student is to be a systems engineer then learn C++ as early as possible due to its steep learning curve. If the student is going to be something else, Doctor, Economist, Ecologist, but needs to use technical computing and mathematics, then learn Python, as they are unlikely to need C++.
Neither should Python or C++ be taught as an initial language. C++ is a chimera which tends to reach maximum complexity. Python is too much high level and you can use it without understanding what you do.
I do think that C, Lua, Go, Swift and even Fortran are better languages to start with.
I have to agree that it is hard to tell without knowing the target audience. If we are talking about CS students, who will be using programming in half their courses, there are definitely advantages to teaching them lowlevel concepts early, which would be in favor of C; It is easy to think of higher level languages in terms of pointers, while I've seen friends struggle badly with pointer arithmetics when being exposed to C after several terms of Java.
Non-CS engineers and scientists on the other hand will likely have very limited exposure to programming through courses, and will probably better be served by skipping lowlevel concepts in favor of something they CAN use for quick-and-dirty data crunching and visualization. Python is definitely preferable to C/C++ here.
For reference, I am a physicist, and was exposed to C, Fortran, Mathematica and Matlab through early courses. I was later extensively exposed to Java in CS lectures (not in the curriculum), and a bit to Perl through a Bioinformatics course. Python and shell-scripting I picked up independent of courses, with Python being currently my main data evaluation and visualization environment.
Many Universities start replacing C or C++ with Python.
The syntax easier than C/C++ and the important point at the beginning is the logic/algorithms ....etc. not the syntax. In addition, the Python syntax more readable and comfortable and many platforms available to start.
Interestingly you did not mention the purpose of the teach.
Is it to learn algorithm or a langage to work with quickly ?
Personnally I started with C, after that I could quickly learn many other langage by my own. But I have to admit that it is difficult to start with C, but this pain makes the switch to other very easy.
Teach C or Rust if one wishes to write an OS or a device driver for an OS.
Teach (a subset of ) C++ with its STL , and Python -- and use the swig.org tool to create optimized Python modules from the C++ (subset), leverage the awesome Python ecosystem of open-source modules.
I would like to thank each and everyone of you on your valuable input on this issue. It is almost clear after analyzing all responses that for CS or IT students C/C++ is still a must. For non-IT students (those who will not become mainly programmers) Python seems to be an excellent language to learn.
A decision in that regards will be taken among all departments in the Faculty of Engineering and IT in light of your wonderful arguments.
It depends highly on what is your pedagogical aim in this class. It is just programming as a general activity? Then a simple syntax is best, so go with Python or Swift. Is the aim to teach algorithms or data structures? In this case a lower-level language would be better to grasp minutiae of what you (or the computer) is actually doing. Regardless of the class aims, C++ would not be my first choice.
I think Python is best for the typical case, less time spent on teaching / understanding syntax concepts and more on actual programming concepts. While more comprehensive in terms of learning, C++ is less accessible and therefore less inclusive. Also, C++ needs a better teacher with better methods, meaning its really easy to teach C++ badly.
It is a good idea to teach Python as the first programming language to engineering students. It is easy to learn, has good support for numerical computations and data plotting. It can also be used to teach basic computer programming concepts such as data structures and algorithms. Students wishing to pursue computer science can go on to learn other programming languages such as C/C++, Java, JavaScript subsequently.
I have attached a draft of a paper we are writing. Your comments are welcome.
I can see no benefit at all in learning C before C++. Many of the pitfalls in C, like memory allocation and index checking, have been solved in C++. On top of that C++ is fully object oriented, which requires a completely different approach to structuring your code, something that will also be very helpful in Python. Since the introduction of the STL I consider C to be obsolete.
I think it's better to teach Microsoft Excel how to use the formula (SUM, IF is priority) to understand the logic of the program, then you should teach them Visual Basic to make the code is familiar or friendly. After these are accomplished, then move into the other programming languages.
Good programming is mostly about structure and clarity, not about syntax. Most modern languages are object oriented, which brings real benefits for bigger projects. But object orientation requires a different approach than functional programming. For that reason I think it's best to start with a good object oriented language, like Java, Python or C++.
C++ has the advantage of supporting both low level as well as high level programming, and functional as well as Object oriented styles. For robust, reliable and efficient code C++ remains unbeaten.