DEV Community

Pinjari Rehan
Pinjari Rehan

Posted on • Originally published at python.plainenglish.io on

Veteran C++ Developer Says Python Is The Profitable Starting Language

Phil Nash, a C++ developer, says Python is the best starter language or a fantastic second language for frontend and web developers.

Python is a good place to start for new programmers looking for a first language or anybody who wants to add another language to their portfolio.

According to Phil Nash, a developer supporter for SonarSource and one of the original creators of the C++ test framework, Catch2.

“It’s a boring choice, but for exciting reasons,” Nash said to The New Stack.

“It’s quite basic to start with, but it scales with you plain simple to being a genuinely industrial-strength, very popular language.

There isn’t any language that comes close to covering all of those bases.”

For a First Language, should you learn Python or JavaScript?

But what’s the problem with using JavaScript as a first language?

JavaScript is an excellent choice, but it was never meant to be a beginner-friendly language, according to Nash.

This inspired a moral story about BASIC, a popular programming language from the 1980s that was meant for Basic All-purpose Symbolic Instruction Code. That was wonderful in that it was basic.

The problem was that it wasn’t a very good language, so it wasn’t used for potential uses until Microsoft released Visual Basic in the 1990s, he said.

Python is special in that it is simple to use, but as developers gain experience, they can dive into more complex uses and eventually build real-world applications, he adds.

According to Nash, JavaScript is also fairly simple, but by chance instead of design.

“[JavaScript] was created as part of something else and unexpectedly became the most popular language in the world just because it came bundled with the web,” he explained.

“As a result, it’s a wonderful language to learn. It’s just not as user-friendly for beginners.”

Python, on the other hand, covers all bases — it is both beginner and useful, according to Nash.

“It reads more like pseudocode that you might put on paper when sketching out an ideal, that translates into real working code in a production code base,” he remarked. “It doesn’t get much more user-friendly than that, yet it’s also widely used in industry.”

He regularly changes between Python and JavaScript, and the biggest challenge he faces is choosing whether or not to use a semicolon at the end of lines.

“One of the problems with JavaScript is that many things are optional. Thus semicolons are optional, save for a few cases,” he observed.

“One of Python’s guiding principles is that there should be just one correct method to do things.

It’s not always true, but in speaking, they try to construct things in such a way that there is an obvious way, the Pythonic way, to do things.

Everything seems to be fairly consistent. JavaScript is almost the total opposite of that.”

Should You Learn Python as a Second Language?

“But it’s useless,” you could reply. When it comes to the web and you’re a frontend/web developer, JavaScript wins every time.

Consider this: Python is now making its way to the front, because of the launch of Anaconda’s open-source PyScript last year.

“You can also use it as a fantastic web technology on the backend,” he said.

“And it’s starting to show some potential of being a frontend language as well, although it’s very early days.

It’s too early to say if it will take off, but if you already know Python, you can now call yourself (or believe yourself) a front-end developer, at least if you played with it.

So it’s possible, which is impossible to say for many other languages.”

But suppose it’s too late for you since you’ve already learned JavaScript or the other language.

Python is also a good alternative language, according to Nash.

“Python is a great scripting language,” he added. “It’s also a full feature for it since it grows to the challenge.”

Python is also known as a dynamic language, which means that when you create a variable, you don’t have to specify what sort of variable it is (number, string, boolean).

The language suggests it depending on how you use it, similarly to how JavaScript does. It is not true for strongly typed languages like Java or C++.

He stated that dynamic languages are often easier for beginners.

“Since Python is a dynamic language, you may create mistakes in the code that are only caught at runtime, whereas a strongly typed language detects it at compile time,” he stated.

“Many people, myself included, prefer statically typed languages, notably for larger, more complex code bases.

Python now has an optional type annotation, that provides many benefits, but only if you use an extra static analysis tool.”

He said that Sonar has a static analysis tool that would detect mismatches in types of use, even in Python.

Python can serve as an appealing frontend to more complex code bases like C++.

“You can wrap it in a Python interface, and then it’s very easy to write Python code against that.

So that’s what most ML libraries do, for example, they’re written mostly in C++, the underlying heavy lifting, and then the nice, relatively easy Python frontend,” he said. “It’s great as a second language.

Most developers, if they’re going to learn another language, should have Python in their toolkit.”

Python is best known for its use in machine learning, but it’s also a popular language in finance, in part because of NumPy and quant computing, which applies mathematical and statistical methods to financial and risk management problems.

“Quant developers, traditionally have worked pretty much exclusively in C++, and maybe with MATLAB for sketching things out, and then they’ll convert their code into C++ for performance,” he said.

“But with Python and NumPy, they find they get everything in one package.

Their code looks like what they would have written in MATLAB, but it performs like C ++ under the hood.”

What Python Developers Should Know

There are two major Python frameworks for web development on the backend: Django and Flask. Nash builds websites with Flask.

“Django is more of a standard web framework, where you have to do things the Django way.

“And now you’re almost a Django developer,” he said. “Flask takes inspiration from Django but is far less demanding.

And you can put in exactly the level you want, add more dependencies, and do things your way, which is my choice when I’m programming.”

He also mentioned that there are millions of courses and resources available for learning these frameworks or anything else using Python.

Python is also pre-installed on pcs using a Unix-based os, such as MacOS or Linux.

It is simple to install on Windows PCs. It can then be used via the command line by typing Python.

Then it opens an interactive shell, where developers can quickly start writing code.

It can also be accessed using IDEs such as PyCharm, a Python IDE, or a VS Code plugin.

It is not, for example, a high-performance language like C++ or Java, though Python can work on those projects as well.

“When performance isn’t an issue, it’s usually the best option,” he says.

“Alternatively, you can use it alongside a fast language; you can easily connect with C++ and have the best of both worlds.”

More content at PlainEnglish.io.

Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and [**_Discord*](https://discord.gg/GtDtUAvyhW) *._**

Interested in scaling your software startup ? Check out [**_Circuit**](https://circuit.ooo?utm=publication-post-cta)._


Top comments (0)