Tag Archives: Programming

Is Teaching Coding Actually Helping Kids?

The Atlantic has an article from about a week ago questioning if the growing effort to teach children, particularly those in underperforming school districts, coding skills will actually help them in the end. The author and many of the people she interviews are worried that there is a danger that many of these programs will only teach a very limited set of skills that will leave the students locked out of all but the easiest and lowest-paying jobs.

The biggest concern here is that many people seem to think of coding as job training for careers in “tech” when that’s not really true. If “tech” just means web and mobile application development (and I think that is what it means to a lot of people), then maybe that’s not so far off, but knowing how to code will only get you so far in a job. Several of the people quoted stress that educators need to instead treat coding as being equivalent to the “three ‘R’s” of reading, writing, and arithmetic. I think that comparison is an exaggeration, but the general point isn’t wrong. Coding is a tool (one of many) that can be used to solve various problems or achieve various goals. Coding, however, does not necessarily teach you how to design and implement a large project. It doesn’t teach you much of anything about anything involving hardware, or about the mathematics needed to solve complicated equations in a science or engineering problem. If you know how to code but don’t know any of the underlying principles of the program you’re trying to write, you’ll always be stuck following someone else’s directions and implementing someone else’s solutions. That kind of work doesn’t necessarily pay well and won’t necessarily lead to a long-lasting, fulfilling career. Basically, tech isn’t coding and neither is computer science. Coding is an important skill for many (but not all) jobs in tech and computer science.

The author mentions Java and Javascript several times as if these aren’t appropriate languages to learn, but I don’t see any problem with that. You can’t teach every language, but something like Java is close enough to other languages like C that the transition is pretty easy. If students were learning Haskell or lisp then I could see that criticism being more valid.

The article brings up the important point that students who want careers in fields involving computers should learn coding in order to have an easier time succeeding later in their education not in order to get a job right out of high school. With coding they’ll be able to spend more time thinking about the actual problems they’re given and less about how to write the code to get a solution. There are actually many different ways that programming can be incorporated into the curriculum outside just a programming class. Simple math programs could be used to help students better understand things like calculus (one-dimensional limits and Riemann sums can be very easy to implement and might lead to greater understanding), intro physics (numerical solutions of differential equations can be written well before students are ready to actually solve the equations by hand, letting students see how equations of motion lead to the solutions in the textbook). Of course, doing this requires that students all have regular access to computers, which is a serious problems in the underprivileged schools that the article is focusing on.


Computer Languages and High Energy Physics

A common question that people who are thinking about going into physics is “What programming language should I learn?”

This question doesn’t necessarily have a good answer. Really, the answer depends not only on what subfield you are interested in but also what experiment you will work on. In the field of experimental high energy physics (i.e. particle physics) there are three languages that are by far the most useful for day-to-day work.

They are: C++, Fortran, and Python.

C++ (or sometimes just C) and Fortran are used because they are fast and already have enormous libraries of optimized code, allowing you to use things like FFTW (Fastest Fourier Transform in the West) and the GSL (GNU Scientific Library). These are older languages and not the easiest to code but allow a lot of flexibility. If you’re doing computationally intensive work, chances are you’re working with one of these languages. In HEP, Fortran is mostly found in older libraries, many of which are being replaced by newer C++ versions. Thus, you get things like PAW, GEANT3, and Garfield – Fortran-based programs found in CERNLIB – being replaced by ROOT, GEANT4 and Garfield++, which are C++ based. Fortran is still used quite extensively, though, and many simulation toolkits continue to be maintained in Fortran. I’m not an expert on what is used in high energy theory, but I believe Fortran is also one of the most common languages there as well (again, due to the huge set of libraries available for scientific computing and due to it remaining one of the fastest languages). C++ has a lot of nice features – it’s always been object-oriented, it includes templates and the STL, etc., and is much newer than Fortran (there aren’t really any obvious vestiges of punch-card programming in C++!).

Python is becoming more and more popular for high level programming. While it’s too slow for many computations, it is a very nice scripting language. You can quickly create programs that will work without needing to deal with Makefiles and compilers. For example, you could create a bunch of C++ programs to process and analyze a dataset using a Python program to control everything. Furthermore, you can even create Python bindings for C++ code (and some other languages too), allowing you to call your C++ functions inside a Python program. This lets you run everything in Python so that the computationally-intensive parts were compiled using C++ code and the rest is just Python.

Another big advantage of these languages is that they are free. Most people in HEP use the GNU compilers gcc, g++, gfortran, etc. to compile the code. These tools and many of the scientific libraries (like the ones I mentioned above) are also free. This is in stark contrast to languages like Matlab and Mathematica, popular in undergraduate coursework and in some other fields but which can also cost hundreds of dollars per user per year. The same is true of IDL, which is popular among astronomers. Python has NumPy and SciPy which mimic much of the functionality of Matlab. Common languages like Java, Perl, and Ruby may be encountered but aren’t used very often by particle physicists. If you’re going to be working with websites or databases, you might also run into SQL, Javascript, PHP, etc, though these are more for “service work” – keeping the experiment running – rather than an actual physics analysis.