0% found this document useful (0 votes)
29 views11 pages

CSC 414 - Session - 02

Final year research

Uploaded by

NWAOBI DANIEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views11 pages

CSC 414 - Session - 02

Final year research

Uploaded by

NWAOBI DANIEL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

CSC 414: Organizations of Programming Languages

Session 02: Overview of Programming Language (Continue)

Sessional Outline
Design
Implementation techniques
Object Oriented Programming

DESIGN TECHNIQUE
Program design consists of the steps a programmer should do before they start coding the
program in a specific language. These steps when properly documented will make the completed
program easier for other programmers to maintain in the future. There are three broad areas of
activity:
 Understanding the Program
 Using Design Tools to Create a Model
 Develop Test Data

Understanding the Program: If you are working on a project as one of many programmers, the
system analyst may have created a variety of documentation items that will help you understand
what the program is to do. These could include screen layouts, narrative descriptions,
documentation showing the processing steps, etc. If you are not on a project and you are creating
a simple program you might be given only a simple description of the purpose of the program.
Understanding the purpose of a program usually involves understanding its:
 Inputs
 Processing IPO
 Outputs
This IPO approach works very well for beginning programmers. Sometimes, it might help to
visualize the program running on the computer. You can imagine what the monitor will look
like, what the user must enter on the keyboard and what processing or manipulations will be
done.

Page 1 of 11
Using Design Tools to Create a Model: At first, you will not need a hierarchy chart because your
first programs will not be complex. But as they grow and become more complex, you will divide
your program into several modules (or functions). There are several methods or tools for planning
the logic of a program. They include: flowcharting, hierarchy or structure charts, HIPO, Nassi-
Schneiderman chart and Warnier-Orr diagrams. Programmers are expected to be able to
understand and do flowcharting and pseudocode. These methods of developing the model of a
program are usually taught in most computer courses. Several standards exist for flowcharting and
pseudocode and most are very similar to each other. However, most companies have their own
documentation standards and styles. Programmers are expected to be able to quickly adapt to any
flowcharting or pseudocode standards for the company at which they work. The other methods
that are less universal require some training which is generally provided by the employer that
chooses to use them. Understanding the logic and planning the algorithm on paper before you start
to code is a very important concept. Many students develop poor habits and skipping this step is
one of them.
 Flow Chatting
The Flowchart is the most widely used graphical representation of an algorithm and
procedural design workflows. It uses various symbols to show the operations and decisions
to be followed in a program. It flows in sequential order. As an instance, a parallelogram
in the flowchart may be used to indicate input and output, a rectangular box indicates a
mathematical operation, a diamond symbol indicates the decision-making statements, and
several other symbols are used in flowcharts.

In many cases, a programmer usually makes a flowchart using paper and pencil or makes
it by connecting the shapes on a computer screen using the software. In a large system, a
flowchart is an important document for a system and individual program because it
summarizes a program's function in the form of symbols that are easy to understand and
clearly explained in English.

Page 2 of 11
Advantages of flowchart

Proper debugging
Effective analysis
Efficient coding
Proper documentation
Efficient program maintenance

Disadvantages of flowchart

Time-consuming
Complex
Difficult to modify
It has no standard

Page 3 of 11
 Hierarchy or Structured Charts
The hierarchy chart (also known as a structure chart) shows the relationship between
various modules. Its name comes from its general use in showing the organization (or
structure) of a business. The President at the top, then vice presidents on the next level, etc.
Within the context of a computer program, it shows the relationship between modules (or
functions). Detail logic of the program is not presented. It does represent the organization
of the functions used within the program showing which functions are calling on a
subordinate function. Those above are calling those on the next level down. Hierarchy
charts are created by the programmer to help document a program. They convey the big
picture of the modules (or functions) used in a program.

Example of Hierarchical Chart

 Hierarchical Input Process Output (HIPO) Chart


HIPO stands for Hierarchical Input Process Output. HIPO diagram assesses the system and
facilitates documentation. It organizes the software system's modules into a hierarchy.
HIPO diagrams can be used to get a high-level picture of the system's functions. The
functions are further divided into sub-functions, using HIPO diagrams demonstrating the
system functions. HIPO diagrams are excellent for documentation. By presenting the
system's structure in a graphical format, designers and managers may quickly comprehend
it.

Page 4 of 11
Advantages of HIPO

1. Offer more detail than other types of documentation.


2. Each module's input and output are properly labeled.
3. Can be used to quickly determine what modules call the module under investigation.

Disadvantages of HIPO

1. The biggest downside of HIPO is that the documentation for a programme can become
quite large: each module has its page, regardless of its actual size.
2. Structure charts and pseudocode are more extensively utilized than HIPO charts.
3. HIPO does not provide any data flow or control flow information.

Example of HIPO Chart

 Nassi-Shneiderman Chart
A Nassi–Shneiderman Chart (NSD) is a graphical representation of structured
programming. These diagrams are also called "structograms" as they show a program’s
structure. They don’t have a representation for a GOTO statement, which is in line with
the structured programming concept to make it easier to understand. They were
incorporated into several other software programs, including the German EasyCode and
Microsoft Visio.
From a modern perspective, they appear to be a little awkward, yet in the beginning, they
were a very effective planning and communication tool for algorithms. They took off far
more in the German-speaking world than everywhere else or in the United States, for

Page 5 of 11
whatever reason. Mainly in schools they are still used to teach programming. Nowadays,
you may choose to utilize flowcharts or something from the UML “toolbox” if you need to
accomplish a comparable task. For high-level programming languages like C, Pascal, Java,
Python, etc., structured flowcharts work significantly better.

 Warner-Orr Diagram
Jean-Dominique Warnier and Kenneth Orr created the Warnier-Orr diagram as a
visualization tool to show the hierarchical breakdown of complex data or processes. Its
primary use is to represent the logical structure of programs. A program is a set of ordered
instructions that processes input data to produce results. The microcontroller you are
programming is simply just a fast information-processing tool. The input data, results, and
program are all information files. These information files are not fully independent data
but can be nested within themselves. That is, they can be broken down into subparts and
hierarchically organized in a parent-child manner. The Warnier-Orr diagram lets you
define the desired output and work backward, decomposing the input and process steps
needed to produce the desired results. Then, it helps you to graphically represent the
hierarchy of the program steps and the input and output data structures that have been
broken down.

Develop Test Data


Test data consists of the programmer providing some input values and predicting the outputs. This
can be quite easy for a simple program and the test data can be used to check the model to see if it
produces the correct results.

IMPLEMENTATION TECHNIQUE
There four major types of implementation techniques which are listed as below.
 Compilation – Programs are translated into machine Language & System calls
 Interpretation – Programs are interpreted by another program (an interpreter)
 Hybrid – Programs translated into an intermediate language for easy interpretation
 Just –in-time – Hybrid implementation, then compile sub programs code the first time they
are called.

Page 6 of 11
COMPILATION
- Translated high level program (source language) into machine code
(machine language)
- Slow translation, fast execution
- Compilation process has several phases
o Lexical analysis converts characters in the source program into
lexical units (e.g. identifiers, operators, keywords).
o Syntactic analysis: transforms lexical units into parse trees which
represent the syntactic structure of the program.
o Semantics analysis check for errors hard to detect during syntactic
analysis; generate intermediate code.
o Code generation – Machine code is generated

INTERPRETATION
Easier implementation of programs (run-time errors can easily and
immediately be displayed).
- Slower execution (10 to 100 times slower than compiled programs)
- Often requires more memory space and is now use for traditional high-
level languages.
- Significant comeback with some Web scripting languages like PHP and
JavaScript.
- Interpreters usually implement as a read-eval-print loop:
o Read expression in the input language (usually translating it in
some internal form)
o Evaluates the internal forms of the expression
o Print the result of the evaluation
o Loops and reads the next input expression until exit
- Interpreters act as a virtual machine for the source language:
o Fetch execute cycle replaced by the read-eval-print loop
o Usually has a core component, called the interpreter “run-time”
that is a compile program running on the native machine.

HYBRID IMPLEMENTAITON
- This involves a compromise between compilers and pure interpreters. A
high level program is translated to an intermediate language that allows
easy interpretation.
- Hybrid implementation is faster than pure interpretation. Examples of the
implementation occur in Perl and Java.
o Perl programs are partially compiled to detect errors before
interpretation.
o Initial implementat6ions of Java were hybrid. The intermediate
form, byte code, provides portability to any machine that has a byte
code interpreter and a run time system (together, these are called
Java Virtual Machine).

Page 7 of 11
JUST-IN-TIME IMPLEMENTATION
This implementation initially translates programs to an intermediate language then
compile the intermediate language of the subprograms into machine code when they
are called.
- Machine code version is kept for subsequent calls. Just-in-time systems
are widely used for Java programs. Also .NET languages are implemented with a JIT system.

OBJECT ORIENTED PROGRAMMING LANGUAGE


The word object-oriented is the combination of two words i.e. object and oriented. The
dictionary meaning of the object is an article or entity that exists in the real world. The meaning
of oriented is interested in a particular kind of thing or entity. In layman's terms, it is a
programming pattern that rounds around an object or entity are called object-oriented
programming.
The object-oriented programming is basically a computer programming design philosophy or
methodology that organizes/ models software design around data, or objects rather than functions
and logic.
An object is referred to as a data field that has unique attributes and behavior. Everything in OOP
is grouped as self-sustainable objects.
It is the most popular programming model among developers. It is well suited for programs that
are large, complex, and actively updated or maintained. It simplifies software development and
maintenance by providing major concepts such as abstraction, inheritance, polymorphism, and
encapsulation. These core concepts support OOP.
A real-world example of OOP is the automobile. It more completely illustrates the power of object-
oriented design.
Pillars of OOPs
The major concepts that we have discussed above are known as pillars of OOPs. There are four
pillars on which OOP rests.
 Abstraction
 Encapsulation
 Inheritance
 Polymorphism
 Coupling
 Cohesion

Page 8 of 11
Abstraction

The concept allows us to hide the implementation from the user but shows only essential
information to the user. Using the concept developer can easily make changes and added over time.

There are the following advantages of abstraction:


 It reduces complexity.
 It avoids delicacy.
 Eases the burden of maintenance
 Increase security and confidentially.
Encapsulation
Encapsulation is a mechanism that allows us to bind data and functions of a class into an entity. It
protects data and functions from outside interference and misuse. Therefore, it also provides
security. A class is the best example of encapsulation.

Inheritance

The concept allows us to inherit or acquire the properties of an existing class (parent class) into a
newly created class (child class). It is known as inheritance. It provides code reusability.

Page 9 of 11
Polymorphism

The word polymorphism is derived from the two words i.e. ploy and morphs. Poly means many
and morphs means forms. It allows us to create methods with the same name but different method
signatures. It allows the developer to create clean, sensible, readable, and resilient code.

The above figure best describes the concepts of polymorphism. A person plays an employee role
in the office, father and husband role in the home.

Coupling
In programming, separation of concerns is known as coupling. It means that an object cannot
directly change or modify the state or behavior of other objects. It defines how closely two objects
are connected together. There are two types of coupling, loose coupling, and tight coupling.
Objects that are independent of one another and do not directly modify the state of other objects is
called loosely coupled. Loose coupling makes the code more flexible, changeable, and easier to
work with.
Objects that depend on other objects and can modify the states of other objects are called tightly
coupled. It creates conditions where modifying the code of one object also requires changing the

Page 10 of 11
code of other objects. The reuse of code is difficult in tight coupling because we cannot separate
the code.
Since using loose coupling is always a good habit.
Cohesion
In OOP, cohesion refers to the degree to which the elements inside a module belong together. It
measures the strength of the relationship between the module and data. In short, cohesion
represents the clarity of the responsibilities of a module. It is often contrasted with coupling.
It focuses on a how single module or class is intended. Higher the cohesiveness of the module or
class, better is the object-oriented design.

There are two types of cohesion, i.e. High and Low.


 High cohesion is associated with several required qualities of software including
robustness, reliability, and understandability.
 Low cohesion is associated with unwanted qualities such as being difficult to maintain,
test, reuse, or even understand.

Page 11 of 11

You might also like