Python is to 2020 what interpreting Basic was to 1985

Python is to 2020 what interpreting Basic was to 1985

This article is bound to upset some Python fans and those that trust external sources.

Both Python and Basic shares some similarities, some good and some bad. A lot of this also applies to other interpreting languages.

On the good side it's easy to code in and easy to learn. The bad side is that it's very easy to create bad code.

As someone that has been coding Basic and also have had to maintain Basic programs I see that the history repeats itself with Python. It's not the same bugs, but the reasons for the bugs are similar and in many cases beginners mistakes, but also inherent problems with the language itself.

To look back into history Basic was never one single language, it was several dialects that evolved over time and got new features depending on manufacturer. This did mean that code written for one computer could to 90% work on another but you had to figure out how to get around the 10% that differed.

The similar thing is with Python – with new generations of the language you can get some new features and old might no longer be working. So upgrading the interpreter might cause your application to break. Dependency on external libraries are also adding to this, especially if they are dynamically loaded from an external source that you don't have control over. This of course applies to many other languages, but interpreting languages are usually more sensitive to this since the external libraries are loaded during runtime and not at compile time.

However problems with upgrading the interpreter is often a minor problem compared to the problem with maintaining the code. Since it’s an interpreting language you will often not find a problem until you start to execute that part of the code. On a compiling language like Java, C# or C++ (to name the more common) you will discover basic mistakes during the compilation or linking phase where the classes and method signatures of the calls are matched to the implementations. C is a bit less stringent and some code problems may fall through.

The result is that if you can’t discover the issues at compilation time then you will have to discover the issues at runtime. And at runtime you will then have to execute the program in a way that ensures 100% coverage. For some languages like Python there are some code quality tools that you can run as a developer, but you aren’t forced to use them except if you have a build system that prevents you from delivering without having a successful execution of the check. Other script languages may lack this kind of check completely.

As an example take the following Python code.

No alt text provided for this image

When executing f1.py you will then discover that the program sometimes crashes and sometimes works as expected. This is because the function print_life() doesn’t exist in f2.py. This is an inherent problem of an interpreting language – you will see the problem first when the execution reaches that point.

So imagine that the function is such as it’s called once per month from one point in the code and once per year from somewhere else. If the function is updated and the per month call is updated but not the per year call then someone will have a bad New Year’s Eve. Or even worse it’s not discovered until months later that the yearly execution failed. This is included in what often is called “Software Rot” and “Dependency Hell” (look them up on Wikipedia).

You might argue that it should be discovered during testing, but in reality testing is often cut short. And a test process for a large system has to cover a huge amount of permutations to ensure 100% test coverage to catch things like this.

So the conclusion I have to make here is that writing in Python may speed up the development of a system but can make maintenance of the system a lot more expensive in the long run. The scope of the solution is one important factor here. If you need to develop something small and simple with limited performance that is not expected to live for long then you can use Python or another script language. But if you are going to develop something that shall have a long life and be maintained over many years a script language can be very tricky. And stay away from dynamically loaded external libraries.

Venkatesh Malneni

System Design Engineer at Volvo Group Trucks Technology

4 年

Article is a bit misleading. if the topic is about interpreting vs non-interpreting language, Python may be replaced but probably with another interpreting language.

回复

要查看或添加评论,请登录

Nils Hammar的更多文章

  • No one will ever blame you.

    No one will ever blame you.

    The following story comes from the Wikipedia page about Richard Hamming. ( https://en.

  • Some statements to consider

    Some statements to consider

    Here are a few statements that I have collected. Below are some system design statements to consider whenever designing…

  • Ett Fossilfritt Sverige

    Ett Fossilfritt Sverige

    I en artikel i DN s? h?nvisas det till att Sverige skall ha netto nollutsl?pp ?r 2045. Det ?r v?llovligt, men…

  • The evolution of Java

    The evolution of Java

    Even though Java is becoming a bit less popular these days due to various reasons it's still relevant. I have made a…

  • System Design Considerations

    System Design Considerations

    During my years I have accumulated some experience regarding what's good and bad in the world of designing systems…

  • Machine shop skills are getting rare

    Machine shop skills are getting rare

    The ability to work a machine shop is a great skill to have even in these days. Skilled machinists seems to be a rare…

  • Improve your Java code quality

    Improve your Java code quality

    By delivering a high quality code you will lower the maintenance cost of the system. The tools presented in this…

    1 条评论
  • Cobol - an obsolete language?

    Cobol - an obsolete language?

    The jokes about Cobol aside - it seems like there's a shortage of people that knows Cobol. On YouTube there's a "crash…

    3 条评论
  • Official COVID-19 hackathon in Sweden

    Official COVID-19 hackathon in Sweden

    An initiative by The Swedish Government. The new COVID-19 virus is testing our country, our society and us as citizens.

  • From New York Gov. Andrew Cuomo Briefing

    From New York Gov. Andrew Cuomo Briefing

    Some things to think about. Better be safe than sorry and see someone drowning in their own fluids.

社区洞察

其他会员也浏览了