Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Unit 6 - Assignment 1
Transcript of Unit 6 - Assignment 1
There are three main styles of computer programming which have different features. It is important to choose an appropriate programming language for anything you try to create when programming.
Event-driven programming uses different events which can occur with a computer to do actions. Different events include clicking the mouse, moving the mouse or pressing a button.
Procedural programming is a type of programming where all the code is executed in a specific order. It uses a bunch of instructions which are then carried out as a sequence when the program is compiled.
This style of programming is about the design of the program. This type of programming uses variables, functions and methods. Most OOP languages are class based which means that the objects are instance of a higher class.
Procedural programming is typically used for people who want to make scientific or mathematical calculations, since calculations need to be done in order. It is used by scientists and engineers to help them with their work.
Some examples of procedural programming languages would be:
The most preferred language is C, since it is the easiest to understand out of all the languages. It is also more popular because Apple started using 'Objective C' for their code which put C ahead of the other languages.
• All of the code is stored in the file which means that anyone can access your code.
• The code can be difficult to handle when you have a lot of code.
• It is not very flexible.
• None of the code is independent, so if you change some code, you will damage a lot of other code as well.
Object-Oriented languages are typically used to create video games since the concepts of classes and inheritance make it easier to develop characters or many other objects which are commonly in video games.
Difficult to learn
Large file size, since there are many lines of codes in applications programmed in OOP.
OOP applications are pretty slow, however this has been countered since computers are much more powerful in the modern time.
Some examples of object-oriented programming languages:
The most popular OOP language is C++ because it is very flexible. There are also many tools which allow visual design for mobile applications.
Event-Driven programming is usually used to create GUI's which stands for a Graphical User Interface. They are usually used to create office style applications such as Word, Excel etc. This is because these applications require the user to click buttons or type things in.
Complex to understand.
Difficult to control
Very time consuming to get loops working properly.
Usually only effective for creating GUI applications.
Classes aren't always reusable.
Some examples of event-driven languages would be:
The most popular language is java since it is free and it is a platform-independent language which means it is easy to make applications for most systems.
Factors affecting the choice of language
There are many different factors which influence the decision on what language an organization choose to use.
Many organisations include a policy which defines the hardware and software that employees should use. This is because that it allows the employees to work more efficiently if they are all using the same software. e.g. A company could make sure that its employees use apple machines and programs. This affects the choice of language because there are some languages which aren't compatible with some operating systems; it could also be that IDE's do not work with the operating system.
The language should be suitable for what you are trying to create. e.g. if you are creating an application which includes a graphical user interface, you should probably use an event-driven language because it is the most appropriate language to create these types of applications. It is also important to make sure that there is an IDE for the chosen language that works well with the operating system and is an efficient choice for what the organisation wants to create.
It is also important that the language can only produce a minimal amount of errors. The language should be flexible enough to meet the needs of the website or application. Some languages may not be able to fulfill all of the objectives that the organisation wants for the website or application.
It is also important to consider the money that needs to be payed when you choose a new language. Organisations need to know whether or not they would need to buy specialized hardware to use the language efficiently (which can cost a lot of money). Some IDE's also cost money so it is important to make sure that you use a programming language which has an IDE that is worth the price.
The organisation also need to ask themselves how easy it would be to expand their application/website with the language that they choose. It is important to choose a flexible language so that the company can update their creation and expand it so that it functions better.
An organisation needs to make sure that it is not going to be difficult to adapt to a new language. The employees within an organisation should be familiar with the chosen language; it would cost time and money to train employees to use a new language which wastes a lot of money. Therefore the organisation should check with all of their employees in order to find out which language is the most popular with them.
There are many different data types which are used in different situations when programming. Each variable created in programming have a data type. There are six different data types which are strings, integers, floats, characters, datetimes and Boolean. Each data type has an appropriate situatioon for it to be used because they all have different features and they are compatible with different functions.
A character data type is a specific letter inside a string which can be accessed and printed by itself. An example of a character would be the letter 'a' in the string "Ninja". Characters can be accessed from strings using an index function which prints out a specific character from a string depending on a number chosen. However when you are indexing, the computer starts counting from 0 which means that the first letter of a string would be accessed using the number '0'. i.e. if you index a string with the number 5, it will print the 6th character in the string.
A Boolean data type is a value of true or false; they are used to validate whether or not a condition is met and they can be incredibly useful. They are used in selection to allow programs to execute a specific series of code when the code is needed. An example of when it would be used could be if a developer was creating a quiz and they needed the program to know which answer is correct and which one is incorrect; the program would check if the answer is True and it would print that the user got the correct answer. You are not able to perform any mathematical operations on boolean values because there are no numerical characters.
An integer is any whole number and it can be negative or positive. Developers can use mathematical operations on integers. Some examples of mathematical operations would be adding, subtracting, multiplying, dividing and more. An example of when an integer should be used could be when a developer wants to store a quantity that can change overtime such as the amount of points a player has scored in a video game. Integers are commonly used with calculators because they use a lot of numbers and a lot of math is done with these data types.
A float is any number with a decimal point in it such as 13.37; they are used in many situations when people need precise values so that their tasks are completed to the optimum accuracy; for example, when someone is trying to measure a percentage with a calculator, the calculator would use float values. I.e. I f someone wanted to find 66 percent of 100, they would have to multiply 100 by 0.66 which is a float value.
This data type is data which stores a specific point in time which can show the day, month and the year. It can also show the time of the day including the hours, minutes and seconds. The value can be manipulated so that it works appropriately with different timezones. This data type is used to show the user the date/time and it can be used in programs which involve alarms or reminders that need to occur at specific times in the real world.
Strings are a data type which consists of plain text in quotation marks; they are used to be printed out onto a screen and they can be stored in variables as well; e.g. name = ‘Bob’. It is not possible to use mathematical operations with strings as they are seen as sentences or words; they can be used to store someone’s name because other data types aren’t able to store alpha characters. Although other data types can't store alpha characters, strings can contain alphanumeric characters and not just letters. Strings are also used to store things like phone numbers because of the fact that if a phone number was stored as an integer, the zero in the beginning of the number would be removed since numbers cannot start with a zero; it is also unnecessary to use mathematical operations on phone numbers which makes it more sensible to keep it in a string.
Sequence, Selection & Iteration
Sequence, Selection, and Iteration are three basic concepts of programming which are very important to understand in order to create an efficient and functioning program. This is great.
All code in programming is read by the computer in a specific order. It is important to consider the sequencing of your code when you are typing it in order to make sure that it is executed properly and without error. If a developer doesn’t sequence their work; it could make it so that the code doesn’t function how it was expected. An example of inappropriate sequencing would be if the programmer defines a variable via user input and then they redefine the variable to the default value. This means that whenever the variable is accessed, the incorrect value will have been used; e.g. if someone printed the variable, they would print the wrong variable.
Selection is important in programming so that the developer can create multiple pathways for the user of the application to take. Selection allows a user of an application to take multiple possible outcomes; this is accomplished using IF statements which test for a specific criteria and executes a series of code depending on whether the status criteria is true. An example of where this is used would be if someone wanted to register an account on an 18+ website; the registration process would use selection to make sure that if the registering user is below 18 years old; they would be revoked access to the website.
Iteration is the repetition of a specific procedure and it is very important in programming. It is used in programming to create loops; which is a series of code that is executed a repeated number of times. Iteration can also be used to create an infinite loop which is commonly used in video games to constantly update the rendered display of the video game. Iteration is used when a specific sequence of code needs to be executed multiple times until a condition is complete. E.g. A timer would keep printing the current time that is left until it reaches 0. In this example the condition would be whether or not the time has passed and the code would subtract 1 from a variable which has the value of how much time is left and it would print it.