Docsity

Compare Programming Languages - Programming Languages - Lecture Slides, Slides of Programming Languages

Partial preview of the text

Download Compare Programming Languages - Programming Languages - Lecture Slides and more Slides Programming Languages in PDF only on Docsity!

Comparison among

Programming Languages

Lecture Outline[ 1 / 2 ]

  • Object Orientation
  • Static vs. dynamic typing
  • Generic classes
  • Inheritance
  • Feature renaming
  • Method overloading
  • Operator overloading
  • Higher Order Functions and Lexical Closures
  • Garbage Collection

Object orientation:

There are several qualities for Object Oriented Languages: โ€ข

  • Encapsulation
  • Inheritance
  • Polymorphism/dynamic binding.
  • All operation performed by sending messages to object.
  • All user-defined types are object. Java C# C++ Paython Visual basic Hybrid Hybrid Hybrid/multi-paradigm Hybrid Particular support

Static vs. dynamic typing

  • A dynamic type system doesn't require variables to be declared as a

specific type.

  • Statically type languages requires that all

variables are declared with specific type.

Java C# C++ Paython Visual basic Static Static Static Dynamic Static

Inheritance

  • the ability for a class or object to be defined as an extension or

specialization of another class or object.

  • Most object-oriented languages support class-based inheritance.
  • others such as SELF and JavaScript support object-based inheritance.
  • A few languages, notably Python and Ruby, support both class- and

object-based inheritance.

Java C# C++ Paython Visual basic Single class โ€“ multiple multiple multiple None interfaces Single class โ€“ multiple interfaces

Feature renaming

  • Feature renaming is the ability for a class or object to rename one of

its features (a term used to collectively refer to attributes and

methods) that it inherited from a super class.

Java C# C++ Paython Visual basic yes yesโ€“ yes No No

Operator overloading

  • ability for a programmer to define an operator (such as +, or *) for

user-defined types.

Java C# C++ Paython Visual basic No Yes yes Yes No

Higher Order Functions and Lexical Closures

  • Higher Order Functions:
    • functions that can be treated as if they were data objects.
    • they can be bound to variables (including the ability to be stored in collections).
    • can be passed to other functions as parameters.
    • can be returned as the result of other functions.
  • Lexical Closure
    • bundling up the lexical (static) scope surrounding the function

with the function itself, so that the function carries its surrounding

environment around with it wherever it may be used.

Java C# C++ Paython Visual basic No Yes yes Yes No

Uniform Access

  • All services offered by a mod-ule should be available through a

notation, which does not betray whether they are implemented

through storage or through computation.

Java C# C++ Paython Visual basic No No No No Yes

Class Variables/Methods

  • Class variables and methods are owned by a class, and not any

particular instance of a class

  • This means that for however many instances of a class exist at any

given point in time, only one copy of each class variable/method

exists and is shared by every instance of the class.

Java C# C++ Paython Visual basic yes Yes yes No Yes

Access Control

  • ability for a modules implementation to remain hidden behind its

public interface.

Java C# C++ Paython Visual basic Public โ€“ private Name mangling Public-private

  • protected Public โ€“ private
  • protected Public โ€“ private
  • protected

Design by Contract

  • Design by Contract (DBC) is the ability to incorporate important

aspects of a specification into the software that is implementing it.

The most important features of DBC are:

  • Pre-conditions, which are conditions that must be true before a method is

invoked

  • Post-conditions, which are conditions guaranteed to be true after the

invocation of a method.

  • Invariants, which are conditions guaranteed to be true at any stable point

during the lifetime of an object..

Java C# C++ Paython Visual basic No No No No No

Regular Expressions

  • pattern matching constructs capable of recognizing the class of

languages known as regular languages.

Java C# C++ Paython Visual basic Standard libraries Standard libraries No Standard libraries No

Pointer Arithmetic

  • ability for a language to directly manipulate memory addresses and

their contents.

Java C# C++ Paython Visual basic No Yes Yes No No