lect01-week1-Definitions
lect01-week1-Definitions
(CC272)
Click to add text
Click to add text
10:36 2
• Course Assessment:
• Assignments 40%
• Mid-term examination 10%
• Final examination 50%
10:36 3
• Course breakdown
Object-oriented design
UML
Design patterns
10:36 4
• Academic Honesty Statement
Academic dishonesty is NOT tolerated in this
course.
Cheating and plagiarism can result in ZERO in
CW and/or exam
10:36 5
Introduction
Programming Paradigms
10:36 6
Programming Paradigms
A programming paradigm is a way in which a computer
language looks at the problem to be solved.
• Imperative: Programming with an explicit sequence of
commands that update state.
• Declarative: Programming by specifying the result you
want, not how to get it.
• Structured: Programming with clean, goto-free, nested
control structures.
• Procedural: Imperative programming with procedure
calls.
• Object-Oriented: Programming by defining objects that send
messages to each other.
Behrouz Forouzan and Firouz Mosharraf
10:36 https://cs.lmu.edu/~ray/notes/paradigms/ 7
Programming Paradigms
• Functional : Programming with function calls that
avoid any global state.
• Logic (Rule-based): Programming by specifying a set
of facts and rules. An engine infers the answers to
questions.
• Constraint: Programming by specifying a set of
constraints. An engine finds the values that meet the
constraints.
• Aspect-Oriented: Programming cross-cutting
concerns applied transparently.
10:36 https://cs.lmu.edu/~ray/notes/paradigms/ 8
Procedural Programming
For example, we can define a primitive function called first that extracts the first
element of a list. It may also have a function called rest that extracts all the elements
except the first. A program can define a function that extracts the third element of a
list by combining these two functions
In Prolog: meaning
John is a human
A human is mortal
The user can then ask:
Is John mortal ?
D
1 2 1 2 1
√
A = D, B ≠ D, A+C < 4
Roman Barták Charles University, Prague
[email protected]
Aspect-Oriented Programming
https://www.albinsblog.com/2020/11/aspect-oriented-progra
10:36 mming-aop-with-aem.html#.YF2FaNJKhdg 14
Aspect-Oriented Programming
https://www.slideshare.net/anumod4u/aspect-oriented-pro
10:36 gramming-presentation 15
JAVA Programming Language
C++ 1979
JAVA 1991
http://java.sun.com/
C# 2000
Mobile Application
Network Application
Disadvantages of JAVA
Slower
memory-consuming
Single-pattern language (Every thing is an object)
statically typed language
10:36
Easy to decompile (need java
Based on obfuscator)
Lecture slides prepared by Dr.
19
Walid Aly
Java Basic Information
▪ Source code is first written in plain text files ending with the .java extension.
▪ JAVA source files are compiled into .class files by the java compiler.
▪ The .class file contains bytecodes which is the machine language of the Java Virtual
Machine(Java VM).
▪ The JVM runs your application by running the .class file.
Through the Java VM, the same application is capable of running on multiple platforms.
MyProgram.java MyProgram.class
class MyProgram …………
………
{ ……….
……..
}
HelloWorld.java
Modifiers: The modifier, which is optional, tells the compiler how to call the method.
This defines the access type of the method.
class A class B
{ {
public static void m1() public static void main (String [ ] arg )
{ {
System.out.println(“Hello 2”); System.out.println(“Hello 1”);
} A.m1();
public static void main (String [ ] arg ) System.out.println(“Hello 3”);
{ }
System.out.println(“Hello 1”); }
m1();
System.out.println(“Hello 3”);
}
}
class Math
{
public static final double PI=3.14;
Without import
......................
javax.swing.JApplet x=………………………………..
With import
import javax.swing.JApplet;
......................
JApplet x=…………………………….
Package :java.lang
Class Integer
Package :javax.swing
Class JOptionPane
Package :java.util
Class Random
Based on Lecture slides prepared by Dr.
10:36 AM 39
Walid Aly
class java.lang.Math
Method Summary import java.lang.Math;
public static double abs(double a) public class Test
public static int round(float a) {
public static double ceil(double a) public static void main (String [] arg)
public static double cos(double a) {
public static double floor(double a) int a=Math.abs(-4);
System.out.println("a="+a);
public static double max(double a, double b)
public static double min(double a, double b)
int b=Math.round(4.6f);
public static double pow(double a, double b)
int c=Math.max(4,7);
double d=Math.random();
public static double random() }
public static double sin(double a) }
public static double sqrt(double a)
import javax.swing.JOptionPane;
public class WelcomeInMessageDialogBox {
public static void main(String[] args) {
String name=JOptionPane.showInputDialog(null, "Plz enter your name “);
JOptionPane.showMessageDialog(null, "Welcome "+ name +" to Java!“);
}
}
WelcomeInMessageDialogBox.java
Run
Package :java.lang
Class Integer
static int parseInt(String s)
Parses the string argument as a signed decimal integer.
///////////
String s1=“14”;
int i=Integer.parseInt(s1);
}
}
}
}
http://thenewboston.org/tutorials.php