You are on page 1of 18

v

Table of Contents

Learning outcome 1: Define basic algorithms to carry out an operation and outline the process of
programming an application....................................................................................................................2
P1: Algorithm, Explanation, Problem and Example:.........................................................................2
M1: Application Programming process...............................................................................................2
D1: Implementation of algorithm........................................................................................................2
Learning outcome 2: Characteristics of procedural, object-orientated and event-driven
programming.............................................................................................................................................3
P2: Explanation, Features, and Relationships:...................................................................................3
M2: Compare, Contrast used with a source code of an application:.................................................3
D2: Critically Evaluation, code structure and characteristics...........................................................9
Learning outcome 3: Using an IDE, write fundamental algorithms in code.......................................10
P3: Write a program that implements an algorithm using an IDE:................................................10
M3: Use of an IDE for development of applications:............................................................................15
D3: Use the IDE to control the program's development process:........................................................16
Learning outcome 4: Importance of a coding standard and debugging process................................16
P4: Debugging procedure and IDE debugging facilities:..................................................................16
M4: Evaluate, help develop more secure debugging, robust applications:.....................................17
D4: Evaluate why a coding standard is necessary:............................................................................18
P5: Outline the coding standard you have used in your code:.........................................................18

1
Learning outcome 1: Define basic algorithms to carry out an operation and
outline the process of programming an application.
P1: Algorithm, Explanation, Problem and Example:
An algorithm is a set of instructions that a computer must follow in order to perform calculations
or other problem-solving activities. A formal definition of an algorithm is a finite collection of
instructions that must be executed in a certain sequence to fulfil a stated goal.

Characteristics:
Language independent, Input, Output, Finiteness, Validity

elax (n.d.). [Online] Available at:


https://www.slideshare.net/BilalMaqbool3/algorithm-defination-design-
implementation [Accessed 22 Jul. 2022].
M1: Application Programming process
 Understand the algorithm's principles.
 Look for various learning tools.
 Divide the algorithm into sections.
 Begin with a simple example.
 Validate with a reliable implementation.
 Document your procedure.
elax (n.d.). [online] Available at: https://www.google.com/search?
q=6+Steps+To+Write+Any+Machine+Learning+Algorithm+From+Scratch
%3A+Perceptron+Case+Study+%7C+by+John+Sullivan+
%7C+Towards+Data+Science&rlz=1C1CHWL_enPK892PK892&oq=6+Steps+To+Write
+Any+Machine+Learning+Algorithm+From+Scratch%3A+Perceptron+Case+Study+
%7C+by+John+Sullivan+
%7C+Towards+Data+Science&aqs=chrome.0.69i59.416j0j9&sourceid=chrome&ie=U
TF-8 [Accessed 22 Jul. 2022].
D1: Implementation of algorithm.
Think of it as a rough guide to what to do when you step into the world of programming.
Learn the basics of the algorithm.
Look for various learning resources.
Divide the algorithm into sections.
Begin with a basic example.
Validate with a reliable implementation.

2
Document your procedure.

elax (n.d.). [online] Available at:


https://www.slideshare.net/BilalMaqbool3/algorithm-defination-design-
implementation [Accessed 22 Jul. 2022].

Learning outcome 2: Characteristics of procedural, object-orientated and


event-driven programming.
P2: Explanation, Features, and Relationships:
 Relationship
Procedural OOP Event based
In procedural programming, a Object oriented programming Event-based programming
programmer and its is a way of organizing code requires creating event
subprograms are specified as that relies on encapsulation, handling routines and
a series of phases. inheritance, replacement, depending on the core event
programming to interfaces, loop of the underlying
and other concepts. system.
elax [online] Available at: https://www.quora.com/What-are-the-relationships-
between-programming-procedural-object-oriented-and-event-driven-paradigms
[Accessed 24 Jul. 2022].

M2: Compare, Contrast used with a source code of an application:


Procedural paradigms
#include <iostream>

// function declaration

int sum(int numl, int num2);

int main ()

// local variable declaration:

int a = 10;

int b = 20;

int res;

// call to sum function

res = sum(a, b);

std::cout << a << "+" << b << "=" << res << std::endl;

3
return 0;

// function returning the sum of two numbers

int sum(int numl, int num2) {

int result;

result = numl + num2;

return result;

OOP
// C++ program to implement the ATM
// Management System
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
class Bank {

// Private variables used inside class


private:
string name;
int accnumber;
char type[10];
int amount = 0;
int tot = 0;

// Public variables
public:
// Function to set the person's data
4
void setvalue()
{
cout << "Enter name\n";
cin.ignore();

// To use space in string


getline(cin, name);

cout << "Enter Account number\n";


cin >> accnumber;
cout << "Enter Account type\n";
cin >> type;
cout << "Enter Balance\n";
cin >> tot;
}
// Function to display the required data
void showdata()
{
cout << "Name:" << name << endl;
cout << "Account No:" << accnumber << endl;
cout << "Account type:" << type << endl;
cout << "Balance:" << tot << endl;
}
// Function to deposit the amount in ATM
void deposit()
{
cout << "\nEnter amount to be Deposited\n";

5
cin >> amount;
}
// Function to show the balance amount
void showbal()
{
tot = tot + amount;
cout << "\nTotal balance is: " << tot;
}
// Function to withdraw the amount in ATM
void withdrawl()
{
int a, avai_balance;
cout << "Enter amount to withdraw\n";
cin >> a;
avai_balance = tot - a;
cout << "Available Balance is" << avai_balance;
}
};
// Driver Code
int main()
{
// Object of class
Bank b;

int choice;

// Infinite while loop to choose

6
// options everytime
while (1) {
cout << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~"
<< "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
<< "~~~WELCOME~~~~~~~~~~~~~~~~~~"
<< "~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
<< "~~~~~~~~~\n\n";
cout << "Enter Your Choice\n";
cout << "\t1. Enter name, Account "
<< "number, Account type\n";
cout << "\t2. Balance Enquiry\n";
cout << "\t3. Deposit Money\n";
cout << "\t4. Show Total balance\n";
cout << "\t5. Withdraw Money\n";
cout << "\t6. Cancel\n";
cin >> choice;

// Choices to select from


switch (choice) {
case 1:
b.setvalue();
break;
case 2:
b.showdata();
break;
case 3:
b.deposit();

7
break;
case 4:
b.showbal();
break;
case 5:
b.withdrawl();
break;
case 6:
exit(1);
break;
default:
cout << "\nInvalid choice\n";
}
}
}

Event Driven paradigms


do forever: // the main scheduler loop

get event from input stream

if event type == EndProgram:

quit // break out of event loop

else if event type .= event_01:

call event-handler for event_01 with event parameters

else if event type .= event_02:

call event-handler for event_02 with event parameters

else if event type .= event_nn:

call event-handler for event_nn with event parameters else handle unrecognized event // ignore or raise
exception

end loop

8
elax [online] Available at:
https://www.assignmentexpert.com/homework-answers/programming-and-
computer-science [Accessed 22 Jul. 2022].
D2: Critically Evaluation, code structure and characteristics.

The ideas of objects and classes are fundamental to object-oriented programming. In Java,
classes are referred to as templates for objects, and objects are instances of a class, thus the
objects may inherit all of the class's traits, variables, and functions.
The notion of procedural calls gives rise to the moniker "procedural programming." It has
benefits and limitations similar to other programming paradigms. Take note of them and
compare them to your needs to see if the common programming paradigm is suitable for you.

elax (n.d.). [online] Available at: https://www.knowledgeboat.com/question/what-


are-the-characteristics-of-procedural-programming--28311496451138200 [Accessed
21 Jul. 2022].
They are discussed below:

Procedural programming paradigm


This paradigm places a premium on method in terms of the underlying machine model. There is
no distinction between the procedural and the urgent approach.
*include <iostream>

using namespace std;

int main() I int i, fact = 1, num;

cout << "Enter any Number: ";

cin >> number;

for (i = 1; i <= num; i++) {

fact = fact * i;

cout « "Factorial of " << num « " is: " << fact << endl;

return 0;

Object oriented programming


The software is written as a set of communication-oriented classes and objects. Objects are the
smallest and most fundamental entities, and all computations are conducted on them alone.

9
import java.io.•;

class GFG {

public static void main(String[] args)

System.out.println("GfG!");

Signup sl = new Signup();

sl.create(22, "riya", "riya2@gmail.com", 'F', 89002);}}

class Signup { int userid; String name; String emailid; char sex; long mob;

public void create(int userid, String name, String emailid, char sex, long mob){

System.out.println("Welcome to GeeksforGeeks\nLets create your account\n");

this.userid = 132; this.name = "Radha";

this.emailid = "radha.89@gmail.com";

this.sex = 'F';

this.mob = 900558981;

System.out.println("your account has been created");

Event-driven paradigms
Service oriented, Time driven
import asyncio

def hello_world(lp): print('Hello World') 1p.stop()

1p = asyncio.get_event_loop()

1p.call_soon(hello_world, 1p)

1p.run_forever() 1p.close()

Learning outcome 3: Using an IDE, write fundamental algorithms in code.


P3: Write a program that implements an algorithm using an IDE:
#include<iostream>

#include<vector>

10
#include<stdio.h>

#include<cstring>

#include<fstream>

#include<algorithm>

using namespace std;

class course {

public: long int reg;

char name[80],branch[50];

void input() {

cout<<"\n Enter course name: ";

gets(name); cout<<"\n Assign to level: ";

cin>>reg; fflush(stdin);

11
cout<<"\t\tDisplay Records";

cout«"\n"; cout<<"\n Course Name - "<<name;

cout<<"\n Level No. - "<<reg;

cout<<"\n Course - "<<branch;

cout«"\n";

system("PAUSE");

system("CLS");

} bool operator == (course a) { if(reg..a.reg) return true;

else return false;

}; vector <course>v;

int search reg(long int reg,int &i);

void get_file()

course x;

2 -s 2 n .

fstream f;

f.open("College.txt",ios::out);

for(int i=0;i<v.size();i++) {

course x=v[i]; f.write((char *) &x,sizeof(class course));

(.close();

} int search reg(long int reg,int { int ta=0;

for(i=0;i<v.size();

i++) if(v[i].reg==reg) { ta=1; break;

} return ta;

} int search name(char name[],vector<int> &vi)

int i,ta=0; for(i=0;i<vesize();

12
1++) if(strcmp(v[i].name,name)==0)

Figure 1

Figure 2

13
Figure 3

Figure 4

Figure 5

14
Figure 6

Figure 7

M3: Use of an IDE for development of applications:

 The Benefits of Using IDEs


Integrated development environments help developers be more productive.
 Faster setup:
 Faster development tasks:
 Continual learning:
 Standardization:

elax (n.d.). [online] Available at: https://www.veracode.com/security/integrated-


development-environment [Accessed 26 Jul. 2022].

15
D3: Use the IDE to control the program's development process:
An IDE is used by developers to create, manage, and execute code while their applications are
running. It simplifies the development process by abstracting various parts of editing code into
separate apps.
Here are the best available IDEs for Java developers:
 Eclipse.
 NetBeans.
 IntelliJ IDEA.
 Visual Studio.
Common features of an IDE
IDEs have been around for decades.
IDEs have evolved and changed throughout time, from being only a platform for debugging and
testing to an integrated piece of software that may act as an extension of the developer.
 Text editor:
 Debugger:
 Compiler:
 Code completion:
elax (n.d.). [online] Available at: https://www.sitepoint.com[Accessed 22 Feb. 2022].

Learning outcome 4: Importance of a coding standard and debugging process.


P4: Debugging procedure and IDE debugging facilities:
Debugging is the purposeful act of discovering and reducing defects (or errors) in a computer
programming in order for it to operate as intended. Debugging is necessary for the following
types of errors:

Debugging facilities
The ability to run or halt the target program at specific points, display the contents of memory,
CPU registers, or storage devices (such as disc drives), and modify memory or register contents
to enter selected test data that could be the cause of faulty program execution are all common
debugging features. If a section of code produces unexpected results, consider executing it in
isolation. elax (n.d.). [online] Available at:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=
%2Fcom.qnx.doc.ide.userguide%2Ftopic%2Fdebug_Base_.html [Accessed 26 Jul.
2022].

16
Figure 8

Figure 9

M4: Evaluate, help develop more secure debugging, robust applications:


It just cannot. The process of replicating, identifying, and describing "bugs" (defects) in a system
is known as debugging.
It's a remedy after those flaws have already been introduced! At best, we may utilize analysis of
previous debugging cycles to inspire improved engineering practices and perhaps as research
towards producing better tools to be used in the software design and engineering process.

17
elax (n.d.). [online] Available at: https://www.quora.com/How-can-the-debugging-
process-be-used-to-help-develop-more-secure-robust-applications [Accessed 21 Jul.
2022].
D4: Evaluate why a coding standard is necessary:
For software engineers, coding standards are crucial for various reasons: Maintenance accounts
for 40% to 80% of the entire cost of software.

Benefits of OOP
 Data Redundancy
 Polymorphism Flexibility
 Re-usability
 Code Maintenance
 Security
 Easy troubleshooting

Admin (n.d.). [online] Available at: https://www.roberthalf.com/blog/salaries-and-


skills/4-advantages-of-OOP [Accessed 22 Jul. 2022].
P5: Outline the coding standard you have used in your code:
OOP
Object-oriented programming (OOP) is a programming approach that organizes software
design around data, rather than functions and logic. An object is a data field that has distinct
features and behavior.

Coding standard
Encapsulation, abstraction, inheritance, and polymorphism are the four concepts of object-
oriented programming. These are daunting words for a new programmer. And Wikipedia's
complex, too long explanations may sometimes add to the confusion. That is why I want to offer
a short review of each of these principles. It may seem to be something you'd say to a child, but
I'd love to hear these comments when I conduct an interview. elax (n.d.). [online] Available
at: https://www.freecodecamp.org/news/object-oriented-programming-concepts-
21bb035f7260/#:~:text=The%20four%20principles%20of%20object,abstraction%2C
%20inheritance%2C%20and%20polymorphism [Accessed 22 Jul. 2022].

18

You might also like