Subtopic Notes

4.2 Programming languages, translators and IDEs

4. Software

High Level Languages

  • Advantages
    • Close to English/native/human language
    • Easier/faster to correct errors/read/write
    • Much easier to debug
    • Debug at the development stage
    • Portable: Works on many different machines/operating systems (not machine-specific, portable)
  • Disadvantages
    • Programs can be larger
    • Program can take longer to execute
    • Program may not make use of special hardware
  • Example: C, Python, Java, Pascal etc.

Low Level Languages

  • Relate to the specific architecture and hardware of a particular type of computer.
  • Can refer to machine code, the binary instructions that a computer understands, or an assembly language that needs to be translated into machine code.
  • Benefits:
    • Work directly on registers/CPU/ can address memory addresses directly
    • More control over what happens in computer
    • Can use machine specific functions
    • Code requires less storage/RAM
    • Runs faster.
  • Disadvantage:
    • Takes longer to write or debug
    • Difficult to understand
    • Not Portable

Assembly Languages

  • Low-level programming language that is closely related to machine code but is more human-readable.
  • Uses mnemonic codes and symbols instead of binary instructions
  • Advantages:
  • Can make use of special hardware
  • Use special machine-dependent instructions
  • Doesn’t take up much space in primary memory
  • Code performs task relatively quickly

Translators

CompilerInterpreterAssembler
Translates a high-level language to machine codeExecutes a high-level language one statement at a timeTranslates low-level assembly language into machine code.
An executable file producedNo executable file producedAn executable file produced.
A single high-level language statement may correspond to multiple machine code instructions.Each statement in assembly language is translated into one machine code instruction.
Compiler not required to run compiled programsInterpreted programs cannot be run without the interpreterAssembler not required to run assembled program
Usually used while distributing programUsed during production stageAssembled programs are released for general use

Compiler

AdvantagesDisadvantages
Creates an executable file so the code can be tested multiple times without having to recompile so repeated testing takes less timeLarger amounts of source code take time to compile
Compiled programs are run without the compilerSlower to produce the object code than an interpreter
Optimize code for better performance and efficiencyCode cannot be changed without recompilation
No Dependency on Source CodeThe program will not run if there are any errors
More secured as codebase not available for usersErrors cannot be corrected in real-time; Harder to test and debug
One error may result in other false errors being reported

Interpreter

AdvantagesDisadvantages
Easier to debug the program because it translates line-by-line and stops when an error is foundStops execution at first error, which can slow down debugging for large programs.
Allows error to be fixed in real timeProgram can’t run without interpreter
Program can restart at same point when error occurs and refixedThe source code must be available for execution, making it less secured
Effect of changing code seen immediately
A partially completed program can be translated / tested on its own

IDE (Integrated development environments)

  • Software application that helps programmers develop software code efficiently.
  • Features
    • Code editors
    • Run-time Environment
    • Translator
    • Auto completion
    • Context-Sensitive Prompts: Displays relevant options, such as available functions and variables
    • Auto correct
    • Presentation
      • Prettyprint: Enhances readability by applying automatic indentation and syntax highlighting.
      • Expand and Collapse code blocks: Allows sections of code to be minimized, making navigation easier and reducing excessive scrolling.
    • Error diagnostics
    • Debugging Tools:
      • Single stepping: Executes code one line at a time to observe its impact on variables
      • Breakpoints: Halts execution at a specific line to check the program's behavior up to that point
      • Variables/expressions Report Window: Displays and tracks variable values for comparison.
    • Initial Error Detection
      • Dynamic syntax checks: Highlights syntax errors immediately as they are typed.
      • Type checking & parameter checking