C++ for Java Programmers Chapter 1 Basic Philosophical Differences.

Slides:



Advertisements
Similar presentations
CSE 105 Structured Programming Language (C)
Advertisements

C++ Language Fundamentals. 2 Contents 1. Introduction to C++ 2. Basic syntax rules 3. Declaring and using variables.
Writing Modern C++ Marc Grégoire Software Architect April 3 rd 2012.
Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Transition from C to C++ …and a Review of Basic Problem Solving.
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
Date: Subject:Distributed Data Processing Name:Maria Br ü ckner.
Lab#1 (14/3/1431h) Introduction To java programming cs425
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
Reasons to study concepts of PL
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
JETT 2003 Java.compareTo(C++). JAVA Java Platform consists of 4 parts: –Java Language –Java API –Java class format –Java Virtual Machine.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Chapter 10 Storage Management Implementation details beyond programmer’s control Storage/CPU time trade-off Binding times to storage.
1 Generics and Using a Collection Generics / Parameterized Classes Using a Collection Customizing a Collection using Inheritance Inner Classes Use of Exceptions.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles C/C++ Emery Berger and Mark Corner University of Massachusetts.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
Language Evaluation Criteria
CSC 142 A 1 CSC 142 Introduction to Java [Reading: chapter 0]
CS 355 – Programming Languages
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
EE4E. C++ Programming Lecture 1 From C to C++. Contents Introduction Introduction Variables Variables Pointers and references Pointers and references.
CS 363 Comparative Programming Languages
Gary MarsdenSlide 1University of Cape Town Principles of programming language design Gary Marsden Semester 2 – 2001.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Adapted from Prof. Necula UCB CS 1641 Overview of COOL ICOM 4029 Lecture 2 ICOM 4029 Fall 2008.
C for Java Programmers Tomasz Müldner Copyright:  Addison-Wesley Publishing Company, 2000 Introduction to C Muldner, Chapters 1, 2.
C Programming language
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
University of Houston-Clear Lake Proprietary© 1997 Evolution of Programming Languages Basic cycle of improvement –Experience software difficulties –Theory.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
1 Generics and Using a Collection Generics / Parameterized Classes Using a Collection Customizing a Collection using Inheritance Inner Classes Use of Exceptions.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
CSE 2541 – Advanced C Programming. Course info Prereq – CSE 2221 or CSE 222 Co-req – CSE 2231 Website
Introduction to Object Oriented Programming CMSC 331.
Java for C++ Programmers Clint Jeffery University of Idaho
Chapter 2: A Brief History Object- Oriented Programming Presentation slides for Object-Oriented Programming by Yahya Garout KFUPM Information & Computer.
C/C++ Basics. Basic Concepts Basic functions of each language: Input, output, math, decision, repetition Types of errors: Syntax errors, logic errors,
Chapter 3 - Language Design Principles
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
Java JDBC API. A Java API To Access almost any kind of tabular data To Access almost any kind of tabular data Trademarked (not an acronym) Trademarked.
Java Example Presentation of a Language. Background Conception: Java began as a language for embedded processors in consumer electronics, such as VCR,
Object Oriented Software Development 4. C# data types, objects and references.
Announcements Assignment 1 due Wednesday at 11:59PM Quiz 1 on Thursday 1.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Fundamental of Java Programming (630002) Unit – 1 Introduction to Java.
C11, Implications of Inheritance
Object Oriented Programming in
Intro to Java L. Grewe.
Chapter 1 Reasons to study concepts of PLs Programming Domains
1.1 Reasons to study concepts of PLs
Introduction Enosis Learning.
Introduction Enosis Learning.
Chapter 4 Action Routines.
(Computer fundamental Lab)
Course Overview PART I: overview material PART II: inside a compiler
The C Language: Intro.
ICOM 4029 Fall 2003 Lecture 2 (Adapted from Prof. Necula UCB CS 164)
Reasons To Study Programming Languages
SPL – PS1 Introduction to C++.
IS 135 Business Programming
Presentation transcript:

C++ for Java Programmers Chapter 1 Basic Philosophical Differences

Chapter 1C++ for Java Programmers2 Similar Roots, different paths Both C++ and Java (and C# and PHP and many other languages) grew out of one tradition of languages So it is not surprizing they have similarities But also many differences that can trap the unwary

Chapter 1C++ for Java Programmers3 Common Ancestor - C Designed by Dennis Ritchie in 1970’s Intended for System Programming (specifically, unix) Economy of expression Easy for compiler to generate code Both high level and low level features

Chapter 1C++ for Java Programmers4 Some Features of C Explicit use of pointers Close match between pointers and arrays Variety of bit-level operations Fast execution time Minimal memory requirements Simple memory model Portable assembly language

Chapter 1C++ for Java Programmers5 Criticisms of C “Too concise for human understanding” while (*p++ = *q++) Lack of run-time checks makes programs error prone (array index checking, parameter matching, etc.) Opens door or malicious use gets(s) a[i++] = i++; func1(func2(), func3(),func4());

Chapter 1C++ for Java Programmers6 Development of C++ Inspired by earlier language Simula Started as collection of macros and library routines for C Intended to be backward compatible with C Inherited C mind-set (pointers, lax checking, memory model) Uncompromising emphasis on efficiency

Chapter 1C++ for Java Programmers7 Examples of Emphasis on Efficiency Few run-time checks (if you want checks, you write them yourself) Many operations ill-defined, so can match machine dependency Stack memory model instead of heap Many decisions left to compiler writer a[i++] = i++

Chapter 1C++ for Java Programmers8 Legacy Problem - old C code The C++ programmer must know about Old C libraries Old techniques (use of preprocessor, etc) Old types (char * for strings, etc) Old styles (use if integers for booleans) Use of global variables, functions, other features not found in Java

Chapter 1C++ for Java Programmers9 And new features C++ added a number of new features to C Classes, inheritance Virtual functions Templates Exception Handing

Chapter 1C++ for Java Programmers10 The Language Java Designed by James Gosling Add simplicity and security to syntax of C++ Trade off between simplicity and efficiency Preserve consistent behavior on all platforms Add run-time checks for safety Heap based memory model, garbage collection Simpler OO model

Chapter 1C++ for Java Programmers11 Comparisons are dangerous Can you say one is better than the other? No. Each has slightly different use, different outlook Given right situation, either can be made to look better than the other