Unit 1 Assignment Brief 2
Unit 1 Assignment Brief 2
Submission
Issue date June 19, 2019
date
Submission Format:
Format: The submission is in the form of an individual written report. This should be written in
a concise, formal business style using single spacing and font size 12. You are required
to make use of headings, paragraphs and subsections as appropriate, and all work
must be supported with research and referenced using the Harvard referencing
system. Please also provide a bibliography using the Harvard referencing system.
Submission Students are compulsory to submit the assignment in due date and in a way
requested by the Tutors. The form of submission will be a soft copy in PDF posted on
corresponding course of http://cms.greenwich.edu.vn/
Note: The Assignment must be your own work, and not copied by or from another student
or from
books etc. If you use ideas, quotes or data (such as diagrams) from books, journals or other
sources, you must reference your sources, using the Harvard style. Make sure that you know how
to reference properly, and that understand the guidelines on plagiarism. If you do not, you definitely
get fail
Assignment Brief and Guidance:
Scenario: You have applied for a post as a trainee with a software development company and
have been invited for an interview. You have been passed the presentation to demonstrate your
problem solving and basic programming skills. Now you are given a more challenge task to create
a fully working, secure application that has been developed using an IDE and adheres to coding
standards for a detailed business problem.
Tasks
Page 1
You will discuss a suitable problem with your mentor and list the user requirements before
designing, implementing (coding) and testing a solution. You will create a presentation that should
include:
• Introduction to your program (list of requirements and screenshots of program)
• Explain some of programming paradigms. Evaluate why and how your program use these (or
some of) paradigms.
• Explain the common features of an IDE should have and evidence of how the IDE was used
to manage the development of your code.
• An evaluation of developing applications using an IDE versus developing an application without
using an IDE.
• An explanation and evaluation of the debugging process in the IDE used and how it helped
with development.
• An explanation and evaluation of coding standards used in your program and the benefits to
organisations of using them.
The working application produced must also be demonstrated together with the presentation.
P3 Write a program that M3 Use the IDE to manage the D3 Evaluate the use of an IDE
implements an algorithm development process of the for development of applications
using an IDE. program. contrasted with not using an
IDE.
P4 Explain the debugging M4 Evaluate how the debugging D4 Critically evaluate why a
process and explain the process can be used to help coding standard is necessary
debugging facilities available develop more secure, robust in a team as well as for the
applications. individual.
Page 2
in the IDE.
Page 3
Contents:
P2 Give explanations of what procedural, object-orientated and event-driven paradigms are; their
characteristics and the relationship betweenthem………………………………………………………5
P4 Explain the debugging process and explain the debugging facilities available in the IDE…….19
References…………………………………………………………………………………………………30
Page 4
P2 Give explanations of what procedural, object-orientated and event-driven paradigms are; their
characteristics and the relationship between them.
- Procedural programming:
• Real world applications become more complex and large, several problems arise:
o Algorithm are more complex, hence more difficult to design.
o Implementation of complex algorithm is difficult because of the size of the program.
o Larger program, testing, debugging, and maintenance will be difficult.
+ One glaring advantage of Procedural Programming is the ability to jump right into coding a
program without the need to create any objects or classes. Many programmers prefer this method
because they want to be able to write small amounts of code in a short period of time without the
need to plan it out. Examples could include simple forms or html pages with basic data displayed.
Another advantage of Procedural Programming is the ability to learn the language easily. Many
developers begin their education by copying code from the internet and then pasting it in an
application to run. With Object-oriented Programming there is more to do besides just copying and
pasting code, but in Procedural Programming that is generally an acceptable way to build a
program.
The top down structure is also an advantage for those who prefer to work their way through a
program vs. planning the program out before the development process. Many developers who are
creative prefer to write their code out like reading a story, discovering and creating along the way.
Page 5
can be executed. With this approach finding errors in the code becomes more and more difficult as
the code gets longer and longer.
+ The last disadvantage I will speak about is the difficulty for developers who use Procedural
Programming as their approach to programming to move from language to language. Without a
knowledge of Object-oriented Programming it is very difficult for a developer to be qualified in
many languages who use this method. Instead the programmers would be required to learn each
new language individually in order to code in it. Object-oriented Programming lays a basic
groundwork that is used in hundreds of languages.
- Example:
- When i start code , program run from line 1 to line 27, line 16 and 18 are print a string
inside Console.Write
- Line 17 and 19 are the program want user to input number to calculate sum between two
number.
- Line 20, the program calculate between two number from sum function and return value for
result.
- Line 21, the program print the result.
- Object-orientated programming:
• Event driven programming is a very popular programming practice and is widely used. If
you have a phone, microwave, toaster, fire alarm or a PC you have used this one way or
the other. The code will wait for an event which is either a CLICK of a mouse button, start
the engine, detect smoke, detect heat on the food or whatever then the program will
perform a certain action based on that EVENT. Makes sense yet? The whole process is
more complicated that just that but essentially follow the similar idea. In event driven
programming an EVENT LOOP plays a major role. These loops are needed to keep testing
the user interface to detect whether anything has happened for example a mouse click or
key press from the keyboard. There are many other types of loops that the programmer will
Page 6
use in many of the tutorials in MOOICT. We have explored how to use clicks, key press
events, form load events and most important timer events. Major programming languages
that are used to create GUI application all have their own version of event driven
programming for example C#, C++, Java, JavaScript and Objective C.
• The last advantage I will talk about is the logical structure of Object-oriented Programming.
The ability to relate code to real world examples makes the process much easier and more
simple to code. Unlike Procedural Programming where you make adjustments as you go, in
Object-oriented Programming you have the majority of your program diagrammed out
before you ever type out lines of code
Page 7
- Example:
- In image, i created the object-orientated with “t”, I use it to call setNumber1, setNumber2,
getNumber1 and getNumber2 to calculate between two number.
Page 8
- Event-driven programming:
• Event driven programming is a very popular programming practice and is widely used. If
you have a phone, microwave, toaster, fire alarm or a PC you have used this one way or
the other. The code will wait for an event which is either a CLICK of a mouse button, start
the engine, detect smoke, detect heat on the food or whatever then the program will
perform a certain action based on that EVENT. Makes sense yet? The whole process is
more complicated that just that but essentially follow the similar idea. In event driven
programming an EVENT LOOP plays a major role. These loops are needed to keep testing
the user interface to detect whether anything has happened for example a mouse click or
key press from the keyboard. There are many other types of loops that the programmer will
use in many of the tutorials in MOOICT we have explored how to use clicks, key press
events, form load events and most important timer events. Major programming languages
Page 9
that are used to create GUI application all have their own version of event driven
programming for example C#, C++, Java, JavaScript and Objective C.
• Programs that use event driven, which could be altered easily if the programmer wants
something to be change. It lets the programmer to produce a form to their requirements.
Also provides the programmer to be in charge.
• Programmes which are event driven can be put together without any problems and also the
program can be easily altered because if something isn't right then it will let the user to
change a piece of code or moving different tools around the form.
• Ease of development means how straightforward the program is.Also the programmer has
to manage one control at one time. The reason why the programmer has to do this is that
every control which is on the form are all programmed separately.
• The Programmer can put different things on top of the form, which Can make it simpler for
the programmer.Visual basic is used to make programmes becuase they are different tools
but also it it isn't just code because you can add picture boxes and text boxes.
• Simplicity of programming
• Ease of development
• Flexibility
• It lets the user select different controls for instance the command button and they can put
the button onto the form when .
• Also it’s very difficult to translate from event-driven programming into a different language
as it could not work in certain ways like for example, the buttons might not work if it’s
translated into a different program.
• Also in some cases you can’t even translate event-driven programming languages into
different languages.
Page 10
• Another example is a game, you might want to translate a language for a game which uses
motion to work on a keyboard, and sometimes this isn’t possible as motion uses movement
and can’t use keyboard buttons.
• Also programs like visual basic only works on windows as it uses windows libraries, it
wouldn’t work on any other OS. event-driven programming languages are generally platform
dependant on windows.
• Also you could lose some skills by using programs like visual basic which uses event-driven
programming as it makes coding easier for you to do.
• To conclude, using event driven programs isn’t really a bad thing but you could lose skill
from using programs like visual basic. And you can’t translate some languages.
Example:
- This is my form, it calculate between two number. The user input two the number into form.
The program calculate they and print they in form.
• In OOP with EDP all OOP principles (encapsulation, inheritance and polymorphism) stay
intact.
• In OOP with EDP objects acquire some mechanism of publishing event notifications and
subscribing to event notifications from other objects.
• The difference between OOP with / without EDP is control flow between objects.
• In OOP without EDP control moves from one object to another object on a method call.
Object mainly invokes methods of other objects.
• In OOP with EDP control moves from one object to another object on event notification.
Object subscribes on notifications from other objects, then waits for notifications from the
objects it is subscribed on, does some work based on notification and publishes it's own
notifications.
Page 11
- Simple comparision between OOP and Procedural:
• In Object-oriented Programming the classes could represent the pictures in the learn to
read books. A house could represent a class and anything the developer wants to have
included to describe that house like the color, size, number of bathrooms etc.
• In Procedural Programming the learn to read book would be words on the page without
pictures to help guide the young learner through the book. If the story was changed in the
beginning of the book it could disrupt or make the story later on in the book not make any
sense. Although learning to read the book would make programming with Procedural
Programming simple, it would make it difficult for other readers in the case of the book or
programmers in the case of Procedural Programming to add to the story.
• Procedural Programming also uses different methods throughout the code than Object-
oriented Programming.
Page 12
Procedural Object-oriented
procedure method
Record object
module class
- Procedural programming:
Page 13
- In image, when the program run into line 95, produce(i) function is called. It print name of
the product.
- Line 97, Price(i) functioon is called to calculate price for produce.
- Object-orientated programming:
- In image, when the program into line 94 , the program created object – orientated, such as: IDNo,
ProduceNo, AmountNo, SumNo, to print information about them into form 2 .
Page 14
(form 2)
- This is result of the programming run object – orientated.
- Event-driven programming:
(Form 1)
- When i run the program, form 1 appeared first, we have to input user and password to sign
in.
- There is that the user is admin and the password is 123456. If we input another user or
password, the program will print “ user or password is error”
Page 15
(form 2)
+ Produce list, price list, amout boxs, buttom summit and reset, listview, total box, etc
Page 16
(form 2)
+ The user have to input amout of produce that they want to buy.
Page 17
(form 2)
+ Then the user input amount , they have to click submit buttom to calulate price and print list
of produce, price, total and VAT.
+ If the user want to clear form to input again , they can click reset buttom, the program will
clear information in form.
+ And if the user do not user form , thet can click exit to close the program.
Page 18
P4 Explain the debugging process and explain the debugging facilities available in the IDE.
* Breakpoint:
- Breakpoint is used to notify debugger where and when to pause the execution of program.
- You can put a breakpoint in code by clicking on the side bar of code or by just pressing F9
at the front of the line.
- Example:
* Step over:
- After debugger hits the breakpoint, you may need to execute the code line by line.
- "Step Over" or F10 command is used to execute the code line by line.
Example:
Page 19
Page 20
* Simply Inspect Variables:
- You can hover over a variable to view the current value in a data tip.
Example:
* Step out:
Example:
- At this point you can decide you want to see what is in the method and Step Into (F11) it
- Once inside you may decide you don't really need to go through all the code. You can, at
any time, Step Out (SHIFT + F11) which will finish execution of the current method and return you
to the next line after the original call:
Page 21
* Run to cursor:
- Just put the cursor on the line you want to break on:
- And hit CTRL + F10. It will start the application and set a temporary Breakpoint on the line
you were at. The next time the code hits that line, it will enter break mode:
* Inspect Variables:
- The Locals (CTRL+ALT+V,L) window displays variables that are defined in the local scope,
which is generally the function or method that is currently being executed.
- The Autos (CTRL+ALT+V, A) window displays variables used around the current line (the
place where the debugger is stopped). Exactly which variables displayed is different in different
languages.
- You can use the Watch (Debug / Windows / Watch / Watch (1, 2, 3, 4))
and QuickWatch (right-click on variable / Debug / QuickWatch) windows to watch variables and
expressions during a debugging session.
- The difference is that the Watch window can display several variables, while
the QuickWatch window displays a single variable at a time.
Example:
Page 22
* Examine the call stack:
• While paused in the foreach loop, click the Call Stack window, which is by default open in
the lower right pane.
o If it is closed, open it while paused in the debugger by choosing Debug > Windows >
Call Stack.
• Click F11 a few times until you see the debugger pause in the Base.Draw method for the
Triangle class in the code editor. Look at the Call Stack window.
o The Call Stack window shows the order in which methods and functions are getting
called. The top line shows the current function (the Triangle.Draw method in this app).
The second line shows that Triangle.Draw was called from the Main method, and so on.
• The call stack is a good way to examine and understand the execution flow of an app.
• You can double-click a line of code to go look at that source code and that also changes the
current scope being inspected by the debugger. This action does not advance the
debugger.
• You can also use right-click menus from the Call Stack window to do other things. For
example, you can insert breakpoints into specified functions, advance the debugger
using Run to Cursor, and go examine source code.
* DEBUG TIPS:
• Determine potential error area. Set breakpoint before enter it
Page 23
• Use Step Over if you are really sure that function is correct, otherwise use Step Into
• Use Step Out if you are really sure that the rest of function is correct, otherwise use Step
Over / Step Into
• Remove unnecessary breakpoints to skip “clear” areas.
• Comments, 3 types:
o File headers
o Function headers
o Explanations of variables and statements
• Names (chosen by programmer)
• Statements
o Organization: files, “modules,” nesting
o Format: spacing and alignment
- Naming convention:
• Names representing types must be in mixed case starting with upper case.
o Example: Line, SavingsAccount
• Variable names must be in mixed case starting with lower case.
o Example: line, savingsAccount
• Named constants (including enumeration values) must be all uppercase using underscore
to separate words.
o Example: MAX_ITERATIONS, COLOR_RED, PI
• Names representing methods or functions must be verbs and written in mixed case starting
with upper case.
o Example: GetName(), ComputeTotalWidth()
• Variables with a large scope should have long names, variables with a small scope can
have short names
• The name of the object is implicit, and should be avoided in a method name.
o Example: line.getLength(); // NOT: line.getLineLength();
• Plural form should be used on names representing a collection of objects.
o Example:
vector<Point> points;
int values[];
nPoints, nLines
Page 24
• The suffix No should be used for variables representing an entity number.
o Example:
tableNo, employeeNo
Page 25
• Use prefix is / has / can for functions return boolean values.
o Example:
bool hasLicense();
bool canEvaluate();
bool isSorted();
• Functions should be named after what they return and procedures should be named after
what they do
o Example:
int getAge();
void print();
- Statement convention:
• Type conversions must always be done explicitly. Never rely on implicit type conversion.
o Example:
Page 26
• Complex conditional expressions should be avoided.
o Example:
if (isFinished || isRepeatedEntry)
{ ... }
• Floating point constants should always be written with decimal point and at least one
decimal.
o Example:
- Layout:
• White Space:
o Example:
a = (b + c) * d; // NOT: a=(b+c)*d
Page 27
• Logical units within a block should be separated by one blank line.
o Example:
matrix.setElement(1, 1, cosAngle);
matrix.setElement(1, 2, sinAngle);
matrix.setElement(2, 1, -sinAngle);
matrix.setElement(2, 2, cosAngle);
multiply(matrix);
Page 28
• Comments:
o File header: explain content of file
o Function header: explain content of function, parameters, return values, exceptions.
o Variables: Meaning of variable, usability
o Statements: Only if it’s necessary (complex formula, detailed protocol, special
business process, …)
o Example:
Page 29
References:
Unit 1 - Programming 2019, Lecture 6 – Procedural programming, University of Greenwich
(Alliance with Vietnam FPT Education), United Kingdom.
Unit 1 - Programming 2019, Lecture 12 – debugging & coding standards, University of Greenwich
(Alliance with Vietnam FPT Education), United Kingdom.
What are Procedural, Event Driven and Object Orientated Programming[online], viewed June 19
2019, from:< https://www.mooict.com/what-are-procedural-event-driven-and-object-orientated-
programming/>.
Lars Kokemohr (2018).What are the relationships between programming procedural, object-
oriented and event-driven paradigms? [online], viewed June 19 2019, from:<
https://www.quora.com/What-are-the-relationships-between-programming-procedural-object-
oriented-and-event-driven-paradigms>.
What is the relation of 'Event Driven' and 'Object Oriented' programming? [online], viewed June 19
2019, from:< https://stackoverflow.com/questions/22101731/what-is-the-relation-of-event-driven-
and-object-oriented-programming>.
Martin O'Shea (2017). What are the advantages of procedural programming languages over OOP
ones? [online], view June 19 2019, from< https://www.quora.com/What-are-the-advantages-of-
procedural-programming-languages-over-OOP-ones>.
Page 30
DIFFERENCE BETWEEN OBJECT-ORIENTED PROGRAMMING AND PROCEDURAL
PROGRAMMING LANGUAGES [online], viewed June 19 2019,
from<https://neonbrand.com/website-design/procedural-programming-vs-object-oriented-
programming-a-review/>.
Nhất Nghệ. Trung tâm đào tạo máy tính Nhất Nghệ, viewed June 19,2019,
from<https://drive.google.com/file/d/1iiA4AOxNvdjZpo58nDpIIkAVTZgSNFmx/view>.
Abhijit Jana(2010), Mastering Debugging in Visual Studio 2010 - A Beginner's Guide, viewed June
19 2019, from < https://www.codeproject.com/Articles/79508/Mastering-Debugging-in-Visual-
Studio-A-Beginn>.
Page 31