0% found this document useful (0 votes)
37 views

Exam 120

Structured programming involves dividing programs into smaller subprograms or functions. It focuses on functions and processes that work on data. Object-oriented programming involves dividing programs into objects that contain both data and functions. It aims to improve quality, productivity, and flexibility compared to structured programming. RMI allows objects in one Java program to invoke methods on objects in another Java program, enabling the creation of distributed applications in Java.

Uploaded by

Milracles
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Exam 120

Structured programming involves dividing programs into smaller subprograms or functions. It focuses on functions and processes that work on data. Object-oriented programming involves dividing programs into objects that contain both data and functions. It aims to improve quality, productivity, and flexibility compared to structured programming. RMI allows objects in one Java program to invoke methods on objects in another Java program, enabling the creation of distributed applications in Java.

Uploaded by

Milracles
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Structured Programming (capable of change) , making calls as

per need of code for a certain time.


● Divided into small programs or ● It generally follows the “Bottom-Up
functions. Approach”.
● Facilitating creation of programs with ● Create small problems first, then solve
readable code and reusable the smaller problems.
components. ● Then integrate all the small programs
● Its main aim is to Improve and into a whole and complete solution.
Increase the Quality, Clarity, and ● It provides more flexibility and
Development time of computer abstraction as compared to structured
programs. programming.
● It simply focuses on functions and ● It is less difficult to modify object-
processes that usually work on data. oriented programs and reuse code as
● It is a method of organizing, managing compared to structured programs.
and coding programs that can give or ● It gives more importance to data.
provide much easier modification and
understanding. Conclusion structure programing is to structure the
● Methods are written globally and code program into a hierarchy of sub-programs while OOP
lines are run sequentially. break down task into objects which encapsulated
● It generally follows the “Top-Down data and methods
Approach”.
Introduction to Programming Language
● Breaking up the big program into
smaller programs. ● Computer only understands and run
● It provides less flexibility and binary code
abstraction as compared to object- ● Programmers use high level
oriented programming. programming languages
● It is more difficult to modify
structured programs and reuse code as Compiler
compared to object-oriented programs.
● It gives more importance to code. ● Takes whole program as input and
translate into executable binary
Object Oriented Programming ● Speed: Faster compared to interpreter
● Can run the binary code on machine
● Programs divided into objects or we compiled it
entities ● Binary depends on hardware and not
● All about creating objects that contain portable
function and data. ● Requires only once and runs binary
● Its main aim is to improve and code many times afterwards.
increase both quality and productivity
of system analysis and design. Interpreter
● It simply focuses on representing both
structure and behavior of the ● Run a program line by line and execute each
information system into tiny or small command
modules that generally combine data ● Speed: Slow
and process both. ● Examples of interpreted languages are PHP,
● It is a method in which a set of objects Ruby, Python, and JavaScript
can vary dynamically and can execute ● tend to be more flexible, and often offer
just by acting and reading to each features like dynamic typing and smaller
other. program sizes
● In this, the method works dynamically
● Examples: Perl, JavaScript, VBScript, etc

Programming Language vs. Scripting Language Component Object Model –COM

Programming Language:
⦁ Microsoft's component program
● Consists of a set of instructions for architecture, COM (Component Object Model),
communicating with computers was mainly designed for Windows
● Conversion: Compiler base ⦁ It is the basis upon which OLEand
● The translation overhead is incurred just once
ActiveXare built, and it allows code to be reused
when the source is compiled; after that, it
without being recompiled
merely needs to be loaded and run.
⦁ A component is a platform-specific binary
● takes more time since they are compiled.
file that the conforming apps and other components
● Traditional programming languages are based
can usef
on low-level languages.
⦁ Instea,d of having access to a component's
● create a new program or piece of software
from scratch. underlying data structure, programmes that use its
● stronger in data and control abstraction. services include pointers to its standardized interface
● runs or executes independently ⦁ As a result, components can communicate
● Requires many lines of code to accomplish a with one another regardless of how they work or
particular task. what language they're written in
● Have high maintenance costs.
● generate .exe files. Distributed Component Object Model -DCOM
● designed to make full-fledged
● Takes a long time to developed since more ⦁ A programming technique
code must be written ⦁ Allows a computer to run programs on a
● All programming languages are not scripting
remote computer as if they were running locally
languages.
⦁ Enables COM objects to communicate over
● Examples include C, C++, Java, etc.
the network.
● Self-executable

Scripting Language Difference is COM is a set of component tools which


are executed client side. DCOM is a Distributed
● used to automate the execution of operations component object model run at the given server.
in a runtime environment
● must be parsed, interpreted, and executed Few issues with COM –addressed by DCOM
each time the program is run.
● Prefer high-level languages ● Marshaling solves the problem of delivering
● Takes less time as scripts are generally short. data from one COM object instance to
● generally emphasize the extensibility and another on a different machine; in
richness of expressions. programming words, this is referred to as
● runs inside a parent program. "passing arguments."
● Requires fewer lines ● Distributed Garbage Collection
● Have low maintenance cost ● Designed to scale DCOM to handle high-
● Do not create exe. files volume internet traffic
● It is used to enhance an existing program or ● Distributed Garbage Collection also includes
automate a specific task. A scripting language a mechanism for deleting and reclaiming
is used to control the behavior of a program. completed or abandoned DCOM objects,
● Requires host preventing web server memory from being
● All scripting languages are programming blown up
languages
● DCE/RPC is used as the underlying RPC the caller.
mechanism ● Understanding requirements for the
● Microsoft built DCE/RPC as the underlying distributed applications
technology for DCOM –where the D in ● If any application performs these tasks, it can
DCOM comes from –to achieve the goals be distributed.
mentioned earlier attempt to scale to support a 1. The application needs to locate the remote
significant volume of web traffic method
2. It need to provide the communication with
Remote Method Invocation -RMI remote objects, and
3. The application needs to load the class
● A mechanism that allows an object residing in definitions for the objects. The RMI
one system to access/invoke an object running application have all these features, so it is
on another JVM called the distributed application
● An API that provides a mechanism to create
distributed application in java Difference between them is that stubs belong to the
● RMI is used to build distributed applications; client side while the skeleton belongs to the server
● It provides remote communication between side.
Java programs
● Use stub and skeleton for communicating Interpreted Language
between the objects.
● More flexible
JAVA RMI Stubs ● Features: dynamic typing and smaller
programing size
● The stub is an object: ● Platform independent because execute
● Acts as a gateway for the client side source code themselves
● Outgoing requests are routed through it ● Debug source code at run time
● It represent the remote object
● When the stubs invokes it does that following Compiled Language
tasks:
● Translate source code before
1. It initiates a connection with remote
execution
Virtual Machine (JVM),
● Faster execution speeds
2. It writes and transmits (marshalls) the
● Require additional time to complete
parameters to the remote Virtual
the entire compilation step
Machine (JVM),
● Platform dependent
3. It waits for the result
● Prevents finishing when error occurs
4. It reads (unmarshals) the return value
or exception, and;
5. It finally, returns the value to the
caller The difference between compiled and interpreted
languages is to do with how it is executed by the
JAVA RMI Skeleton computer. Compiled languages are translated into a
computer-readable language, and interpreted
● When the skeleton receives the incoming
languages are not translated but are read and
request, it does the following task
executed by an interpreter line by line.
● The skeleton is an object:
● Acts as a gateway for the server-side object PHP Arrays
● All incoming requests are routed through it
● Reads the parameters for the remote method ● Data structure that stores one or more
● Invokes the method on the actual remote similar type of values in a single value
object, and ● Advantage: Less code, Easy to
● Writes and transmits (marshalls) the result to
traverse, and sorting
⦁ Generate dynamic page content
3 Types of Array
⦁ Create, open, read, write, delete, and close
● Indexed- with numeric index files on the server
● Associative- with named keys ⦁ Collect form data
● Multidimensional - containing one or ⦁ Send and receive cookies
more arrays
⦁ Add, delete, modify data in your database
Disadvantages of Multidimensional: 3 levels deep are ⦁ Used to control user-access
hard to manager for most ⦁ Encrypt data

The dimension of an array indicates the number of Why PHP


indices you need to select an element.
⦁ PHP runs on various platforms (Windows,
○ For a two-dimensional array you need
Linux, Unix, Mac OS X, etc.)
two indices to select an element
○ For a three-dimensional array you ⦁ PHP is compatible with almost all servers
need three indices to select an element 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
Introduction PHP ⦁ PHP is easy to learn and runs efficiently on
PHP the server side

⦁ acronym for "PHP: Hypertext Preprocessor" PHP Syntax


⦁ widely-used, open source scripting
language ⦁ A PHP script can be placed anywhere in
⦁ PHP scripts are executed on the server the document.
⦁ Free to download and use ⦁ A PHP script starts with <?php and ends
⦁ It is powerful enough to be at the core of with ?>
the biggest blogging system on the web ⦁ A PHP file normally contains HTML tags,
(WordPress)! and some PHP scripting code.
⦁ It is deep enough to run large social
PHP Variables
networks!
⦁ starts with the $ sign, followed by the name
⦁ It is also easy enough to be a beginner's first
of the variable
server side language!
⦁ can be short or descriptive
⦁ cannot start with a number
PHP File
⦁ an only contain alpha-numeric characters
⦁ contain text, HTML, CSS, JavaScript, and and underscores (A-z, 0-9, and _ )
PHP code ⦁ case sensitive
⦁ PHP code is executed on the server, and the
result is returned to the browser as plain HTML PHP Conditional Statements
⦁ PHP files have extension ".php"
⦁ Conditional Statements: IF, If Else,If Else if
Else and switch //4 conditions
PHP can do
a. If- executes one code if condition is true ⦁ Php has several loops: For Loop, Foreach
b. If else- executes some code if a condition is Loop, While Loop, Do While Loop
true and another code if that condition is false
c. If Else if Else - executes different codes for ⦁ For Loop- goes through a block of code a
more than two conditions
specified number of times
d. switch- select one of many blocks of code to
be executed and is used to perform different actions
⦁ Foreach- runs through each element in an
based on diff. conditions
⦁ Used to perform different actions based on array
different conditions
⦁ While Loop- Loops through a block of
PHP Object code as long as a specified condition is true.

● Classes and objects are the two main aspects ⦁ Do While loop - runs a code snippet once,
of object-oriented programming. then repeats the loop as long as the given
● A class is a template for objects, and an object condition is true.
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 PHP Operators
values for the properties.
⦁ allow you to perform operations with
PHP Function values, arrays, and variables. There are several
● block of statements that can be used different types:
repeatedly in a program.
● executed by a call to the function.
● start with a letter or an underscore
1. Arithmetic Operators- standard mathematical
● Function names are NOT case-sensitive
operators.
● Writing PHP Functions

Function NameOfTheFunction() { ⦁ + — Addition

//place PHP code here ⦁ - — Subtraction

} ⦁ * — Multiplication
PHP Function Arguments
⦁ / — Division
● Information can be passed to functions
through arguments ⦁ % — Modulo (the remainder of value
● An argument is just like a variable divided by another)
● Arguments are specified after the function
name, inside the parentheses. ⦁ ** — Exponentiation
● You can add as many arguments as you want,
just separate them with a comma. 2. Comparison Operators-

PHP LOOP
⦁ == — Equal

⦁ They allow you to run through the same


⦁ === — Identical
block of code under different circumstances.
⦁ != — Not equal ● Floats - decimal point or in exponential form.
● var_dump() returns data type or value.
⦁ <> — Not equal ● Strings - holds texts or sequence of
characters. Can used one or double quote
⦁ !== — Not identical ● Boolean - meaning true or false statements
● Array - stores multiple values
⦁ < — Less than ● NULL - no value
● Resources- These are references to functions
⦁ > — Greater than and resources outside of PHP.

⦁ <= — Less than or equal to

⦁ >= — Greater than or equal to

⦁ <=> — Less than, equal to, or greater than

4. Logical Operators

⦁ and — And

⦁ or — Or

⦁ xor — Exclusive or

⦁ ! — Not

⦁ && — And

⦁ || — Or

3. 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 Types of Data

● Integers are non-decimals numbers. At least


one digit and no decimal point. Either positive
or negative.

You might also like