SlideShare a Scribd company logo
1 of 23
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 QuontraSolutionsQuontra 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 CodeIntro 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
 
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
 
.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
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet IntroductionWei Sun
 
.Net overview|Introduction Of .net
.Net overview|Introduction Of .net.Net overview|Introduction Of .net
.Net overview|Introduction Of .netpinky singh
 
Net Fundamentals
Net FundamentalsNet Fundamentals
Net FundamentalsAli Taki
 

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

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

1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operatorkamal kotecha
 
Java programing language unit 1 introduction
Java programing language unit 1 introductionJava programing language unit 1 introduction
Java programing language unit 1 introductionchnrketan
 
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) .pptAqeelAbbas94
 
Introduction to Java Part-2
Introduction to Java Part-2Introduction to Java Part-2
Introduction to Java Part-2RatnaJava
 
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 ASITASIT
 
Presentation on java
Presentation on javaPresentation on java
Presentation on javawilliam john
 
FRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONINGFRAUD DETECTION IN ONLINE AUCTIONING
FRAUD DETECTION IN ONLINE AUCTIONINGSatish 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 (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

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

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