1.4 Principles of Programming

Cards (26)

  • High Level Languages
    Programming languages closer to English and use recognisable words
  • Low Level Languages
    Programming languages closer to the internal workings of a computer - could be binary or other short codes
  • Assembly language
    • A step above machine code
  • High Level Languages- Benefits
    • Easier to understand, learn and program as commands are more English-like
    • Identifiers can be long and meaningful
    • Allow the use of powerful commands that perform quite complex tasks
    • Allow creation of modules that can be re-used and accessed by other parts of the program
  • Low Level Languages- Benefits
    • Ideal when the execution speed is critical, e.g. boot strap loader
    • More efficient than high level language programs
    • Require less time for translation into machine code
    • Generally result in smaller executable programs
  • Applications requiring low level languages
    • Device Drivers
    • Embedded software
    • Interfacing with custom hardware
  • Procedural Languages
    • Used in traditional programming based on algorithms or a logical step-by-step process for solving a problem
    • Obey ordered instructions
    • Carry out actions / calculations
  • Procedural Languages
    • Provide the programmer a way to define precisely each step when performing a task
    • Allow tight control over the underlying operation of the hardware
    • Used in large complicated programs where similar operations may be carried out at varying stages of the program execution
  • Non-Procedural Languages
    • Allow programmers to specify the results they want without specifying how to solve the problem
    • Used in database interrogation where retrieving answers are more important than the exact steps required to calculate the result
    • Used in Artificial intelligence, grammar checking and language translation applications
  • Object Oriented Language / Programming (OOL/OOP)
    • Uses objects - include both data and associated processing
    • Enables production of buttons / icons, etc - useful in a visual environment
    • Uses features such as inheritance, encapsulation
  • OOP - Advantages
    • Improved productivity when developing software due to the flexible and extendable nature of OOP
    • Software is easier to maintain as OOP is modular and reusable
    • Development is faster due the reusable code and libraries
    • Development is cheaper
    • Software can be tested more easily making it more high quality
    • Software is easier to design as model the real world
  • OOP - Disadvantages
    • OOP is difficult and not as 'logical' to some developers, it is complex to create application in
    • Software can become larger - more code - than procedural programs
    • OOP programs can run slower than PP as there is more code to execute
    • OOP cannot be used for all types of software application such as machine learning and AI
    • OOP can be difficult to debug
  • Class
    A template or blueprint for a specific object. It defines an object's instance variables (attributes/properties) and behaviour (methods)
  • Object
    An instance of a class
  • Method
    A programmed behaviour/subroutine that is included in an object of a class. A method can only access data within its own object (encapsulation)
  • Inheritance
    • Enables new objects to take on the properties of existing objects
    • A superclass is used as the basis for inheritance. A class that inherits from a superclass is called a subclass
    • Defines relationships between classes and organises classes into groups
    • Enables classes that are similar to existing classes to be created by indicating differences (rather than starting again) and therefore allows code to be organised and re-used effectively
  • Abstraction
    The process of hiding non-essential features and showing the essential features
  • Encapsulation
    • The hiding of the implementation of a class and controlling access to its methods and attributes
    • Classes can hide how they work from developers who may wish to use them in their programs
    • Anyone using the class needs only to understand the interface - i.e: its methods and attributes
  • Polymorphism
    The characteristic of being able to assign a different meaning or usage to something in different contexts - specifically, to allow an entity such as a variable, a function, or an object to have more than one form
  • Object Hierarchy
    • It references descendants of objects acting as properties of an object
    • An example of this would be the object controlling a window (at the top of the hierarchy) having another object like the window's border acting as a property of the window
  • Event Driven Language
    • Used in situations that rely on Events
    • Events could be triggered by input devices (on mouse click) or by external sensors (e.g: pressure)
  • Visual Language
    • Particularly suitable for production of objects / buttons / icons, etc
    • Particularly suitable for developing in a GUI/Windows/graphics content/event driven environment
    • May be easier to learn / more intuitive because they are visual - there is very good help / tools available
  • Mark-up Languages
    • Use tags to specify the format of data
    • E.g: HTML - Hypertext Markup Language
    • Can easily be written in any basic text editor
    • The tags are interpreted by the browser when the page is displayed
  • It is important that there are agreed standards in programming languages, even across different manufacturers
  • This would allow commands from Borland C++ to work in Microsoft C++
  • Ambiguity in natural language
    • Means that a statement can be interpreted in more than one way
    • This is difficult enough in English but makes it impossible for a computer to interpret
    • When defining programming languages it is essential that no ambiguity exists