SlideShare a Scribd company logo
Advanced Programming Techniques
Topic 1: Introduction
Readings: Chapter 1
Outline
 C, C++, and Java
How Java is related to C and C++
 Advantages of Java
Writing good codes in Java is easier than in C or C++
 Java libraries (packages)
Where the power of Java come from
 Java and the internet
What Java is good for
 Course content
C, C++, and Java
• C designed in 1970’s for operating system programming, i.e. UNIX
– High-level language compared with assembly language
– Low-level compared with C++ or java
• Low level = Easy manipulation of hardware
• High level = Relying one lower level software to implement task with minimum amount
of code.
– Strengths
• Not restrictive, especially in relation to type conversion.
• More efficient than C++ and Java.
– Weaknesses:
• Not object-oriented: does not support abstraction and encapsulation
– Difficult to manage in large projects.
• Little built-in functionalities. Programmer need to start from scratch.
• Easy to make mistakes. (pointers, a=b vs a==b)
C, C++, and Java
 C++ designed in 1980’s, complete superset of C
 Changes
 Support for Object-Oriented programming
 …
 Strengths
 Improved data abstraction and encapsulation
 Makes it easier to manage large projects
 More extensive built-ins (standard libraries)
 Weakness
 Considered by many to be over-complicated
 Contains all of C’s problems
C, C++ and Java
 Java: a language of 1990’s
 The design of Java starts with C syntax and semantics
 Adds a few features from C++: Objects, exceptions
 Leaves out parts unneeded, unsafe, complex (not backward compatible)
Gosling: “Java omits many rarely used, poorly understood, confusing features
of C++ that in our experience bring more grief than benefits.”
 Adds a few facilities not present in C or C++
Garbage collection, concurrency, runtime error checking, object serialization,
interface, inner classes, threads
 Strengthens portability and security
C, C++ and Java
Outline
 C, C++, and Java
How Java is related to C and C++
 Advantages of Java
Writing good codes in Java is easier than in C or C++
 Java libraries (packages)
Where the power of Java come from
 Java and the internet
What Java is good for
 Course content
Advantages of Java
 According to Sun’s Java White paper:
“Java is a simple, objected-oriented, distributed,
interpreted, robust, secure, architecture-neutral,
portable, high-performance, multi-threaded, and
dynamic language”.
 Most of the claims are justified, while others
are controversial.
• Streamlined C language:
– No typedef, union, enum, goto, comma operator
– No header files
• C: list.h, list.c
• Java: List.java
– No makefile
• Java compiler can figure out dependencies among
classes
Advantages of Java/Simple
• Fixed problematic areas:
– No pointers, no function pointers
– Add garbage collection. Memory leaks no more
– No code like this
– “if (a=b)” does not compile
if ( *Head == NULL ){
*Head=(NODESET *) memAllocate(sizeof(NODESET));
*(Head+5) = tmpNode;
(*Head)->next=(*Head)->prev=NULL;
}
memDeallocate( Head );
Advantages of Java/Simple
• Everything is class except several primitive types
– Array is a class. Cannot go over bound.
• No this
– int a[5]; a[5]=0;
• However, Java libraries are quite complicated
Advantages of Java/Simple
Advantages of Java/Object-Oriented
 More so than C++.
 Combine data and behavior into one unit, the object
 Programs are collections of interacting, cooperating objects
 Advantages of OOP
 Provide strong data abstraction and encapsulation
 Gives framework for design
 Allows independent development and testing
 Facilitates system extensions and maintenance
 More opportunity for code re-use
Advantages of Java/Platform-Independent
• C and C++ programs are compiled into object code,
– Object code is directly processed by hardware processor.
– Require a separate compiler for each computer platform, i.e. for each
computer operating system and the hardware set of instructions that it is
built on.
• Java programs are compiled into bytecode
– Bytecode is processed by a program called java virtual machine (JVM),
rather than by the "real" computer machine, the hardware processor.
– Platform differences dealt with by JVM
– Consequently, Java programs can run on any platform.
“Write once, run anywhere”.
Java Virtual Machine
Java
Virtual
Machine
Java
Compiler
Java
Libraries
HotSpot Compiler
Class loader
bytecode to
verifier
Runtime System
Operating System
Hardware
Java
Source
Bytecodes
move locally
or through net
Java
bytecode
(class)
Compile time
environment
Runtime environment
(Java Platform)
Advantages of Java/Robust and Secure
 Fewer language loopholes
No pointers, typecasts limited. (Easier to produce error free source code)
 Compilers are strict
Require initialization of variables, enforces type consistency, requires
prototypes (Less chance of error in compiled code code)
 Runtime error checking
Array bounds, null reference access (Less chance of runtime error)
 Security manager
System to control permissions for high-level actions
 Runtime verifier checks untrusted bytecode
Avoids havoc from hand-constructed bytecode
• In Summary, writing good codes in Java is
easier than in C or C++
• javadoc generates documentation
automatically
– Very useful
– Example: HLCM
• Now, I write all my programs in java
Advantages of Java
Outline
 C, C++, and Java
How Java is related to C and C++
 Advantages of Java
Writing good codes in Java is easier than in C or C++
 Java libraries (packages)
Where the power of Java come from
 Java and the internet
What Java is good for
 Course content
Java Libraries
 Java has far expanded traditional scope of a
language’s libraries
 Java 2 SDK 1.4:
 3,020 classes and interfaces
 32,138 methods
 Much less effort required to accomplish common tasks
 Platform-specific details are handled
 All programs improved when common core updated
Java Libraries
 Collection of classes grouped into packages
Java equivalent of C libraries
 java.lang
String, Math, Exception, Thread, Runtime, etc
 java.util
Vector, Stack, hashtable, Date, Tokenizer
 java.io
Varieties of input/output processing
 java.net
Networking, client/server sockets, URLs
 java.awt, javax.swing
Windows, buttons, drawing, images, events
Java Libraries
 java.security
Encryption, digital signature, message digest
 java.text
Formatting and parsing
 java.sql
Database connectivity
 java.rmi
Remote method invocation, distributed objects
 The list goes on…
And it is continuing to expand. Java is still young
Outline
 C, C++, and Java
How Java is related to C and C++
 Advantages of Java
Writing good codes in Java is easier than in C or C++
 Java libraries (packages)
Where the power of Java come from
 Java and the internet
What Java is good for
 Course content
Java and the Internet
 Java is intended to be used in networked/distributed
environments.
 Increasingly used for “middleware” to communicate between
clients and serves, acting as a universal glue that connect user with
information from various sources. Example: JMOL
 Made possible by portability and multithreading and networking capabilities.
Applet
Swing (GUI)
Servlet
DB
Java Networking
Remote Method Invocation
Client Browser ServerApplet
User
JDBC
Course Contents
• Language Basics:
– Classes, objects, inheritance, interface, inner classes, exception, I/O
• Components in the following diagram
• Other issues
– Multithreading, security
Applet
Swing (GUI)
Servlet
DB
Java Networking
Remote Method Invocation
Client Browser ServerApplet
JDBC
User

More Related Content

What's hot

Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutions
Quontra Solutions
 
Presentación rs232 java
Presentación rs232 javaPresentación rs232 java
Presentación rs232 javaJohn Rojas
 
Java vs .net
Java vs .netJava vs .net
Java vs .netTech_MX
 
21. Java High Quality Programming Code
21. Java High Quality Programming Code21. Java High Quality Programming Code
21. Java High Quality Programming Code
Intro C# Book
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
yazad dumasia
 
Nakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - EnglishNakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - EnglishSvetlin Nakov
 
Java vs .net (beginners)
Java vs .net (beginners)Java vs .net (beginners)
Java vs .net (beginners)
Ravi Vishwakarma
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
citizenmatt
 
Java Programming
Java ProgrammingJava Programming
Java Programming
Prof. Dr. K. Adisesha
 
DOT Net overview
DOT Net overviewDOT Net overview
DOT Net overview
chandrasekhardesireddi
 
.NET Framework 4.0 – Changes & Benefits
.NET Framework 4.0 – Changes & Benefits .NET Framework 4.0 – Changes & Benefits
.NET Framework 4.0 – Changes & Benefits
Deepika Chaudhary
 
Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net frameworkAshish Verma
 
Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
Harsha Batra
 
JAVA INTRODUCTION - 1
JAVA INTRODUCTION - 1JAVA INTRODUCTION - 1
JAVA INTRODUCTION - 1
Infoviaan Technologies
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet IntroductionWei Sun
 
What is-java
What is-javaWhat is-java
What is-java
Shahid Rasheed
 
.Net overview|Introduction Of .net
.Net overview|Introduction Of .net.Net overview|Introduction Of .net
.Net overview|Introduction Of .net
pinky singh
 
Net Fundamentals
Net FundamentalsNet Fundamentals
Net FundamentalsAli Taki
 
Java vs .Net
Java vs .NetJava vs .Net
Java vs .Net
Tejasvi Rastogi
 

What's hot (20)

Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutions
 
Presentación rs232 java
Presentación rs232 javaPresentación rs232 java
Presentación rs232 java
 
Java vs .net
Java vs .netJava vs .net
Java vs .net
 
21. Java High Quality Programming Code
21. Java High Quality Programming Code21. Java High Quality Programming Code
21. Java High Quality Programming Code
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
 
Nakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - EnglishNakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - English
 
Java vs .net (beginners)
Java vs .net (beginners)Java vs .net (beginners)
Java vs .net (beginners)
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
DOT Net overview
DOT Net overviewDOT Net overview
DOT Net overview
 
Net framework
Net frameworkNet framework
Net framework
 
.NET Framework 4.0 – Changes & Benefits
.NET Framework 4.0 – Changes & Benefits .NET Framework 4.0 – Changes & Benefits
.NET Framework 4.0 – Changes & Benefits
 
Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net framework
 
Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
 
JAVA INTRODUCTION - 1
JAVA INTRODUCTION - 1JAVA INTRODUCTION - 1
JAVA INTRODUCTION - 1
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet Introduction
 
What is-java
What is-javaWhat is-java
What is-java
 
.Net overview|Introduction Of .net
.Net overview|Introduction Of .net.Net overview|Introduction Of .net
.Net overview|Introduction Of .net
 
Net Fundamentals
Net FundamentalsNet Fundamentals
Net Fundamentals
 
Java vs .Net
Java vs .NetJava vs .Net
Java vs .Net
 

Viewers also liked

tempat tidur no 4
tempat tidur no 4tempat tidur no 4
tempat tidur no 4
surabaya spring
 
sacp_sales_sse_38599
sacp_sales_sse_38599sacp_sales_sse_38599
sacp_sales_sse_38599Gerald Meyer
 
LAI/CILIP session - Daniel
LAI/CILIP session - DanielLAI/CILIP session - Daniel
LAI/CILIP session - Daniel
LAICDG
 
tempat tidur tingkat besi
tempat tidur tingkat besitempat tidur tingkat besi
tempat tidur tingkat besi
surabaya spring
 
GLRCertificate (1)
GLRCertificate (1)GLRCertificate (1)
GLRCertificate (1)Gerald Meyer
 
tempat tidur susun anak
tempat tidur susun anaktempat tidur susun anak
tempat tidur susun anak
surabaya spring
 
tempat tidur 4 kaki
tempat tidur 4 kakitempat tidur 4 kaki
tempat tidur 4 kaki
surabaya spring
 
Niamh O'Sullvan Punchy Presentations CDG AGM 2015
Niamh O'Sullvan Punchy Presentations CDG AGM 2015 Niamh O'Sullvan Punchy Presentations CDG AGM 2015
Niamh O'Sullvan Punchy Presentations CDG AGM 2015
LAICDG
 
Protect your house from water
Protect your house from waterProtect your house from water
Protect your house from water
Bangalore Property
 

Viewers also liked (13)

tempat tidur no 4
tempat tidur no 4tempat tidur no 4
tempat tidur no 4
 
sacp_sales_sse_38599
sacp_sales_sse_38599sacp_sales_sse_38599
sacp_sales_sse_38599
 
transcript_MNSU_VPimentel
transcript_MNSU_VPimenteltranscript_MNSU_VPimentel
transcript_MNSU_VPimentel
 
Backup Exec 15 VSEPlus
Backup Exec 15 VSEPlusBackup Exec 15 VSEPlus
Backup Exec 15 VSEPlus
 
Divers
DiversDivers
Divers
 
Formato libro
Formato libroFormato libro
Formato libro
 
LAI/CILIP session - Daniel
LAI/CILIP session - DanielLAI/CILIP session - Daniel
LAI/CILIP session - Daniel
 
tempat tidur tingkat besi
tempat tidur tingkat besitempat tidur tingkat besi
tempat tidur tingkat besi
 
GLRCertificate (1)
GLRCertificate (1)GLRCertificate (1)
GLRCertificate (1)
 
tempat tidur susun anak
tempat tidur susun anaktempat tidur susun anak
tempat tidur susun anak
 
tempat tidur 4 kaki
tempat tidur 4 kakitempat tidur 4 kaki
tempat tidur 4 kaki
 
Niamh O'Sullvan Punchy Presentations CDG AGM 2015
Niamh O'Sullvan Punchy Presentations CDG AGM 2015 Niamh O'Sullvan Punchy Presentations CDG AGM 2015
Niamh O'Sullvan Punchy Presentations CDG AGM 2015
 
Protect your house from water
Protect your house from waterProtect your house from water
Protect your house from water
 

Similar to 01intro

Java Basic PART I
Java Basic PART IJava Basic PART I
Java Basic PART I
Soumen Santra
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
PUSHPA KUMAR
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
Md. Tanvir Hossain
 
01 java intro
01 java intro01 java intro
01 java intro
Deepal Shah
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
jyoti_lakhani
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
kamal kotecha
 
Core Java
Core JavaCore Java
Java programing language unit 1 introduction
Java programing language unit 1 introductionJava programing language unit 1 introduction
Java programing language unit 1 introduction
chnrketan
 
2-Lec - History of OOP and Java (1) .ppt
2-Lec - History of OOP and Java  (1) .ppt2-Lec - History of OOP and Java  (1) .ppt
2-Lec - History of OOP and Java (1) .ppt
AqeelAbbas94
 
Introduction to Java Part-2
Introduction to Java Part-2Introduction to Java Part-2
Introduction to Java Part-2
RatnaJava
 
Java basic
Java basicJava basic
Java basic
Arati Gadgil
 
Introduction to Java
Introduction to Java Introduction to Java
Introduction to Java
Hitesh-Java
 
Learn JAVA at ASIT
Learn JAVA at ASITLearn JAVA at ASIT
Learn JAVA at ASIT
ASIT
 
Presentation on java
Presentation on javaPresentation on java
Presentation on java
william john
 
java completed units.docx
java completed units.docxjava completed units.docx
java completed units.docx
SATHYAKALAKSKPRCASBS
 
java full 1 (Recovered).docx
java full 1 (Recovered).docxjava full 1 (Recovered).docx
java full 1 (Recovered).docx
SATHYAKALAKSKPRCASBS
 
FRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONINGFRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONING
Satish Chandra
 

Similar to 01intro (20)

Java Basic PART I
Java Basic PART IJava Basic PART I
Java Basic PART I
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
01 java intro
01 java intro01 java intro
01 java intro
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
Core Java
Core JavaCore Java
Core Java
 
Java programing language unit 1 introduction
Java programing language unit 1 introductionJava programing language unit 1 introduction
Java programing language unit 1 introduction
 
2-Lec - History of OOP and Java (1) .ppt
2-Lec - History of OOP and Java  (1) .ppt2-Lec - History of OOP and Java  (1) .ppt
2-Lec - History of OOP and Java (1) .ppt
 
Introduction to Java Part-2
Introduction to Java Part-2Introduction to Java Part-2
Introduction to Java Part-2
 
Java basic
Java basicJava basic
Java basic
 
Introduction to Java
Introduction to Java Introduction to Java
Introduction to Java
 
Learn JAVA at ASIT
Learn JAVA at ASITLearn JAVA at ASIT
Learn JAVA at ASIT
 
OOPS JAVA.pdf
OOPS JAVA.pdfOOPS JAVA.pdf
OOPS JAVA.pdf
 
Presentation on java
Presentation on javaPresentation on java
Presentation on java
 
java completed units.docx
java completed units.docxjava completed units.docx
java completed units.docx
 
java full 1 (Recovered).docx
java full 1 (Recovered).docxjava full 1 (Recovered).docx
java full 1 (Recovered).docx
 
FRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONINGFRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONING
 
java full 1.docx
java full 1.docxjava full 1.docx
java full 1.docx
 
java full.docx
java full.docxjava full.docx
java full.docx
 

More from Waheed Warraich

java jdbc connection
java jdbc connectionjava jdbc connection
java jdbc connection
Waheed Warraich
 
java networking
 java networking java networking
java networking
Waheed Warraich
 
java threads
java threadsjava threads
java threads
Waheed Warraich
 
java applets
java appletsjava applets
java applets
Waheed Warraich
 
java swing
java swingjava swing
java swing
Waheed Warraich
 
09events
09events09events
09events
Waheed Warraich
 
08graphics
08graphics08graphics
08graphics
Waheed Warraich
 
06 exceptions
06 exceptions06 exceptions
06 exceptions
Waheed Warraich
 
05io
05io05io
04inherit
04inherit04inherit
04inherit
Waheed Warraich
 
03class
03class03class
02basics
02basics02basics
02basics
Waheed Warraich
 

More from Waheed Warraich (12)

java jdbc connection
java jdbc connectionjava jdbc connection
java jdbc connection
 
java networking
 java networking java networking
java networking
 
java threads
java threadsjava threads
java threads
 
java applets
java appletsjava applets
java applets
 
java swing
java swingjava swing
java swing
 
09events
09events09events
09events
 
08graphics
08graphics08graphics
08graphics
 
06 exceptions
06 exceptions06 exceptions
06 exceptions
 
05io
05io05io
05io
 
04inherit
04inherit04inherit
04inherit
 
03class
03class03class
03class
 
02basics
02basics02basics
02basics
 

Recently uploaded

Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 

Recently uploaded (20)

Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 

01intro

  • 1. Advanced Programming Techniques Topic 1: Introduction Readings: Chapter 1
  • 2. Outline  C, C++, and Java How Java is related to C and C++  Advantages of Java Writing good codes in Java is easier than in C or C++  Java libraries (packages) Where the power of Java come from  Java and the internet What Java is good for  Course content
  • 3. C, C++, and Java • C designed in 1970’s for operating system programming, i.e. UNIX – High-level language compared with assembly language – Low-level compared with C++ or java • Low level = Easy manipulation of hardware • High level = Relying one lower level software to implement task with minimum amount of code. – Strengths • Not restrictive, especially in relation to type conversion. • More efficient than C++ and Java. – Weaknesses: • Not object-oriented: does not support abstraction and encapsulation – Difficult to manage in large projects. • Little built-in functionalities. Programmer need to start from scratch. • Easy to make mistakes. (pointers, a=b vs a==b)
  • 4. C, C++, and Java  C++ designed in 1980’s, complete superset of C  Changes  Support for Object-Oriented programming  …  Strengths  Improved data abstraction and encapsulation  Makes it easier to manage large projects  More extensive built-ins (standard libraries)  Weakness  Considered by many to be over-complicated  Contains all of C’s problems
  • 5. C, C++ and Java  Java: a language of 1990’s  The design of Java starts with C syntax and semantics  Adds a few features from C++: Objects, exceptions  Leaves out parts unneeded, unsafe, complex (not backward compatible) Gosling: “Java omits many rarely used, poorly understood, confusing features of C++ that in our experience bring more grief than benefits.”  Adds a few facilities not present in C or C++ Garbage collection, concurrency, runtime error checking, object serialization, interface, inner classes, threads  Strengthens portability and security
  • 6. C, C++ and Java
  • 7. Outline  C, C++, and Java How Java is related to C and C++  Advantages of Java Writing good codes in Java is easier than in C or C++  Java libraries (packages) Where the power of Java come from  Java and the internet What Java is good for  Course content
  • 8. Advantages of Java  According to Sun’s Java White paper: “Java is a simple, objected-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, multi-threaded, and dynamic language”.  Most of the claims are justified, while others are controversial.
  • 9. • Streamlined C language: – No typedef, union, enum, goto, comma operator – No header files • C: list.h, list.c • Java: List.java – No makefile • Java compiler can figure out dependencies among classes Advantages of Java/Simple
  • 10. • Fixed problematic areas: – No pointers, no function pointers – Add garbage collection. Memory leaks no more – No code like this – “if (a=b)” does not compile if ( *Head == NULL ){ *Head=(NODESET *) memAllocate(sizeof(NODESET)); *(Head+5) = tmpNode; (*Head)->next=(*Head)->prev=NULL; } memDeallocate( Head ); Advantages of Java/Simple
  • 11. • Everything is class except several primitive types – Array is a class. Cannot go over bound. • No this – int a[5]; a[5]=0; • However, Java libraries are quite complicated Advantages of Java/Simple
  • 12. Advantages of Java/Object-Oriented  More so than C++.  Combine data and behavior into one unit, the object  Programs are collections of interacting, cooperating objects  Advantages of OOP  Provide strong data abstraction and encapsulation  Gives framework for design  Allows independent development and testing  Facilitates system extensions and maintenance  More opportunity for code re-use
  • 13. Advantages of Java/Platform-Independent • C and C++ programs are compiled into object code, – Object code is directly processed by hardware processor. – Require a separate compiler for each computer platform, i.e. for each computer operating system and the hardware set of instructions that it is built on. • Java programs are compiled into bytecode – Bytecode is processed by a program called java virtual machine (JVM), rather than by the "real" computer machine, the hardware processor. – Platform differences dealt with by JVM – Consequently, Java programs can run on any platform. “Write once, run anywhere”.
  • 14. Java Virtual Machine Java Virtual Machine Java Compiler Java Libraries HotSpot Compiler Class loader bytecode to verifier Runtime System Operating System Hardware Java Source Bytecodes move locally or through net Java bytecode (class) Compile time environment Runtime environment (Java Platform)
  • 15. Advantages of Java/Robust and Secure  Fewer language loopholes No pointers, typecasts limited. (Easier to produce error free source code)  Compilers are strict Require initialization of variables, enforces type consistency, requires prototypes (Less chance of error in compiled code code)  Runtime error checking Array bounds, null reference access (Less chance of runtime error)  Security manager System to control permissions for high-level actions  Runtime verifier checks untrusted bytecode Avoids havoc from hand-constructed bytecode
  • 16. • In Summary, writing good codes in Java is easier than in C or C++ • javadoc generates documentation automatically – Very useful – Example: HLCM • Now, I write all my programs in java Advantages of Java
  • 17. Outline  C, C++, and Java How Java is related to C and C++  Advantages of Java Writing good codes in Java is easier than in C or C++  Java libraries (packages) Where the power of Java come from  Java and the internet What Java is good for  Course content
  • 18. Java Libraries  Java has far expanded traditional scope of a language’s libraries  Java 2 SDK 1.4:  3,020 classes and interfaces  32,138 methods  Much less effort required to accomplish common tasks  Platform-specific details are handled  All programs improved when common core updated
  • 19. Java Libraries  Collection of classes grouped into packages Java equivalent of C libraries  java.lang String, Math, Exception, Thread, Runtime, etc  java.util Vector, Stack, hashtable, Date, Tokenizer  java.io Varieties of input/output processing  java.net Networking, client/server sockets, URLs  java.awt, javax.swing Windows, buttons, drawing, images, events
  • 20. Java Libraries  java.security Encryption, digital signature, message digest  java.text Formatting and parsing  java.sql Database connectivity  java.rmi Remote method invocation, distributed objects  The list goes on… And it is continuing to expand. Java is still young
  • 21. Outline  C, C++, and Java How Java is related to C and C++  Advantages of Java Writing good codes in Java is easier than in C or C++  Java libraries (packages) Where the power of Java come from  Java and the internet What Java is good for  Course content
  • 22. Java and the Internet  Java is intended to be used in networked/distributed environments.  Increasingly used for “middleware” to communicate between clients and serves, acting as a universal glue that connect user with information from various sources. Example: JMOL  Made possible by portability and multithreading and networking capabilities. Applet Swing (GUI) Servlet DB Java Networking Remote Method Invocation Client Browser ServerApplet User JDBC
  • 23. Course Contents • Language Basics: – Classes, objects, inheritance, interface, inner classes, exception, I/O • Components in the following diagram • Other issues – Multithreading, security Applet Swing (GUI) Servlet DB Java Networking Remote Method Invocation Client Browser ServerApplet JDBC User