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

Reviewer

Structured programming divides programs into smaller subprograms or functions and executes them sequentially, while object-oriented programming divides programs into objects that contain both data and functions. Object-oriented programming provides more flexibility and abstraction and is less difficult to modify and reuse code than structured programming.

Uploaded by

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

Reviewer

Structured programming divides programs into smaller subprograms or functions and executes them sequentially, while object-oriented programming divides programs into objects that contain both data and functions. Object-oriented programming provides more flexibility and abstraction and is less difficult to modify and reuse code than structured programming.

Uploaded by

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

Difference between Structured Programming and Object-Oriented Programming

Structured Programming
• Programs are divided into small programs or functions
• facilitating the creation of programs with readable code and reusable components
• improve and increase computer programs' quality, clarity, and development time
• focuses on functions and processes that usually work on data
• method of organizing, managing, and coding programs that can give or provide much
easier modification and understanding
• methods are written globally and code lines are processed one by one i.e., Run
sequentially
• follows the “Top-Down Approach”
• Breaking up the big program into smaller programs
• less flexibility and abstraction
• more difficult to modify structured programs and reuse code
• give more importance to code
Object-Oriented Programming
• Programs are divided into objects or entities
• creating objects that usually contain both functions and data
• aim is to improve and increase the quality and productivity of system analysis and design
• focuses on representing both structure and behavior of the information system into tiny
modules that generally combine data and process
• method in which a set of objects can vary dynamically and can execute by acting and
reading to each other
• method works dynamically, making calls as per the need of code for a certain time
• generally follows the “Bottom-Up Approach”
• Create small problems first, then solve the smaller problems
• Then integrate all the small programs into a whole and complete solution.
• provides more flexibility and abstraction
• less difficult to modify and reuse code
• more importance to data

Difference between Compiled and Interpreted Language


Introduction to Programming Language
• Computers can only understand and run binary code
• Programmers use high–level programming languages

Compiler
• take a whole program as input and translate it to an executable binary code in several
steps
• run the binary code only on the machine we compiled because the binary code depends
on the hardware and is not portable
• The compilation step is required only once. Afterward, we can run the binary code as
many times as we want

Interpreter
• run a program line by line and execute each command
• slower than compiled languages
• Examples of interpreted languages are PHP, Ruby, Python, and JavaScript
• tend to be more flexible, and often offer features like dynamic typing and smaller
program sizes

Compiled Language vs. Interpreted Language


Compiled Language
• Translate the entirety of the source code to machine code before execution
• Tend to have faster execution speeds
• Require additional time before testing to complete the entire compilation step
• Generate binary code that is platform-dependent
• prevented from finishing when compilation errors occur
Interpreted Language
• Translate each command in source code to machine code, and then execute it before
moving on to the next command
• Tend to have slower execution speeds because they translate the source code at run time
• Are often more flexible, with features like dynamic typing and smaller program size
• Generate binary code that is platform-independent because interpreters execute the
program source code themselves
• Debug the source code at run time

Programming Language vs Scripting Language


Programming Language
• is a type of computer language that consists of a set of instructions for communicating
with computers
• Most programming languages are compiled. The translation overhead is incurred once
when the source is compiled; after that, it needs to be loaded and run
• Traditional programming languages are based on low-level languages
• Execution of a program takes more time since they are compiled.
• used to create a new program or piece of software from the scratch
• are stronger in data and control abstraction
• runs or executes independently
• Requires many lines of code to accomplish a particular task
• have high maintenance costs
• generate .exe files
• designed to make full-fledged software development easier
• code takes a long time to develop since more code must be written (in most cases)
• self-executable
• All programming languages are not scripting languages
• Examples include C, C++, Java, etc.
Scripting Language
• is a kind of programming language that is used to automate the execution of operations
in a runtime environment
• Most scripting languages are interpreted languages. They must be parsed, interpreted,
and executed each time the program is run
• generally prefer high-level languages
• Execution of a script takes less time as scripts are generally short
• use to enhance an existing program or automate a specific task
• is used to control the behavior of a program
• generally emphasize the extensibility and richness of expressions
• runs inside a parent program
• Requires fewer lines to accomplish a task
• typically have a low maintenance cost
• do not create .exe files
• used to assist programming languages and make coding easier and faster
• They are typically used for open projects and web development
• take less time to code, as fewer lines (in most cases) of code are to be written
• require a host
• All scripting languages are programming languages
• Examples include Perl, JavaScript, VBScript, etc.

Component Object Model –COM


• Microsoft's component program architecture, COM (Component Object Model), was
mainly designed for Windows
• It is the basis upon which OLEand ActiveXare built, and it allows code to be reused
without being recompiled
• A component is a platform-specific binary file that the conforming apps and other
components can use
• Instead of having access to a component's underlying data structure, programmes that use
its services include pointers to its standardized interface
• As a result, components can communicate with one another regardless of how they work
or what language they're written in
Distributed Component Object Model -DCOM
• A programming technique
• Allows a computer to run programs on a remote computer as if they were running locally
• Enables COM objects to communicate over the network.
Few issues with COM –addressed by DCOM
• Marshalling solves the problem of delivering data from one COM object instance to
another on a different machine; in programming words, this is referred to as "passing
arguments."
• Distributed Garbage Collection
• Designed to scale DCOM to handle high-volume internet traffic,
• Distributed Garbage Collection also includes a mechanism for deleting and reclaiming
completed or abandoned DCOM objects, preventing web server memory from being
blown up
• DCE/RPC is used as the underlying RPC mechanism
• Microsoft built DCE/RPC as the underlying technology for DCOM –where the D in
DCOM comes from –to achieve the goals mentioned earlier attempt to scale to support a
significant volume of web traffic

Difference between COM and DCOM

Remote Method Invocation -RMI


• A mechanism that allows an object residing in one system to access/invoke an object
running on another JVM
• an API that provides a mechanism to create distributed application in java
• RMI is used to build distributed applications; It provides remote communication between
Java programs
• The RMI provides remote communication between the applications using two objects
stub and skeleton.
JAVA RMI Stubs
• The stub is an object:
• Acts as a gateway for the client side
• All the outgoing requests are routed through it
• It represent the remote object
• When the caller invokes method on the stub object, it does that following tasks:
• 1.It initiates a connection with remote Virtual Machine (JVM),
• 2.It writes and transmits (marshals) the parameters to the remote Virtual Machine (JVM),
• 3.It waits for the result
• 4.It reads (unmarshals) the return value or exception, and;
• 5.It finally, returns the value to the caller
JAVA RMI Skeleton
• When the skeleton receives the incoming request, it does the following task:
• The skeleton is an object:
• Acts as a gateway for the server-side object
• All incoming requests are routed through it
• Reads the parameters for the remote method
• Invokes the method on the actual remote object, and
• Writes and transmits (marshals) the result to the caller.
Understanding requirements for the distributed applications
• If any application performs these tasks, it can be distributed application.
• 1. The application needs to locate the remote method
• 2.It need to provide the communication with remote objects, and
• 3.The application need to load the class definitions for the objects. The RMI application
have all these features, so it is called the distributed application

Introduction PHP
PHP
• acronym for "PHP: Hypertext Preprocessor"
• widely-used, open source scripting language
• PHP scripts are executed on the server
• Free to download and use
• It is powerful enough to be at the core of the biggest blogging system on the web
(WordPress)!
• It is deep enough to run large social networks!
• It is also easy enough to be a beginner's first server side language!

PHP File
• contain text, HTML, CSS, JavaScript, and PHP code
• PHP code is executed on the server, and the result is returned to the browser as plain
HTML
• PHP files have extension ".php"

PHP can do
• Generate dynamic page content
• Create, open, read, write, delete, and close files on the server
• Collect form data
• Send and receive cookies
• Add, delete, modify data in your database
• Used to control user-access
• Encrypt data

Why PHP
• PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
• PHP is compatible with almost all servers used today (Apache, IIS, etc.)
• PHP supports a wide range of databases
• PHP is free. Download it from the official PHP resource: www.php.net
• PHP is easy to learn and runs efficiently on the server side

PHP Syntax

• A PHP script can be placed anywhere in the document.


• A PHP script starts with <?php and ends with ?>
• A PHP file normally contains HTML tags, and some PHP scripting code.

PHP Variables
• starts with the $ sign, followed by the name of the variable
• can be short or descriptive
• cannot start with a number
• an only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
• case sensitive

PHP Conditional Statements

• Conditional Statements: IF, If Else,If Else if Else and switch //4 conditions
a. If- executes one code if condition is true
b. If else- executes some code if a condition is true and another code if that condition is
false
c. If Else if Else - executes different codes for more than two conditions
d. switch- select one of many blocks of code to be executed and is used to perform different
actions based on diff. conditions
• Used to perform different actions based on different conditions

PHP LOOP
• They allow you to run through the same block of code under different circumstances.
• Php has several loops: For Loop, Foreach Loop, While Loop, Do While Loop
• For Loop- goes through a block of code a specified number of times
• Foreach- runs through each element in an array
• While Loop- Loops through a block of code as long as a specified condition is true.
• Do While loop - runs a code snippet once, then repeats the loop as long as the given
condition is true.

PHP Operators
• allow you to perform operations with values, arrays, and variables. There are several
different types:

1. Arithmetic Operators- standard mathematical operators.


• + — Addition
• - — Subtraction
• * — Multiplication
• / — Division
• % — Modulo (the remainder of value divided by another)
• ** — Exponentiation

2. Comparison Operators-
• == — Equal
• === — Identical
• != — Not equal
• <> — Not equal
• !== — Not identical
• < — Less than
• > — Greater than
• <= — Less than or equal to
• >= — Greater than or equal to
• <=> — Less than, equal to, or greater than

3. Logical Operators
• and — And
• or — Or
• xor — Exclusive or
• ! — Not
• && — And
• || — Or

4. Assignment Operators- Besides the standard assignment operator (=), you also have the
following options:
• += — a += b is the same as a = a + b
• -= — a -= b is the same as a = a – b
• *= — a *= b is the same as a = a * b
• /= — a /= b is the same as a = a / b
• %= — a %= b is the same as a = a % b

PHP Object

• Classes and objects are the two main aspects of object-oriented programming.
• A class is a template for objects, and an object is an instance of a class.
• When the individual objects are created, they inherit all the properties and behaviors from
the class, but each object will have different values for the properties.

PHP Function
• block of statements that can be used repeatedly in a program.
• executed by a call to the function.
• start with a letter or an underscore
• Function names are NOT case-sensitive
• Writing PHP Functions
Function NameOfTheFunction() {
//place PHP code here
}

PHP Function Arguments

• Information can be passed to functions through arguments


• An argument is just like a variable
• Arguments are specified after the function name, inside the parentheses.
• You can add as many arguments as you want, just separate them with a comma.

PHP Types of Data

• Integers are non-decimals numbers. At least one digit and no decimal point. Either
positive or negative.
• Floats - decimal point or in exponential form.
• var_dump() returns data type or value.
• Strings - holds texts or sequence of characters. Can used one or double quote
• Boolean - meaning true or false statements
• Array - stores multiple values
• NULL - no value
• Resources- These are references to functions and resources outside of PHP.

PHP Arrays
• Data structure that stores one or more similar type of values in a single value
• Advantage: Less code, Easy to traverse, and sorting
3 Types of Array
1. Indexed- with numeric index
2. Associative- named keys
3. Multidimensional - containing one or more arrays

• Disadvantages of Multidimensional: 3 levels deep are hard to manager for most


• The dimension of an array indicates the number of indices you need to select an element.
• For a two-dimensional array you need two indices to select an element
• For a three-dimensional array you need three indices to select an element

You might also like