Thursday, 6 November 2014

Benefits Of Data Types

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

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.

Thursday, 23 October 2014

Application And Limits

Explain the 3 Paradigms


Event driven Programming

In Event Driven Programming stuff is executed based on triggers that occur when events happen. The program is determined by user actions e.g mouse clicks, keyboard strokes and other peripherals in which users interact with, the program is coded to take in these actions. An example of Event driven programming happening would be the user inputting a name into a dialogue box using a keyboard. 

     

This line of code will bring up a dialog box in which the user can type in. Then once the program is running you will have this 


i have inputted my name into the box using a keyboard. When the user presses ok the program will look for the first letter of the name using the charAt function and you will receive back a quote saying "Hi, I don't to know who you are but i know your name starts with J". This is event driven because you are inputting a string and the program is feeding logical information back to you. 

Procedural Programming

The procedural programming language is still used today, the program relies on a programmer coding the solution to the problem as an algorithm or to make it easier to understand. any given piece of code can be called at anytime during the programs execution. an example of Procedural would be this piece of code i did in which it has logical steps to work out how many eggs are shipped in day.



The variables at the top which say int add up the eggs and then a simple System.out.println shows the answer to the complex equation. 

Object Orientated Programming

Object Orientated Programming represents objects that have attributes that describe that object. Objects are usually instances or classes, they are used to interact with one another to design applications and computer programs. This means for the variables you make you can assign data to that variable and use it anywhere in your code for example.

  

I made some variables, I will now assign some attributes to these



I have set some data for the variables along with some other code which you cant see but in the end we create a new object called someguy, when we do this the someguy will have information tied to him because we have data in the variables