DEV Community

R0land013
R0land013

Posted on

Why I like statically checked languages?

Hello, first of all, please, apologize my English; I am not an English speaker. I’m a beginner programmer, and the first programming language that I used was Python, a dynamically checked language. I used it to create my final project of 1st career year. It is incredible how easy python is. I was implementing that project very fast (without testing, creating messy code, messy architecture, due it was the first time I was creating an app) and I was very happy by how quick I was going ahead. But when I start to mix some classes and objects, and I started to test how was working my app, a bunch of errors were started to fall over me. I spend a long time to find and fix all bugs, some of them very hard to track for me. Many bugs which I found were given by the fact I was writing incorrectly the method names, also I was passing wrong argument types to methods, it seemed I have a bad memory😅.

Luckily, I could terminate implementing all the application correctly, functionally speaking, but it was a difficult and painful process. I was very excited, because I had built my first app and I leaved a huge weight.

The next year I had to create a similar project, but using Java language. When I started to learn Java, I suffered a terrible headache given by all the features that this language has. I was coming from the beautiful, simple and lazy Python’s world. My mind blew when I saw ‘final’, ‘static’ ,‘public’, ‘private’, ‘protected’, ‘void’, ‘char’, ‘boolean’, ‘byte’, ‘short’, ‘int’, ‘long’, ‘double’, ‘float’, ‘interface’, ‘abstract’ words and its syntax. It was uncomfortable for me to learn Java given the first programming language I learned was Python. But when I knew its fundamental features I felt better, and now I like it more than Python.

When I started to create the new app it was easier. I did not suffer errors similar to those I found in my Python program. The static checked of Java was saving me from a great quantity of subtle errors, and the IDE became my first friend due its auto completion and the errors markers. These things were reduced in my Python IDE (IntelliJ IDEA Community Edition with Python plugin) due its dynamically checked.

After living this experience of constructing similar apps with different languages, with different checked system I formed the next opinion:

-Dynamically checked languages are easier to learn than static checked languages. Since you do not need many reserved words, features and syntax and languages constrains in a language like Python, the process of learning becomes short, compared with statically checked languages like Java and C++. Also the code with a language like Python and JavaScript (dynamically checked languages) is short, and easy to read.

-The code written with statically checked language is easier to understand than dynamically checked language. Because you are obligated to declare the returned type, and the parameters type when using a statically checked language, I could say that this kind of language is auto documented. This is good, but it is not enough to leave writing specifications (preconditions and post conditions). Now, think you are using Python and you need to use a function written by a team-mate, but he is lazy and he did not document it. How do you know what this function needs and returns? You have to read the function code, and spend some time in it. This happens because dynamically checked language does not obligate coders to give this information.

-Statically checked language save you from a great quantity of subtle errors. If you use a data type as an argument in a method call being different from the expected, then you will be notified by the IDE with a red mark, and the compiler will notified you with an error in compile time. With dynamically checked languages you can have these errors and the interpreter will never notified you, and you will have this hidden bug until the interpreter raise an exception as consequence of a method(or access to a property) call in an data type object wich does not have that method.

All this makes me love statically checked languages. But dynamically checked languages have beauty too. Since these are short and simple you can code faster. It is very useful in competitive programming and in game programming contests. For example Python is very used for competitive programming and the majority of online judges allow it, and it is better to quickly write algorithms. Also there is a Python framework called Pygame which is very used in game programming contests.

I hope you had learned something new or had read something interesting. If you see knowledge error in this post, please, tell me what it is. Give your opinion in this topic.

What is your favorite programming language, and is it statically or dynamically checked?
-The mine is Java😁.

Discussion (0)