Benefits Of Data Types
There are many different data types I will run through the most common and the ones we have learnt over the past 6 weeks.
The various datatypes allow the developer to describe how the data is to be stored inside a program. It also allows the developer to understand the maximum and minimum values that may be stored there. Programmers benefit from data types because it differentiates from different data for example, an integer will only store whole numbers and the computer and IDE's know only to store this type of data. In string this will only store words enclosed in quotations. this sets apart different data from each other and makes it easier for programmers to code.
In some cases, the 'bool' type for example, indicate how the data is to be used. A bool variable may have only 1 of two possible values, either true or false. An int (or any variant of int) may not contain fractional values, and so on.
integer - this stores denary data in the variable for example you could have
int iNumber = 7;
the int is storing the phrase iNumber and that is = to 7
if/else - the if statement executes a certain part of the code if the value is true for example
int iTrue = 7;
int iFalse = 10;
if (iTrue < iFalse) {
System.out.println("This is True");
}else {
System.out.println("this is false");
}
this is saying if iTrue is less than iFalse then execute the first System.out.println but if iTrue is bigger it will execute the else statement.
char - the char variable stores an alphabetical letter for later use. For example
char cFirstInitial = 'J';
this will store the letter J until declared.
String - The string variable will hold a piece of text. For example.
String sMyName = "My name is Jeff";
this holds the value My name is Jeff to use in a println or anything.
double - the double variable will introduce the point system into number. For example.
double numberone, numbertwo, Answer;
numberone = 10.5;
numbertwo = 12.9;
Answer = numberone + numbertwo ;
System.out.println("The answer is " + Answer);
the double holds the numbers 10.5 and 12.9 then is added together to show the answer.
Choosing a Programming Language
This is the factors that may influence you when choosing a programming language.
Time Constraints
When you are asked to create a certain piece of software you will need to choose a programming language that will be suitable and able to complete the task. Certain programming languages will and can take longer to complete depending on the software being created, the more important the software is for such as for a power plant you will need a more complex programming languages to make it more secure so less errors will occur which for a power plant can be very dangerous.
Organisational Policy
When working for a certain company there will be a organisational policy that you will only be able to use certain hardware and software. Taking this into account when choosing a programming language to create a piece of software for example if only windows hardware is used and windows software is used such as windows 7 the programming languages are nearly unlimited from what you can choose from but if you had something DOS still you are very limited to the programming languages you can choose
Suitability
When asked to create piece of software you will need to select the correct programming language that would be suitable to create the software that has been asked of you. There are many languages that can be chosen but again it depends on what the software will be used for if you are wanting to create a game you will use a easier a quicker language such as C++ but if you are creating a program to see how many eggs are being imported into your egg company you can choose like Java for simple algorithms.
Reliability
In general any software created would need to be reliable you don't know anyone that would purposely create unreliable software. If software was unreliable the chances are that it would not be used because when something is unreliable then it can mean errors occur not able to do something that it should be able to do etc. This can also be linked with the people you will work with you must be able to rely on staff that will be given a task that you will rely that they are able to do it and on time so you must be able to trust in the people around you.