DEV Community

Cover image for DDD: Fun with Languages
manish srivastava
manish srivastava

Posted on

DDD: Fun with Languages

In Caption DDD stands for dumb, dumber and dumbest like me.

So all DDDs , we are going to learn few computer languages together in series of its kind.
It will include python, c++, go, javascript and Rust .

This series is not going to be complex. You don't need to have any prior programming knowledge. Just follow with me.

Prerequisites:

  1. You have seen a computer.
  2. Made a search on google once in your life.
  3. You know there are parts like RAM, HDD and Processor in computer.
  4. Machine understand 0 and 1.

If you have above prerequisites, Believe me you have all capabilities to be a good programmer.
Yes believe me.

For a while let's forget about programming languages. Let's brush up our pre primary school knowledge.

I believe

You know a,b,c d....
You know integers 1,2,3....
You know decimal numbers 1.59, 3.75 ....
You know sentences like "a for Apple".....
You know 😂 this laughing face too...
You know God is true and Satan is false.

Great. You are 2% programmer now.

Just like any human languages, programming languages too have their own grammer and script ( way of writing).

In programming languages:

a,b,c are called chars.
"Apple" is called string.
1,2,3 are called integers (int)
1.5,2.75 these decimal numbers are called floats.
and 😂 is symbol ASCII symbols (chars)
Any statement outcome is either 'true' or 'false' is called Boolean.

Int, chars, string, floats, Boolean are almost common types in every language.

Further, in computer science there are two types of languages low level languages and high level languages.

Many definitions and differences available in Google. For now, being DDD it's enough to know programs written in low level languages are limited to machine only while you can share High level language program from one machine to another. Like python and c++.

Moving further:

Suppose you have only 2 blank pages in your note book. And I ask you to write chars, strings, floats and some booleans. But remember, I will keep dectating and it's your headache to ensure whatever I have dectated gets within two pages. It's difficult?

Yes it is. This resource management makes you a better programmer.Today many programmers write programs but they are unable to do resource managements like memory leakages etc. I will talk about this later.

Instead of writing long sentences you can opted for short hand notes. This is good way. But you should know like steno about short hand . This 'short hand' are 'functions and classes' in programming languages.
Use of functions and classes are not mandatory as like short hand but like short hand they are fast and resource friendly.

Function as a Service (faas) is a new term in world of programming. As DDD, we can keep faas for later stages.

Let's do some arithmetic and algebra.

But before we start let me tell you .... a unit law. You can't add distance into weight.

10 meters + 10 kgs = Error.
10 meters + 10 meters =20m

These units you can say
are called 'type' in programming language .
The good rule book says two different types can't be added.

Like
1 + a = error
Int + char = error.
'Apple" + 'd' = Appled

Oops!!! In last example we added a string with char .

In many languages it is possible chars and string addition but in RUST language it is not easily possible.
X:char = '10';
Y: int = 10;
Z= X + Y; error
X == Y ; error
X === Y ; FALSE

As a good programmer we should avoid this of mixing units. The reason is responsible resource utilisation.

Further, any programming language want us to define your variable type.

For example if
distance (d) = speed x time;
d will be a integer or float.

So, int d = speed*time;
Or float d = speed*time;

String Add ="New Delhi zip 2345789"

Almost in all programming languages arithmetic symbols are same. Except one well known is * for multiplication.

int X=2;
float Y=3.50;
Z=x+y;

What is value of Z ?
It's not 5.50 . Because there is no variable is x or y? They are capital X (2) and Y (3).

It may possible that programming language may ask you to define x ,y. But few programming language may neglect x,y and no error will be thrown. Even if there is no error you have wasted precious time of your RAM to calculate x+y.
You may ask. Computers and servers are so fast then, why we need to worry? We will take this question at later stage.

For now, you are free to code the way you want.

But before we start programming we should know about binary, bits , Bytes etc.

You can't be a good programmer if you don't understand how your codes makes your machine to work behind to compile it.
How your chars,int,string variables are stored ?

Above all questions are very simple. We will have look to them in next part.

Top comments (0)