1 / 16

Programming Languages

2. Programming Languages. Previously. Power and data cables. Power supply. What is a computer? Fast processor of data (input) to produce a result (output) Components Hardware Software BIOS, OS, Programs Encoding Units of storage Bit, Byte, KB, MB, GB and TB Representations

baina
Download Presentation

Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 2 Programming Languages

  2. Previously Power and data cables • Power supply • What is a computer? Fast processor of data (input) to produce a result (output) • Components • Hardware • Software BIOS, OS, Programs • Encoding • Units of storage Bit, Byte, KB, MB, GB and TB • Representations Decimal, binary and hexadecimal Ventilation CPU Memory Hard drive RAM Motherboard Hardware Speaker

  3. Overview • What is a programming language? • Languages by implementation • Language by paradigm • Simple initial design

  4. What is a programming language? • Set of grammatical rules for instructing a computer to perform specific tasks • Languages based on their hierarchy; on how close they are to what the computer understands High Level Languages C++ C# Java C Pascal Fortran LOWER HIGHER Machine Language Assembly Language

  5. Languages by implementation • Machine language • The lowest-level programming language • Collection of binary digits (bits) that the computer reads and execute • Machine language is the only language a computer is capable of understanding • Assembly language symbolic representation of the binary machine codes and other constants needed to program a particular CPU architecture

  6. Languages by implementation • Compiled languages Languages that require a compiler program to turn programming source code into an executable machine-language binary program • Stages • Write source code • Compile the written code by executing the compiler • Output is the executable file (application); machine code • Execute application • Examples: Fortran, Pascal, C and C++

  7. Languages by implementation • Interpreted languages Interpreted program is converted to binary at runtime, by an interpreter program • Java is an interpreted language • The interpreter program is the Java Virtual Machine (JVM) Storage Machine Code Source Code Interpreter CPU/Memory Program Executed

  8. Languages by implementation • Interpreted languages (cont.) Interpreted languages tend to be slower than compiled ones Do not require compilers Usually easier to program than compiled languages Run in different machine without need to re-compile (just if machine has installed the interpreter)

  9. Language by paradigm • Procedural • Derived from structured programming • Series of computational steps to be carried out • Concurrent • Use element of concurrency • Elements: threads, distributed computing, shared resources, message passing • Object Oriented • Uses objects; data structures consisting of data fields (information) and methods (functionality)

  10. Simple initial design • Create sequence of instructions to make two cups of tea Fill Kettle Boil Kettle Make tea - Place kettle on hob - Switch kettle on - Wait until boiling - Switch kettle off • Get two cups • Get two spoons • - Get two tea bags • Get sugar • Put tea bags in cups • Fill cups • Serve cups, spoons & sugar - Get kettle - Go to tap - Put kettle under tap - Open tap - Wait until kettle full - Close tap

  11. Simple initial design • Different diagrams to represent what it is required • Flow Chart • Unified Modelling Language (UML) • Includes a set of graphic notation techniques to create visual models of software • Behaviour diagrams • Used extensively to describe the functionality of software systems • Activity diagram: describes the business and operational step-by-step workflows of components in a system. • UML state machine diagram: describes the states and state transitions of the system. • Use case diagram: describes the functionality provided by a system in terms of actors, their goals represented as use cases, and any dependencies among those use cases.

  12. Simple initial design • Make two cups of tea Get kettle Go to tap Fill Kettle Put kettle under tap - Get kettle - Go to tap - Put kettle under tap - Open tap - Wait until kettle full - Close tap Open tap Wait no Full? yes Close tap

  13. Simple initial design Fill Kettle ... Place kettle on hob Boil Kettle Switch kettle on - Place kettle on hob - Switch kettle on - Wait until boiling - Switch kettle off Wait no Boiling? yes Switch kettle off

  14. Simple initial design Fill Kettle Get two cups ... Get two spoons Boil Kettle ... Make tea Get two tea bags • Get two cups • Get two spoons • - Get two tea bags • Get sugar • Put tea bags in cups • Fill cups • Serve cups, spoons & sugar Get sugar Put tea bags in cups Fill cups Serve cups, spoons & sugar

  15. Simple initial design Make tea • Make two cups of tea Boil Kettle Fill Kettle Get two cups Place kettle on hob Get kettle Get two spoons Go to tap Switch kettle on Get two tea bags Put kettle under tap Wait Get sugar Open tap no Boiling? Put tea bags in cups Wait yes no Switch kettle off Full? Fill cups yes Close tap Serve cups, spoons & sugar

  16. Simple initial design • Divide project into smaller and simpler subprojects • Use pseudocode to represent the project • May help to understand the problem • Simplify the coding • Simpler to understand, more event for no programmers • Flow chart may help to show the project to others • Always document what you design and code

More Related