! October 20, 2012 Javolution C++ They call him Ginger! « It looks like Java, it tastes likes Java… but it is C++ »

Slides:



Advertisements
Similar presentations
Software Engineering Implementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004.
Advertisements

Lab#1 (14/3/1431h) Introduction To java programming cs425
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Principles of Object-Oriented Software Development The language Java.
Trey Mack James Moore Osa Osar-Emokpae
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
March 2005Java Programming1. March 2005Java Programming2 Why Java? Platform independence Object Oriented design Run-time checks (fewer bugs) Exception.
Introduction to Java Programming Language Junji Zhi University of Toronto 1.
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#
CMSC 341 Introduction to Java Based on tutorial by Rebecca Hasti at
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
OOP Languages: Java vs C++
3.1 Documentation & Java Language Elements Purpose of documentation Assist the programmer with developing the program Assist other programers who.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Programming Languages and Paradigms Object-Oriented Programming.
Java and C++, The Difference An introduction Unit - 00.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
C Tokens Identifiers Keywords Constants Operators Special symbols.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
1162 JDK 5.0 Features Christian Kemper Principal Architect Borland.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
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.
Introduction to Object Oriented Programming CMSC 331.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
C++ Memory Overview 4 major memory segments Key differences from Java
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Introduction to Java COM379 (Part-Time) University of Sunderland Harry R Erwin, PhD.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Copyright Curt Hill Variables What are they? Why do we need them?
JAVA COURSE 1 Computer Engineering Association. Compile your first program Public class Hello{ public class Hello(){ System.out.println(“Hello”); } puclic.
C Sharp Web & Internet Programming Group Diana, Aren, Jeff, & Adam, Farrin 5/5/20081CS 311.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Chapter 5 Objects and Classes Inheritance. Solution Assignments 3 & 4 Review in class…..
Duke CPS From C++ to Java l Java history: Oak, toaster-ovens, internet language, panacea l What it is ä O-O language, not a hybrid (cf. C++)
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
Java & C++ Comparisons How important are classes and objects?? What mechanisms exist for input and output?? Are references and pointers the same thing??
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Object Oriented Programming Lecture 2: BallWorld.
Memory Management in Java Mr. Gerb Computer Science 4.
Introduction to C++ programming Recap- session 1 Structure of C++ program Keywords Operators – Arithmetic – Relational – Logical Data types Classes and.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
C++ Lesson 1.
Object Oriented Programming in
Creating and Using Objects, Exceptions, Strings
JAVA MULTIPLE CHOICE QUESTION.
Java Primer 1: Types, Classes and Operators
University of Central Florida COP 3330 Object Oriented Programming
C Basics.
null, true, and false are also reserved.
Introduction to Java Programming
An overview of Java, Data types and variables
From C++ to Java Java history: Oak, toaster-ovens, internet language, panacea What it is O-O language, not a hybrid (cf. C++) compiled to byte-code, executed.
JavaScript Reserved Words
Prof. Bhushan Trivedi Director GLS Institute of Computer Technology
Fundamental OOP Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
In this class, we will cover:
Chap 2. Identifiers, Keywords, and Types
Presentation transcript:

! October 20, 2012 Javolution C++ They call him Ginger! « It looks like Java, it tastes likes Java… but it is C++ »

What is the problem? More and more hybrid C++/Java projects o Developer expertise required in both Java and C++ C++ total cost is significantly higher o But cost of migrating existing C++ components to Java is prohibitive. Standardized and well established software practices exist in the Java world o C++ developers are on their own (multiple solutions to address the same problems lead to additional complexity) Many Open-Source implementations of Software Standards exist only in Java o OSGi, GeoAPI, UnitsOfMeasure, etc.

Many causes of variability. Developers expertise varies considerably. Testing performed at the end (integration) due to component inter-dependencies. Insufficient documentation. “Not Invented Here” Syndrome. Proprietary solutions not maintained which later become legacy burden. It is very beneficial to follow well-established standard specification. “Doing the right thing is difficult, but doing it right is easier.”

Javo(So)lution. Uniformization of C++/Java development through the use of a common framework (Javolution) based on Java standard library specification. Facilitating the migration of Java OSS code to C++ Promote the “Service Oriented Approach” by providing an OSGi framework for both Java and C++ Reduce documentation by having the same specification/design for our Java and C++ components. Unification of code building for Java and C++ (maven used for both).

Maven Build Apache Maven (maven native plugin) is used to produce artifacts (dynamic libraries, static libraries, executable) and to perform unit tests. Profiles and packaging classifiers are used to address platform variability (windows, linux, etc.)

What is Javolution C++ ? A mirrored C++ library sharing the same specifications, documentation and unit testing as its Java pendant. A “behind-the-scenes” C++ infrastructure based on smart pointers (real-time garbage collection through reference counting). Integrated memory cache making small, short lived objects (e.g. value types) very efficient. C++ packages/classes derived from standard Java (e.g. javolution::lang, javolution::util) A C++ dynamic execution and testing framework (OSGi & JUnit) identical to Java.

C++ Class Definition The general pattern for class/interface is as follow: #include "javolution/lang/Object.hpp" namespace com { namespace bar { class Foo_API; // Value type (used to define the API) typedef Type::Handle Foo; // Reference (same as Java) }} class com::bar::Foo_API : public virtual javolution::lang::Object_API { private: Param param; protected: Foo_API(Param const& param) { // const& for handles parameters. this->param = param; } public: static Foo newInstance(Param const& param) { // Generalized use of return new Foo_API(param); // factory methods. } virtual void fooMethod () {... }; }

C++ Parameterization – Better than Java! Unlike Java, C++ class parameterization is not syntactic sugar but efficient use of C++ templates! All javolution::util collections are parameterized. List list = FastTable_API ::newInstance(); list->add(L"First"); list->add(Type::Null); list->add(L"Second"); Also used for Java-Like Enums

Synchronization Supported through a macro: synchronized(Object) mimicking the Java synchronized keyword. Can be performed on instances of Javolution collections and Class (for static synchronization). synchronized (trackedServices) {// trackedServices instance of FastMap for (int i = 0; i < serviceReferences.length; i++) { Object service = actualCustomizer->addingService(serviceReferences[i]); trackedServices->put(serviceReferences[i], service); } trackingCount = 0; }

Miscellaneous Limited reflection support through RTT Auto-boxing of primitive types (boolean, integer, float, wide strings). Integer32 i = 23; Float64 f = 3.56; Boolean b = true; String s = L"xx"; All variables are initialized to Type::Null (NullPointerException if not set before use). Wide-String (literal) concatenation supported. throw RuntimeException_API::newInstance( L"Bundle " + symbolicName + L" not in a resolved state“ ); Dynamic length array Type::Array Type::Array serviceReferences = context->getServiceReferences(serviceName, Type::Null); if (serviceReferences.length == 0) return;

Minor differences with Java No ‘finally’ keyword in C++ (but try…catch same as Java). Static methods are called using the name of the class with the suffix ‘_API’ Generalized use of static factory methods, e.g. MyClass_API::newInstance(…) Synchronization not supported on every object but only on those whose class implements the Object_API::getMutex() virtual method.

What next? Automatic translator (JavaCC based) of Java source code to Javolution C++ More Java library conversion (e.g. OpenSDK, JScience, …) Help wanted in writing the translator tool