Programming Methodology Notes
Introduction
- Computer needs a programming language to function based on user instructions.
- Programming language: Symbols, characters, grammar for human-readable commands.
- Programming: Directing a machine.
Programming Language
- Factors for selecting a language: company policy, task suitability, third-party packages, personal preference
- Considerations: programmer availability, compiler availability, program efficiency
- Basic instructions in programming languages:
- Input, output, math, conditional execution, repetition
- Examples of programming languages: ActionScript, ALGOL, Ada, Assembly, BASIC, C, C++, C#, COBOL, CSS, HTML, Java, PHP, Python, SQL.
Machine Level Language
- Low-level language using binary digits (1s and 0s).
- High-level languages are converted to machine language.
- Computers understand binary data; programs/videos/images/text represented in binary.
- ASCII "A" is 01000001 in machine code.
- Different processor architectures use different machine code.
- Machine code is the computer's basic language; circuitry understands and translates it.
Instruction format consists of command/procedure (tells machine what to do) and operand (specifies data location).
- Common operations: reading, adding, subtracting, writing.
- Machine language uses strings of binary numbers.
Advantages of Machine Language
- Fast execution because instructions are directly understood by the CPU.
Limitations of Machine Language
- Machine dependent: Differs for each computer due to internal design.
- Difficult to program: Requires memorizing codes and tracking storage locations.
- Error-prone: Complex and requires managing opcodes and storage.
- Difficult to modify: Corrections or changes are complex and time-consuming.
Assembly Language
- Second-generation languages that use alphabetic symbols instead of binary code.
- Symbols are used for memory locations and mnemonics for operation codes.
- Example: MOV AX, DX (MOV is mnemonic for ‘transfer’ operation).
Using letter symbols as mnemonics increases software planning.
Advantages of Assembly Language
- Easier to use than machine language.
- Assembler detects programming errors.
- Programmers don't need absolute addresses.
- Encourages modular programming.
Disadvantages of Assembly Language
- Not directly executable.
- Machine-dependent, not portable.
- Requires high programming skill.
Assembly Program Execution
- Assembly program is converted into machine code using an assembler.
- Source program is converted to object program.
- Steps include assembling (source .OBJ), linking (.OBJ to .EXE), and loading for execution.
Higher Level Languages
- e.g., COBOL, FORTRAN, BASIC
- High-level languages developed to simplify programming, using easier instructions.
- Easier to understand compared to machine/assembly code.
Advantages of High-Level Languages
- Readability: More readable than assembly and machine language.
- Portability: Can run on different machines.
- Easy debugging: Easier to remove errors.
- Easy software development: Similar to natural languages.
Popular High-Level Languages: ADA, APL, BASIC, Pascal, FORTRAN, COBOL, C, LISP, RPG.
Characteristics of a Programming Language
- Clarity, simplicity, and unity: Provides a conceptual framework and means of expressing algorithms.
- Orthogonality: Changing one thing doesn't unintentionally affect another.
- Support for abstraction: Bridges the gap between concepts and implementation.
- Portability of programs: Easy to transfer programs.
Programming Environment : Provides utility and implemented easily with proper documentation and efficient testing
Reusability: Checked by program testing techniques like verification method
Algorithms
- A step-by-step process to solve a problem, written in human-readable language.
- Often written in pseudocode.
Characteristics of Algorithms
- Clear and Unambiguous: Each step has one meaning.
- Well-Defined Inputs/Outputs: Clearly defined inputs to be taken and outputs to be yielded.
- Finiteness: Must be finite, not an infinite loop.
- Feasible: Simple and practical with available resources.
- Language Independent: Can be implemented in any language.
Advantages of Algorithms: Easier to understand; breaks down problems.
Disadvantages of Algorithms: Time-consuming to write; difficult to show branching and looping.
Flow Charts
- Diagram representing steps and decisions in a process.
- Useful for writing and illustrating programs.
Common Flowchart Symbols: Terminator, process, document, decision, data, on/off-page reference, flow lines, delay.
Programming Methodology
- A method to solve complex problems using analysis, planning, design, and control.
Types of Programming Methodology
- Procedural Programming: Procedures/code blocks perform tasks.
- Object-oriented Programming: Revolves around entities/objects.
- Functional Programming: Divides problems into functional units-logical units.