LANGUAGEADVAN

LANGUAGEADVAN - Fall 2005 1 ADVANTAGE OF C, JAVA AND C+ Tri...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2005 1 Tri Le Language Features ADVANTAGE OF C, JAVA AND C++ C: - fast: solution used simplistic programming features - smallest executable: solution used simplistic programming features. - most portable: C is the most mature language with the most compilers. - destructor method took parameter: reset the pointer elsewhere to 0 in one operation. - function pointer implementation of virtual functions: use for logical decisions as well perform functional tasks. Java: - garbage collection: removed memory management from the engineering when solving programs. - objected-oriented syntax: rich language features better assist software engineer. - streamlined allocation of objects/syntax: less bugs due to consistent treatment of objects. - large user community: many valuable tools are free and well supported. Java w/ generics: - homogeneous containers – compiler can enforce one more aspect of engineer’s design. - no cast exceptions – item returned is not a generic type making casting unnecessary. C++ w/ templates: - templates: look at notes for list of the benefits of templates: homogeneous container, “virtual friend”, “virtual constructor”, polymorphism can begin before objects are created, no casting of object in container, … - references: compiler enforces never null…no validity checks. - operator overloading: re-use operators for user-defined types (increased design choices of software engineer). - const methods: compiler enforce design of when objects should not change. C++ w/ disk files: - persistent storage: objects lasted longer than program execution/most like real databases/ don’t have to enter all data when program begins. - container was not limited by memory constraints: storage was limited only by disk space…disks are larger than memory. - repeatability in testing: hard/tedious test cases can be easily reproduced saving time and resulting in faster program solutions. - TNodes were all on RTS: no memory leaks possible, implementing most efficient memory via Run-time stack. - Flat data: read and write any object with one function call.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fall 2005 2 Tri Le Language Features Tertiary operator expression: (condition_expression) ? truth_result : false_result; C: Pointers: (also for C++) + 32 bits number that refers to a memory location. + also known as address, label. _ to dereference a pointer: * pointer. _ to ask for address of a variable: & variable. Void pointer: (also for C++) Can’t be dereferenced (don’t know type, size, fields) Preprocessor directive: # ifdefine SYMBOL _H #define SYMBOL _K, #endif prevent repeated declaration. typedef: define a new type Syntax: Typedef existing-type new-type Ex: typedef long Stack struct: allows us to create aggregate object in C Ex: struct tag { int xxx; int yyy; }; typedef + struct: Ex: Typedef struct Student { char name [20]; int number; } Student; Static: (also apply for Java and C++) ± local scope to a file, method, class ± data section allocation ± static declared outside a function , inside a function , inside a class
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

LANGUAGEADVAN - Fall 2005 1 ADVANTAGE OF C, JAVA AND C+ Tri...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online