Wednesday, 19 November 2014

Application And Limits. (P1)

Application And Limits.

Procedural programming – this is a high level programming paradigm. This has a basic rhythm/sequence of statements. This is straightforward and simple way of programming as it does not get complicated. Procedural programming is based on the whole idea of using procedures. Procedures are a set of commands to be executed. Procedures are just small programs. They are sometimes known as sub-programs. The purpose of a procedure is to help a programmer avoid repetition. A procedure start off with a begin and end up with end. The procedure can also have its own variables which cannot be used the main program. In a nutshell a procedure is a section of a program that performs a specific task or in other words an ordered set of tasks for performing some sort of action.Many people use procedural programming for the following reasons....
  • It is simple and easy to follow and read the code
  • You can re-use a lot of the code which are designed as procedures.
  • It is very easy to maintain the code involved.
There are also many advantages and disadvantages 
  • Clear structure making the code easy to read.
  • The code is written in steps so it is easier to identify mistakes. This means it is very easy to debug.
  • The program is easier to maintain compared to other language types
However there are also disadvantages.. 
  • Procedural code is very hard to find a way to relate it with real world objects
  • When the code gets to big for instance in the thousands the code can get out of hand and hard to maintain meaning procedural programming is better for short and efficient programs. 
As you can see procedural programming is very efficient and good method to use however it should not be used when programming very large codes as it can be harder to maintain and keep efficient. 

Event driven programming:
Event driven programming is a paradigm which is used to structure a program around multiple events. There are many events such as input in graphical user interfaces to networking requests. Nowadays most things use Event programming even non-graphical applications such as fire alarm. There are many advantages of Event driven programs...

  • It allows us to create and use more interactive programs, The majority of today's GUI are written with event driven programming.
  • It allows hardware to interact with software more easily 
  • Ease of development
  • Simplicity for GUI (Graphical user interfaces)





This is an example of event driven programming as you can see i made a code and as i ran the code and event was triggered and in response an input box popped up, In a nutshell this is how event driven programming works, An event is triggered and in response something happens. 



Object orientated programming paradigm: This is a paradigm which is based the concept of objects. Unlike event driven which is based around "Events" object orientated is based around "Objects". Objects can be literally anything Humans,(Name, Date of birth, Address etc), Cars (Make, Date made, Colour) In this method programmers must decide which objects they want to manipulate. There are many advantages and disadvantageous of OOP or in other words object orientated programming.
  • It has a clear modular structure
  • easy to modify and maintain the code
  • Provided good framework
There also disadvantages...
  • The size of these programs are really big and they take up a lot of the computers resources
  • In this program it takes more time to find and compile things because of the size of these programs are normally very big.
  • It takes a lot of effort to make this type of program as you need to make classes and objects very carefully.







































As you can see this is a example of object orientated programming, The object in this example is a human so i have to declare things such as height, Weight etc, As you can see it is easier to structure a program and much more efficient fro when you are working in groups. 


















Tuesday, 18 November 2014

Choosing A Programming Language (P2)

Choosing A Programming Language

A programming language is used for multiple things including things such as to develop and create applications programming scripts and many more things such as instructions for the computer to execute.
There are many programming languages used today by people to create things such as applications and scripts these programs are things such as Java, C++, visual basic and there are many more.
All programming languages are used as they all are unique and have different advantages. There are many factors which will influence people to choose a program,

Reliability: Users will want a program which is efficient and is reliable and does not crash, Many programs may crash whilst you are writing cod , This can result in you losing work therefore you will want a reliable program.


Features and tools:

Users look for programs which have a variety of tools and features to help them write top quality programs. The tools and features must also help the users to make programs more easily and efficiently.

Suitability: Users must look at what type of program is suitable for their work. For e.g. C++ is known for being able to make and design games in and this is an industry standard to become a game programmer. So if you want to make a game you would chose C++ and not other programs such as Java.


Timing: If you are working in industry and have been asked to make a specific application or scrip in a time frame you will look to see for a program that will allow you to work on it quickly and efficiently. Timing is a big factor which influences people's choices as some programs are easy to code on whereas some are a bit more complicated and harder to use.

There are many Programming languages available, i will discuss two.

Advantages of Java....
Java is fast and easy to learn.
Java is object-orientated meaning you can create modular programs and re-usable codes.
Java is secure
And lastly java is platform independent……
Here are some advantages of c++
Great program for people who are interested in making games.
It is a good language to learn enabling you to limitless benefits
It is relatively clear and mature language
C++ is a great language however it may take more time to learn that a program like java as there is a lot more to learn
Java is a program used by many as it is easy and fun to learn. Java is now estimated to be running on 3 billion devices this shows how good and important the language is, C++ is used more for creating games and if you decide to become a programmer in the gaming section then you need to have brilliant C++ skills.
These are factors which may influence one to chose a program to make their code on, As you can see there are many things which influence people factors such as time, Reliability and suitability are the main ones. 





Benefits Of Data Types (P4)

Benefits Of Data Types

Data types are used by programmers to store and define data, There are many different types of Data types as there are many ways in which you can store data. Data types can hold values in numbers and characters, Data types also allows developers to show how data is being stored.

There are many samples of codes, here I will explain a few.
Integer: Known as an int int the java program it is used to declare an whole number this is good for various things from age to birth year.
Boolean: Boolean is used to declare a true or false statement, in other words Boolean is a data type used to hold true or false data this cannot be used with math calculations. 
Char: This is used to declare a single character it cannot hold more than a character, this is good to declare sex (M or F) and many other things.
Data types: 
byte: this can hold numbers in the range off -128 to +127
short: this can hold numbers ranging from -32,786 to + 32,767
long: this can hold number in the range of -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
IF) IF statements are used a lot in java, this is a method of asking the program a question. for e.g. if you have a requested a user to use numbers instead of characters then you may use an IF to detect any characters and to tell users to use numbers, An example of an if statement....

        if(sAge.contains("A")){
                            sAge = JOptionPane.showInputDialog(null,"please input your name in numbers  " + sName,"Enter your Age please...",JOptionPane.WARNING_MESSAGE);

This is telling the program to see if the letter A is found then to send an error message to the user telling them to write in numbers not letters.
Else and Else if: Instead of using IF twice you can use IF then Else this make your program look better and more efficient. Else follows after a IF and is executed when a Boolean is expression is proven false.
Here is an example....

if(sAge.contains("A")){
                            sAge = JOptionPane.showInputDialog(null,"please input your name in numbers  " + sName,"Enter your Age please...",JOptionPane.WARNING_MESSAGE);

        }else if(sAge.contains("B")){

                sAge = JOptionPane.showInputDialog(null,"please input your name in numbers  " + sName,"Enter your Age please...",JOptionPane.WARNING_MESSAGE);

As you can see this is an Else statement this is just a shorter way for the program to read through and find an expression which proves the Boolean false. If the first condition does not work then the program will check the second one.

FOR: The for statement provides a good and compact way of repeating a range of values, this is often referred to as a for loop by programmers as it repeatedly loops until a certain condition is satisfied. 

for (initialization; termination;
increment) {
statement(s)
}

This is an example of a For or for loop.
WHILE LOOP: The while loop is used to control a structure and it allows you too repeat a task a number of times. The while loop keeps repeating until the condition is satisfied, here is an example... 
    
int x = 10;
        
        while( x < 20 ) {
         System.out.print("value of x : " + x );
         x++;
         System.out.print("\n");
      }
This is basically telling the program to keep looping until the value of x is near 20, this means it will only loop till the number 19.
As you can see there are many Data types and each one is unique and has its own purpose, Data types are an very important way reflecting the nature of the data stored within a program.