Tuesday, January 20, 2015

some thinking about the learning of python as a c/c++ programmer

Wow, to be honest, I did not take CSC108, so I have no python experience before CSC148. But I have used c/c++ for two years, basically, use it for computer programming contest. I used to do a lot of programming contest problems. Usually, most of my time is spent on debugging.

When I use c/c++, it is much easier to read the program and see the logic inside every loop and condition. But when I go into python, things start to mess up. I am not comfortable about not declaring variables before using it. Sometimes, when I am reading a python program, I get lost and confusing about the meaning of the variables. Compare to c/c++, python is a much easier language because it is more similar to human language and many complicated concepts like points, arrays are replaced with higher level functions. However, it is hard to balance convenience and making thing clear.

For example, since python does not require define variable before its usage, to make program readable, it requires python programmer to write doctest to clarify input variable type and output variable type. And when a python code is translated into machine language, it usually cost more time and memory to " understand " the code since everything in python is kind of auto type.

For these reasons, it tells me that it is very important to write a clear doctest  and follow professional python coding style to make a good python program. Also, keep writing a blog to record your learning experience and debugging process is a helpful way to make out programming skill better.

No comments:

Post a Comment