Understand Programming

source, code, software

Before we start with nitty-gritty we have to understand what is programming and why do we do it?
programming is the process of translating human knowledge into instructions which can be executed on computer devices to solve a problem.

Why we do it ?

  • For fun.
  • For the purpose of solving repeatable and/or complex tasks.
  • For money.
  • Because it makes us more productive and thus our lives better.
  • Because we can …

WHAT ?

In abstract way programming can be understood as writing a recipe. The problem is that to solve real life problems we would need to write a recipe thousands upon millions of lines long and nobody can follow so many instructions. Finding and fixing errors becomes a nightmarish impossible task. Also in such a recipe there will be many repetitions. For those reasons different techniques were invented to structure the repeated sequences of instructions.
The first step was the use of Procedures and Functions, where instead of writing repeated parts over and over we write those instructions outside of the main flow and when we need to use them we just refer instead of writing them again.
But this wasn’t enough, repeated data and operations on data can be further encapsulated, so now we could group not only the instructions but also the data used by those instructions, ergo Object oriented programming (OOP).

HOW ?

Although repetition is not the only problem. While some people treat recipes as instructions, for cooks they are like poems, for scientists they are like a math problem. So there are different writing styles for expressing similar thoughts, to name a few : Functional, Logical, Mathematical.
And then all this expressiveness and structure has to be managed for humans to be more productive and comfortable, so we invented Interpreters and compilers to do the grunt work of translating the recipe.

Humans use different languages, so we have many computer languages too.

So the basic process is as follows a person using a human readable programming language writes a program to solve a problem or do a task. Then a compiler or interpreter translates this program to a machine code, which can then be executed directly because it is native to the machine.

Type of Languages

The main tool for programming are the programming languages.

There is myriad of them. Almost all languages you can learn are free to use.
We can describe most of the computer languages by using the following partial nomenclature.

  • Low level are languages that use constructs which allow direct control of the computer hardware such as Memory, input or output devices and the processor.
  • High level are languages that in general are tailored much more to humans than to machines.
  • Compiled languages process a computer program in stages. For example in stage one we can convert the program to machine code and stage two we run the compiled code on the machine.
  • Language that is Interpreted compiles and executes the code on the fly, instead of doing it in separate stages
  • Procedural languages provide the capability to organize repeated chunks of code by separating them in Procedures
  • Object oriented languages allow the programmer to further organize related data and repeated behaviors into Classes and Objects
  • Functional languages goal is to mimic the power of Mathematics by using techniques to mitigate Functions side effects which allows them to more closely resemble pure math Functions.
  • Logic languages normally have intrinsic deductive mechanism, which makes programming more a process of description of what you want the program to do, rather than how to do it.
  • Statically typed languages require the programmer to define the type of variables explicitly making coding more tedious but better optimized for execution.
  • Dynamically typed languages guesses the types of the variables thus offloading the programmer from doing additional work. The trade off is that in most cases the generated program is slower.

All of the programming languages are mix of aforementioned features.


programming Languages

For a list of description of many different languages you can peek here : [Understanding programming Languages].

On most of them we will take a deep dive later. You will be able to pick and choose which ones to follow up.

FRAMEWORKS

Learning the language is just the first part of becoming a programmer.
Once you master the basics depending on what type of applications you will be developing your next step would be to learn how to use related libraries and frameworks.

Continuing with the tradition of structuring and encapsulating they allow us to write less code but do more. And in addition are normally written by domain specialists which most probably will do better job than you and me anyway. Specialization brings scalability, this is how we can build such complex applications.

Some examples of Frameworks :

  • Web development
    • Front end : React/JS, Angular/JS
    • Web server frameworks : Spring/Java, Flask/Python, Ruby on Rails
  • Automation Testing : Selenium/many, Puppeteer/JS
  • DB connectivity : JDBC/Java, DBI/Perl, SQLAlchemy/Python
  • Numerical processing : numpy,scipy,pandas,vaex,dask/Python, PDL/Perl
  • Machine learning : scikit,keras,pytorch,tensor flow/Python
  • and so on …

How to learn a programming language

Most of the good programmers out there are self-thought, you can do it too you just need a book, tutorial or a course to get you started. You can also start by visiting the [Learn] section on this this … it is work in progress, so keep checking.
The easiest way to learn programming is doing it step by step. Start with easy almost trivial problems.
Like implementing Math Functions, printing, counting … and so on.
Learning from scratch requires practice, so once you do a trivial problem tweak it a little and try again. Don’t just follow the instructions but improvise. Break often, this will teach you to anticipate what will happen before it did. Because a particular error happens often you will remember it more vividly and also what caused it.

In the process of learning try to understand the concepts f.e. :

  • What is a variable ?
    • A Container ! that holds a Value
  • What is the difference between Object and Class ?
    • The class is the definition and implementation and the object is the instantiation of a class.
  • What is the difference between Function and Procedure ?
    • the former return a value, the latter dosn’t

What to do and not do ?

Learn how do you structure a program that maximize reuse !
Answer : Write preferably shorter but reusable Functions, Procedures and methods, rather than longer unreadable monstrosities. if you can maximum 1-2 screen pages and if highly reusable even less.
Don’t write one GIANT class, split it based on functionality. Learn how to compose and abstract.
Don’t be afraid to rewrite.
Figure out how to name things !
Rule: if you can write shorter but descriptive names for variables and methods. One exception to this rule is if you want to emphasize portion of the code, in this case you are allowed to leave a “sore thumb” to attract attention.
Use my 245-rule :

  • csv2dict vs csv_to_dict
  • check4size vs check_for_size
  • rows5col vs rows_per_col

Learn what to do and not to do !
Don’t be super clever, unless you discover masterpiece.
Do comments alot, but don’t describe what can be seen or glimpsed from the code. Your comments should explain unforeseen consequences of the particular piece of code OR explain the code from different perspective. You will thank me later.
Learn to think two steps ahead, but don’t overthink it !
If I do X then Y, but if Y then Z i.e. build a model in your head. Initially it is hard, but with time it becomes a habit. The human brain is good with those things.

Treat it like research, not like a work …

Divide and conquer
Get a paper and pencil, split the problem. Is it solvable ? if not ? repeat again … once the problems are small enough or reachable, start coding.

Choosing a language

I would recommend after reading this article to check the [Learn] section. There you can see a more detailed discussion on the things we just mentioned above.
How to choose which programming language to learn ?
There are several factors that can skew your decision. Do you do it :

  • for fun
  • for money
  • you find it interesting
  • because you need to solve a particular problem

Still having a questions

Check the frequently asked questions

Name or Pseudonym
Email
Message
Than you for your feedback !
There has been some error while submitting the form. Please verify all form fields again.