KEMBAR78
Interfacing With High Level Programming Language | PPTX
Interfacing With High level Language progaraming
1
Computer Architecture
And Assembly language
Presentation Topic :
Interfacing With High
Level Programing Language
Interfacing With High level Language progaraming
2
Mansoor Bashir
Interfacing With High level Language programming 3
A high-level language is a programming language such as C,
FORTRAN, or Pascal that enables a programmer to write
programs that are more or less independent of a particular
type of computer. Such languages are considered high-
level because they are closer to human languages and
further from machine languages.
Programs written in a High-level language must be Translated
into machine language by a compiler or Interpreter
High-level language
Interfacing With High level Language progaraming 4
Fortran(1954) Lisp(1958) COBOL(1959) Simula(1964)
Basic(1964) Smalltalk(1969) Prolog(1970) Pascal(1970)
C(1971) ML(1973) Scheme(1975)
Ada(1979) C++(1983) Perl(1987) Python(1991)
Java(1995)
C#(2000) VB.NET(2001)
Many different high-level languages
have been developed, e.g.:
Interfacing With High level Language programming 5
Categories of programming languages
Interfacing With High level Language progaraming 6
Interfacing With High level Language programming 7
Processing a High-Level Language Program
The only language understood by a computer is machine language.
i
Interfacing With High level Language progaraming 8
Characteristic of High Level Language:-
High level languages have several advantages
Easy to learn:-
The high Level Languages are close to human languages. The instructions
written in high level languages are similar to English like words and
Statements. This makes the high level languages easy to learn and use.
Easy to detect errors:-
The logic of the program written in high level languages is very simple and
easy. The instructions of program are like English language statements. In
case of errors, it is very easy to detect (or find) and remove errors in the
Program. It is also easy to modify the Program.
.
Interfacing With High level Language progaraming 9
Machine Independent:-
The program written in High Level Language is machine independent. It means that
a program written or compiled on one type of Computer can be executed (run) on
another different type of Computer that has different architecture.
For Example:-
A program written on a Computer using Intel Processor can be run on
computer having Motorola Processor (but with a little Modification).
Source code is understandable by another programmer:-
The instructions of the program written in high level language are like
English language statements. These are written according to the standard syntax of
the language. Therefore, a computer programmer can easily understand a program
written by another programmer
Interfacing With High level Language progaraming 10
Advantages of high-level languages
- better portability (program runs on many CPUs)
- natural structures for expressing flow of control
- much better support for software maintenance
- much better support for software reuse
Interfacing With High level Language progaraming 11
Understanding interface-based programming
 Implementing an interface
Obtaining interface references
 Interface hierarchies
 Multiple base interfaces
Interfaces
Interfacing With High level Language progaraming 12
C# only supports single inheritance, the interface-based
protocol allows a given type to support numerous
behaviors, while avoiding the issues that arise when
deriving from multiple base classes (as in C++).
Interface-Based Programming
Interfacing With High level Language progaraming 13
Interface-Based Programming
In COM , the only way a
client can communicate with a COM
component is via an interface pointer (not a
direct object reference).
An interface is a description of the actions that
an object can do... for example when you flip a
light switch, the light goes on, you don't care
how, just that it does.
Interfacing With High level Language progaraming 14
Implementing an Interface
Declare a class that implements an interface, you include
an implements clause in the class declaration. Your class
can implement more than one interface
WHAT IS interface in Java?
An interface is a reference type in Java, it is similar to
class, it is a collection of abstract methods. A class
implements an interface, thereby inheriting the abstract
methods of the interface. Along with abstract methods
an interface may also contain constants, default methods,
static methods, and nested types.
Interfacing With High level Language progaraming 15
Interfaces in Object Oriented Programming Languages
An interface is a programming structure/syntax that
allows the computer to enforce certain properties on
an object (class). For example, say we have a car class
and a Bus class and a Bike class. Each of these three
classes should have a start engine() action. How the
"engine is started" for each vehicle is left to each
particular class, but the fact that they must have a start
engine action is the domain of the interface.
Interfacing With High level Language progaraming 16
Explicit Interface Implementation
If a class implements two interfaces that contain a member with the same
signature, then implementing that member on the class will cause both
interfaces to use that member as their implementation.
Interfacing With High level Language progaraming 17
Interfacing With High level Language programming 18
Interface Hierarchies
// The base interface
public interface IDraw
{
void Draw();
}
public interface IDraw2 : IDraw
{
void IDrawToPrinter();
}
public interface IDraw3 : IDraw2
{
void DrawToMetaFile();
}
Interfacing With High level Language progaraming 19
Identical Interfaces
// Three interfaces each defining identical methods
public interface IDraw
{
void Draw();
}
public interface IDraw3D
{
void Draw();
}
public interface IDrawToPrinter
{
void Draw();
}
Interfacing With High level Language progaraming 20
Multiple Base Interfaces
In C# it is completely permissible to create an interface that
derives from multiple base interfaces .
public interface Vehicle
{
void Drive();
}
public interface rode
{
void Drive();
}
public interface Car : Vehicle, rode
{
void showDrives();
}
Interfacing With High level Language progaraming 21
Interfaces in Object Oriented Programming Languages
An interface is a programming structure/syntax that allows
the computer to enforce certain properties on an object
(class). For example, say we have a car class and a Bus class
and a Bike class. Each of these three classes should have a
start engine() action. How the "engine is started" for each
vehicle is left to each particular class, but the fact that they
must have a start engine action is the domain of the interface.
Interfacing With High level Language progaraming 22
Implementing an Interface
To tell the computer that a new class that you are writing will fulfill all the
requirements (implement all the functions) of an interface, you must use the
keyword implements in the same location where you can use the
keyword extends.
Interfacing With High level Language progaraming 23
Thank You

Interfacing With High Level Programming Language

  • 1.
    Interfacing With Highlevel Language progaraming 1 Computer Architecture And Assembly language Presentation Topic : Interfacing With High Level Programing Language
  • 2.
    Interfacing With Highlevel Language progaraming 2 Mansoor Bashir
  • 3.
    Interfacing With Highlevel Language programming 3 A high-level language is a programming language such as C, FORTRAN, or Pascal that enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high- level because they are closer to human languages and further from machine languages. Programs written in a High-level language must be Translated into machine language by a compiler or Interpreter High-level language
  • 4.
    Interfacing With Highlevel Language progaraming 4 Fortran(1954) Lisp(1958) COBOL(1959) Simula(1964) Basic(1964) Smalltalk(1969) Prolog(1970) Pascal(1970) C(1971) ML(1973) Scheme(1975) Ada(1979) C++(1983) Perl(1987) Python(1991) Java(1995) C#(2000) VB.NET(2001) Many different high-level languages have been developed, e.g.:
  • 5.
    Interfacing With Highlevel Language programming 5 Categories of programming languages
  • 6.
    Interfacing With Highlevel Language progaraming 6
  • 7.
    Interfacing With Highlevel Language programming 7 Processing a High-Level Language Program The only language understood by a computer is machine language. i
  • 8.
    Interfacing With Highlevel Language progaraming 8 Characteristic of High Level Language:- High level languages have several advantages Easy to learn:- The high Level Languages are close to human languages. The instructions written in high level languages are similar to English like words and Statements. This makes the high level languages easy to learn and use. Easy to detect errors:- The logic of the program written in high level languages is very simple and easy. The instructions of program are like English language statements. In case of errors, it is very easy to detect (or find) and remove errors in the Program. It is also easy to modify the Program. .
  • 9.
    Interfacing With Highlevel Language progaraming 9 Machine Independent:- The program written in High Level Language is machine independent. It means that a program written or compiled on one type of Computer can be executed (run) on another different type of Computer that has different architecture. For Example:- A program written on a Computer using Intel Processor can be run on computer having Motorola Processor (but with a little Modification). Source code is understandable by another programmer:- The instructions of the program written in high level language are like English language statements. These are written according to the standard syntax of the language. Therefore, a computer programmer can easily understand a program written by another programmer
  • 10.
    Interfacing With Highlevel Language progaraming 10 Advantages of high-level languages - better portability (program runs on many CPUs) - natural structures for expressing flow of control - much better support for software maintenance - much better support for software reuse
  • 11.
    Interfacing With Highlevel Language progaraming 11 Understanding interface-based programming  Implementing an interface Obtaining interface references  Interface hierarchies  Multiple base interfaces Interfaces
  • 12.
    Interfacing With Highlevel Language progaraming 12 C# only supports single inheritance, the interface-based protocol allows a given type to support numerous behaviors, while avoiding the issues that arise when deriving from multiple base classes (as in C++). Interface-Based Programming
  • 13.
    Interfacing With Highlevel Language progaraming 13 Interface-Based Programming In COM , the only way a client can communicate with a COM component is via an interface pointer (not a direct object reference). An interface is a description of the actions that an object can do... for example when you flip a light switch, the light goes on, you don't care how, just that it does.
  • 14.
    Interfacing With Highlevel Language progaraming 14 Implementing an Interface Declare a class that implements an interface, you include an implements clause in the class declaration. Your class can implement more than one interface WHAT IS interface in Java? An interface is a reference type in Java, it is similar to class, it is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. Along with abstract methods an interface may also contain constants, default methods, static methods, and nested types.
  • 15.
    Interfacing With Highlevel Language progaraming 15 Interfaces in Object Oriented Programming Languages An interface is a programming structure/syntax that allows the computer to enforce certain properties on an object (class). For example, say we have a car class and a Bus class and a Bike class. Each of these three classes should have a start engine() action. How the "engine is started" for each vehicle is left to each particular class, but the fact that they must have a start engine action is the domain of the interface.
  • 16.
    Interfacing With Highlevel Language progaraming 16 Explicit Interface Implementation If a class implements two interfaces that contain a member with the same signature, then implementing that member on the class will cause both interfaces to use that member as their implementation.
  • 17.
    Interfacing With Highlevel Language progaraming 17
  • 18.
    Interfacing With Highlevel Language programming 18 Interface Hierarchies // The base interface public interface IDraw { void Draw(); } public interface IDraw2 : IDraw { void IDrawToPrinter(); } public interface IDraw3 : IDraw2 { void DrawToMetaFile(); }
  • 19.
    Interfacing With Highlevel Language progaraming 19 Identical Interfaces // Three interfaces each defining identical methods public interface IDraw { void Draw(); } public interface IDraw3D { void Draw(); } public interface IDrawToPrinter { void Draw(); }
  • 20.
    Interfacing With Highlevel Language progaraming 20 Multiple Base Interfaces In C# it is completely permissible to create an interface that derives from multiple base interfaces . public interface Vehicle { void Drive(); } public interface rode { void Drive(); } public interface Car : Vehicle, rode { void showDrives(); }
  • 21.
    Interfacing With Highlevel Language progaraming 21 Interfaces in Object Oriented Programming Languages An interface is a programming structure/syntax that allows the computer to enforce certain properties on an object (class). For example, say we have a car class and a Bus class and a Bike class. Each of these three classes should have a start engine() action. How the "engine is started" for each vehicle is left to each particular class, but the fact that they must have a start engine action is the domain of the interface.
  • 22.
    Interfacing With Highlevel Language progaraming 22 Implementing an Interface To tell the computer that a new class that you are writing will fulfill all the requirements (implement all the functions) of an interface, you must use the keyword implements in the same location where you can use the keyword extends.
  • 23.
    Interfacing With Highlevel Language progaraming 23 Thank You