You are on page 1of 19

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 an 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:.....................................................4
D2: Critically Evaluation, code structure and characteristics...............................................................9
Learning outcome 3: Using an IDE, write fundamental algorithms in code.......................................11
P3: Write a program that implements an algorithm using an IDE:....................................................11
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 procedure that gives a series of instructions that must be followed in a certain
sequence in order to achieve the intended outcome. Algorithms may be implemented in more
than one computer language since they are often invented independently of the underlying
languages.

 Characteristics:
 Input
 Output
 Finiteness
 Validity

elax (n.d.). [Online] Available at: https://www.simplilearn.com/tutorials/data-


structure-tutorial/what-is-an-algorithm
[Accessed 21 Jul. 2022].
M1: Application Programming process
 Learn the fundamentals of the algorithm.
 Look for different learning tools.
 Break the algorithm into into pieces.
 Begin with a simple example.
 Validate with a trustworthy implementation.
 Record your process.
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 21 Jul. 2022].
D1: Implementation of an algorithm.
Think of it as a rough guide to what to do when you step into the world of programming.
1. Get a basic understanding of the algorithm
2. Find some different learning sources
3. Break the algorithm into chunks

2
4. Start with a simple example
5. Validate with a trusted implementation
6. Write up your process

Write a Program
The aim of programming is to describe the design to your computer. That is, instructing
students on how to solve the design.
A programmer is typically written in three stages:
Coding
Compiling
Debugging

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


https://www.slideshare.net/BilalMaqbool3/algorithm-defination-design-
implementation [Accessed 21 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 organising code requires creating event
subprograms are specified as that relies on encapsulation, handling routines and
a series of phases. Declarative inheritance, replacement, depending on the core event
programmers, on the other programming to interfaces, loop of the underlying
hand, aim to describe the and other concepts. Object- system. You may avoid the
conclusion without regard for oriented programming is hassle of creating your own
the methods required to often procedural. event loop by using many
computerise it, instead libraries that already work
providing a description or with the system-provided
denotation of the desired event loop. Although event-
result. based systems are often
designed in an object-oriented
paradigm, this is not always
the case.
elax (n.d.). [online] Available at: https://www.quora.com/What-are-the-
relationships-between-programming-procedural-object-oriented-and-event-driven-
paradigms [Accessed 21 Jul. 2022].
3
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;

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>

4
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
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";

5
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";
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";

6
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


// 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";

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

8
}
}

 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

elax (n.d.). [online] Available at: https://www.assignmentexpert.com/homework-


answers/programming-and-computer-science/c-sharp/question-246635 [Accessed
21 Jul. 2022].
D2: Critically Evaluation, code structure and characteristics.

Object-oriented programming revolves around the concepts of objects and classes. In Java, the
classes are referred as templates for the objects while the objects are instances of a class so, the
objects can inherit all the characteristics, variables, and functions of the class.
Procedural programming gets its name due to the concept of procedural calls. Like other
programming paradigms, it has its own advantages and disadvantages. So, take note of them and
compare them with your requirements to know whether the popular programming paradigm
works out for you or not.

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


9
 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.
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';

10
this.mob = 900558981;

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

 Event-driven paradigms
o Service oriented
o 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>

#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.
These IDEs boost productivity by minimizing setup time, speeding up development tasks,
keeping developers up to date on the latest best practices and hazards, and standardizing the
development process so that it can be used by everyone.
o Faster setup:
o Faster development tasks:
o Continual learning:
o Standardization:

15
elax (n.d.). [online] Available at: https://www.veracode.com/security/integrated-
development-environment [Accessed 21 Jul. 2022].

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:
 IntelliJ IDEA.
 Visual Studio.
 Eclipse.
 NetBeans.
 Common features of an IDE
IDEs have been around for decades.
From being merely a platform for debugging and testing purposes to an integrated piece of
software that can be an extension of the developer, IDE's continue to evolve and change with
time.
Here are some standard features of an IDE:
 Text editor:
 Debugger:
 Compiler:
 Code completion:
elax (n.d.). [online] Available at: https://www.sitepoint.com[Accessed 21 Feb. 2022].

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


P4: Debugging procedure and IDE debugging facilities:
 Debugging is the deliberate process of locating and minimizing the amount of flaws (or
faults) in a computer programmer so that it behaves as intended.
 Debugging is required for two sorts 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 part of code produces different results than expected, attempt to make
that section of code operate in isolation. elax (n.d.). [online] Available at:
http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=

16
%2Fcom.qnx.doc.ide.userguide%2Ftopic%2Fdebug_Base_.html [Accessed 21 Jul.
2022].

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

17
perhaps as research towards producing better tools to be used in the software design and
engineering process. However, security and resilience are qualities that must be included in both
the design and execution of software.

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.
 The original creator of software usually never completely supports it.
 Coding standards promote software readability by helping developers to comprehend new
code more quickly and effectively.
 Advantages of OOP
Moving on to the benefits of OOP, we'd like to point out that there are several, since this is one
of the most extensively used programming methodologies. Let's look at what benefits OOP
provides to its consumers.
 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-object-oriented-programming [Accessed 20 Jul. 2022].
P5: Outline the coding standard you have used in your code:
 OOP code?
 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 of oops.
Encapsulation, abstraction, inheritance, and polymorphism are the four object-oriented
programming concepts.
These words may be terrifying to a new developer.
And Wikipedia's complex, too long explanations may sometimes contribute to the confusion.
That is why I want to offer a brief, basic explanation of each of these ideas.

18
It may seem to be something you'd say to a child, but I'd love to hear these comments when I do
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 21 Jul. 2022].

19

You might also like