Wednesday, 19 November 2014

Benefits Of Data Types. P4

In this blog I will explain the different data types and how they are used. All their applications and their advantage. But first I will say a bit about data types. For programmers, it is important to know about data types. This is so the program runs more efficiently.

I will explain 6 different data types (In terms of java)

1) String
2) short
3) char
4) int
5) double
6) byte


String:

A string is used to store characters. When I say "characters" I mean spaces, numbers, alphabets, or symbols. It could be anything on the keyboard. It is used to mainly display messages and store messages as well. An example can be

String sMyName = "Muhammad Shaeel Abbas";
This stores "Muhammad Shaeel Abbas" in the variable called "sMyName"

int:

"int" is the short form of "Integer". It is used to store numbers. To be more specific, it is used to store whole numbers. It should only be used when there are very huge values being involved in your program. Whole numbers are numbers without a decimal point within them. There is a specific range for integers as they have their limits. The range is from -2,147,483,648 to 2,147,483,647. It stores numbers as :

int iYourAge = 18;


byte:

The smallest unit for storing integers can be easily identified as "byte". It has a range and that range is from -128 to 127. For the program to run more efficiently, bytes should be used by programmers where it is applicable.

Such as
byte bTempOutisde= 20;

char:

The full form of "char" is character. It is a data type. In computing terminology, a character is a single letter,number, symbol or space. This data type can be used as demonstrated below

char cFirstInitial="A";

double: 

This data type is a bit similar to integer. However it is used for decimal numbers such as "9.1"  "2.3" whereas integers can not be applied to decimals and are used for whole numbers such as "9"  "1"  "23". If we take a look at the range of double, it is 4.94065645841246544e-324d to 1.79769313486231570e+308d

It can be used as:

double dHeightInFeet= 6.1;


short:

"short" can be compared to byte. It can be noticed that short is much bigger than byte as the range for short is -32,768 to 32,767. The limitations of "short" is that it can not hold huge numbers like integer can however it can hold larger numbers than byte. It can be used as such

short sDateOfBirth= 1996; 


As you can see, each and every data type has its own unique purpose to serve to the programmer. It is better to use data types where they are meant o be used rather than mixing them up (Especially numberical data types). If we mix them up then we are wasting energy while coding, and time and also at the end the program not even work. I can give you can example. Imagine having to use "char" instead of "String". How hectic would that be.

Choosing A Programming Language. P2

In this blog I will explain how programming languages are chosen amongst programmers. I will explain all the factors in detail.

There are 5 main factors that commonly come to mind of the programmers/companies before they start a huge project.

1) Programming Team Size.
2) Programming Team Technical Knowledge.
3) Given Time.
4) Overall costs.
5) Reliability.

I will start by explaining "Programming Team Size"

1) Programming Team Size:

If there are more programmers working on the project then they might use another language than they would if there were less programmers on the project. If there are more programmers on the project then it would save time. However it would cost more as well.

2) Programming Team Technical Knowledge:

Size does not matter when it comes to programming. You could have 20 programmers working on the project but if they do not have technical knowledge then the chances are that they would make more mistakes and would consume more time then a programmer with technically knowledge would. Programmers with technical knowledge would get the work done easily, efficiently and would not require training.

3) Given Time:

It is important to know the time given for the final project to be completed. This is because if the deadline is not met then the programmers might not get paid their full wage or might not get paid at all. Programmers would choose different paradigms depending on the time frame they have to meet the criteria. Procedural languages often take up less time as procedures or modules are divided amongst the team,

4) Overall costs:

The price to develop and maintain the program can be expensive depending on what language you are working with. Unless you want to ignore a few bugs, However big companies such as Microsoft will make sure that there are no bugs or glitches found within their Operating System.

5) Reliability:

Programmers need to make sure that the final piece they would build would last long. They can not afford to find bugs after the program has been released to the customers. Different programming languages have their own level of reliability.

Application And Limits. P1

In this post, I will be analyzing the limits and applications of of 3 different computer languages or paradigms. These are

1) Procedural Languages
2) Event Driven Languages
3) Object Orientated Languages

But first I will inform my readers about what a computer language or a programming language really is. A programming language is not like normal languages such as french, English, Punjabi or Arabic. It is a special language that is designed for programmers that has some words of English. Not everyone can understand programming languages. It is used to interact with the computer hardware or machines. The primary function of computer languages is to create useful programs. These programs are used to control the PC. Common languages are Java, C++, Basic and PHP.

I will now explain the three paradigms of computer languages, starting with Procedural Language.

Procedural Languages:

Procedural Languages are meant to be typed in a number of steps. The compiler executes these commands in a series of steps. In procedural languages, the solution is often written by the programmer inside the code. Some examples of procedural languages are Java and C++.
There are many applications for procedural languages. One of the application is that procedural languages are good for making calculations. Also, it uses procedures. Procedures can be reused in the code which helps the programmer save time and energy.
However procedural languages has it's own limits. If something goes wrong with the program.  for example, any bugs, then the programmer would have to go through the whole program to find a specific problem. Hence we can say that it is very difficult to modify

 Event Driven Languages:

Event driven languages are used to ask users for specific inputs. After the inputs are entered, the program processes them and uses them to generate a specific output. This is only if the inputs are recognised by the program. The basic concept behind Event Driven Languages is "if statements" ,  "else if statements" and "else statements" For example, if the user inputs this, then  then give the user that else if the user inputs then give the user that else give the user this.

The application of event driven languages are, commonly, sensors. Heat sensors can be one use to be specific. For example, they can sense a specific range of temperatures. If Heat Sensor increases more than 100 degrees then alarm goes off. If not then alarm remains silent. This is just one example.
The main limitation for event driven language is that it requires a lot of processing power.

Object Orientated Languages:

These languages create objects. Within these objects they fit data about them. For example, Object can be a human being and the data could be eye colour, hair colour, skin colour, heigh, weight and so on. An application for these languages can be that they use functions or classes which makes them easy to maintain. A team can work on a project and can divide different classes amongst them to make their task easier. Also, bugs are easy to fix. However there is a limitation as well that is that these files are huge in size. This means that it will take much longer for them to completely load. This is because of the code that is within them.