Table of Contents
Definition / general | Essential features | Software | Diagrams / tables | Brief history of programming | Programming languages | Fundamental properties of programming | Readability of source code | Programming methodologies | Debugging | Videos | Board review style question #1 | Board review style answer #1 | Board review style question #2 | Board review style answer #2Cite this page: Jonah UJ, Parwani A. Introduction to programming. PathologyOutlines.com website. https://www.pathologyoutlines.com/topic/informaticsprogramming.html. Accessed December 4th, 2024.
Definition / general
- Computer programming or coding involves sending a sequence of instructions (sometimes in the form of human readable codes), called programs, to electronic machines in order to
- Perform tasks
- Solve problems
- Provide human interactivity
Essential features
- Programming languages are the building blocks for all software development, ranging from the simplest to the most advanced applications
- For a programming language to be effective, it must satisfy certain fundamental properties, such as reliability, efficiency, security, maintainability and robustness
- Readability of source code can affect the quality of a program, including its portability, usability and maintainability
- When effectively utilized, good programming methodologies can solve real world problems, such as inventory management, payroll processing, etc.
- Bugs can significantly hamper the software development process by introducing defects into a program and reducing its usability, hence the need for debugging
Software
- One of the most significant tools for software development is the integrated development environment (IDE)
- IDEs are software development tools used by developers to simplify their programming and design experiences
- IDEs consist of a(n)
- Integrated user interface
- Code editor
- Debugger
- Code compiler
- Additional tools for automating certain parts of the software development process (TechRepublic: The 12 Best IDEs for Programming [Accessed 21 November 2023])
- IDEs can be classified into the following categories
- Multilanguage IDE
- This supports multiple programming languages
- Example: Visual Studio IDE
- Mobile development IDE
- These IDEs help software developers to build efficient mobile apps
- Examples include Android Studio and Xcode
- Web / cloud based IDE
- This type of IDE can be used to run heavy projects without occupying
- It is also platform independent, making it easy to connect to many cloud development providers
- Specific language IDE
- Multilanguage IDE
Brief history of programming
- 9th century AD: the Bhanu Musa brothers described an automated mechanical flute (Mech Mach Theory 2001;36:589)
- 1206 AD: Arab engineer Al-Jazari invented a programmable automated music drum machine capable of playing different rhythms and drum patterns via pegs and cams (MEJ 1967;54:45)
- In 1837, Charles Babbage wrote his first program for the analytical engine (arXiv: The First Computer Program [Accessed 21 November 2023])
- 1843: Ada Lovelace published an algorithm to calculate a sequence of Bernoulli numbers using Charles Babbage's Analytical Engine (IEEE Xplore: Lovelace & Babbage and the Creation of the 1843 'Notes' [Accessed 21 November 2023])
- 1880s: Herman Hollerith introduced the concept of storing data in machine readable form (Columbia: Herman Hollerith [Accessed 21 November 2023])
- 1949: a stored program computer capable of operating with a memory was introduced (Computer History Museum: Timeline of Computer History [Accessed 21 November 2023])
- 1952: Grace Hopper developed the first compiler related tool, the A - 0 system
- 1957: the first widely used high level language to have a functional implementation, known as Fortran, was released (Software Preservation Group: FORTRAN Session [Accessed 21 November 2023])
- Many other programming languages were developed afterward, including COBOL
Programming languages
- A programming language is a system of notation for writing code; it includes
- Computational model
- Syntax and semantics of the program
- Pragmatic considerations that shape the language
- There are hundreds of programming languages in existence (Wikipedia: List of Programming Languages [Accessed 21 November 2023])
- Programming languages are the building blocks for all software development, ranging from the simplest to the most advanced applications
- Computer programmers select programming languages based on their needs; below are a few popular programming languages
- Python
- Python can be used for data analysis, machine learning and web development
- JavaScript
- JavaScript is primarily used in web development and is usually the first programming language learned by beginner web developers
- It can also be used for mobile devices and game development
- C / C++
- Java
- C#
- Ruby
- PHP (freeCodeCamp: What is Computer Programming? [Accessed 21 November 2023)
- Python
- Despite the differences in programming languages, a few basic instructions appear in just about every language
- Input: gathers data from the keyboard, a file or some other device
- Output: displays data on the screen or sends data to a file or other device
- Arithmetic: performs basic arithmetical operations like addition and multiplication
- Conditional execution: checks for certain conditions and executes the appropriate sequence of statements
- Repetition: performs some actions repeatedly, with some degree of variation occasionally (Green Tea Press: How to Think Like a Computer Scientist [Accessed 21 November 2023])
- Choice of programming language depends on a lot of factors, including
- Company policy
- Suitability to task
- Availability of third party packages
- Individual preference
- Programming languages exist on a spectrum of low level to high level languages
- Low level languages are typically more machine oriented and faster to execute
- High level languages are more abstract and easier to use but slower to execute
- Developers find it easier to code in high level languages than in low level ones
- Categories of programming languages (freeCodeCamp: What is Computer Programming? [Accessed 21 November 2023)
- Machine language (MA)
- MA is a low level language that consists of zeros and ones (binary)
- High level languages are compiled into machine codes, which are in turn executed by a computer
- Assembly language (AL)
- AL is a low level language that is compiled by an assembler, which translates human codes to machine codes
- Procedural language (PL)
- PL goes through a series of procedures after which a program is executed on a computer (e.g., Go and Julia)
- Scripting languages (SLs)
- SLs are languages that require interpretation rather than compilation; an interpreter will usually read and execute the code instead of compiling the SL into machine code (e.g., JavaScript and PHP)
- Functional languages (FLs)
- FLs work by building complex programs through a collection of smaller functions (e.g., Haskell and Scala)
- Object oriented languages
- This language model builds programs around a collection of objects (e.g., Python and Java)
- Machine language (MA)
Fundamental properties of programming
- For a programming language to be effective, it must satisfy certain fundamental properties
- Such properties include reliability, efficiency, security, maintainability, robustness, etc.
- Reliability
- Reliability refers to how often the results of a program are correct
- Poor reliability often results from noncompliance with good architectural and coding practices
- Reliability can be estimated by measuring the static quality attributes of an application
- Reliability of a program provides an estimate of the business risk associated with putting such programs into operational use
- To assess reliability, the following software engineering best practices should be evaluated
- Application architecture practices
- Coding practices
- Complexity of algorithms
- Complexity of programming practices
- Compliance with object oriented and structured programming best practices (when applicable)
- Component or pattern reuse ratio
- Dirty programming
- Error and exception handling (for all layers - GUI, logic and data)
- Multilayer design compliance
- Resource bounds management
- Software patterns that will lead to unexpected behaviors
- Software data integrity and consistency
- Transaction complexity level (Pham: Software Reliability, 2000 Edition, 2000)
- Efficiency / performance
- Efficiency measures the number of resources required by a program to yield an optimum outcome
- Such resources include the following
- Processor time
- Memory space
- Slow devices such as disks
- Network bandwidth
- User interaction
- The fewer resources consumed by a program, the better its efficiency / performance
- Other attributes of a good program include its ability to
- Clean up temporary files
- Eliminate memory leaks
- To assess efficiency, the following software engineering best practices should be evaluated
- Application architecture practices
- Appropriate interactions with expensive or remote resources
- Data access performance and data management
- Memory, network and disk space management
- Compliance with coding practices (best coding practices) (Techopedia: Code Efficiency [Accessed 21 November 2023])
- Security
- Good programming languages must possess quality software security (Synopsys: How Are Code Quality and Code Security Related? [Accessed 21 November 2023])
- Security vulnerabilities result from poor coding and architectural practices, such as
- Structured query language (SQL) injection
- Cross site scripting (IBM: Cost of a Data Breach Report 2023 [Accessed 21 November 2023], Bluefin: Key Takeaways from IBM and Ponemon’s 2020 Cost of a Data Breach Report [Accessed 21 November 2023])
- To assess the security apparatus of a program, the following software engineering best practices and technical attributes should be checked
- Implementation, management of a security aware and hardening development process (e.g., Security Development Lifecycle [Microsoft]) or IBM's Secure Engineering Framework (IBM: Security in Development - The IBM Secure Engineering Framework [Accessed 21 November 2023])
- Secure application architecture practices (IBM: Enterprise Security Architecture Using IBM Tivoli Security Solutions [Accessed 21 November 2023])
- Multilayer design compliance
- Security best practices (input validation, SQL injection, cross site scripting, access control, etc.) (SANS: CWE TOP 25 Most Dangerous Software Errors [Accessed 21 November 2023])
- Secure and good programming practices (Carnegie Mellon University: Top 10 Secure Coding Practices [Accessed 21 November 2023])
- Error and exception handling (CWE: 2023 CWE Top 25 Most Dangerous Software Weaknesses [Accessed 21 November 2023])
- Maintainability
- Maintainability refers to the ease with which a program can be modified by its present or future developers to
- Make improvements
- Customize it to varying needs
- Fix bugs and security holes
- Adapt it to new environments
- Good maintainability is best integrated into a program during its initial development phase (Wisdom Geek: Programming 101 - Tips to Become a Good Programmer [Accessed 21 November 2023])
- Maintainability concepts involve the following
- Modularity
- Understandability
- Changeability
- Testability
- Reusability
- Transferability from one development team to another
- Poor maintainability results from thousands of minor violations with
- Best practices in documentation
- Complexity avoidance strategy
- Basic programming practices
- This refers to practices that make the difference between clean, easy to read code and unorganized, difficult to read code (IfSQ: A Foundation-Level Standard for Computer Program Source Code [Accessed 21 November 2023])
- To assess maintainability, the following software engineering best practices and technical attributes should be checked regularly
- Application architecture practices
- Architecture, programs and code documentation embedded in source code
- Code readability
- Code smells
- Complexity level of transactions
- Complexity of algorithms
- Complexity of programming practices
- Compliance with object oriented and structured programming best practices (when applicable)
- Component or pattern reuse ratio
- Controlled level of dynamic coding
- Coupling ratio
- Dirty programming
- Documentation
- Hardware, OS, middleware, software components and database independence
- Multilayer design compliance
- Portability
- Programming practices (code level)
- Reduced duplicate code and functions
- Source code file organization cleanliness (Blanchard: Maintainability - A Key to Effective Serviceability and Maintenance Management, 1st Edition, 1995)
- Maintainability refers to the ease with which a program can be modified by its present or future developers to
- Robustness
- Robustness in computer science refers to the ability of a computer system to cope with errors during execution as well as its ability to cope with erroneous input (IFIP: A Model-Based Approach for Robustness Testing [Accessed 21 November 2023])
- In computer programming, robustness entails how well a program anticipates problems due to errors (not bugs); such problems include
- Incorrect, inappropriate or corrupt data
- Unavailability of needed resources such as
- Memory
- Operating system services
- Network connections
- User error
- Unexpected power outages
- A robust program differs from a nonrobust (or fragile) program by its adherence to the following 4 programming principles
- Paranoia: programmers should expect users to be able to break their codes and render them inefficient
- Stupidity: programmers should endeavor to write their codes in the most unambiguous way possible to enable even uniformed users to utilize their codes well
- Dangerous implements: programmers should hide their libraries and data structures from users to prevent them from modifying them with the intent of introducing a bug in the code
- Can't happen: developers should write their codes with the possibility of unlikely scenarios in mind and how to tackle such scenarios should they arise (UC Davis: Robust Programming [Accessed 21 November 2023])
- Usability
- Usability refers to the ergonomics of a computer program
- It is the ease with which an individual can use a program for its intended purpose or in some cases, even unexpected purposes
- Usability of a program can make or break its success irrespective of other issues
- Usability of a program can be designed using about 5 quality components
- Learnability: how easy it is for end users to carry out required tasks at their first encounter with the design
- Efficiency: the speed with which users can perform their tasks after they have become acquainted with the program design
- Memorability: the ease with which users can reestablish proficiency after a break from using the program
- Errors: how often users make errors and how easily they recover from the errors
- Satisfaction: how pleasant the design is to users (NN/g: Usability 101 - Introduction to Usability [Accessed 21 November 2023])
- Portability
- A computer software program is said to be portable if it requires very low effort to make it run on different platforms
- Thus, portability refers to the range of computer hardware and operating system (OS) platforms on which the source code of a program can be compiled / interpreted and run
- Factors influencing portability include
- Differences in the programming facilities provided by the different platforms, such as hardware and OS resources
- Expected behavior of the hardware and OS
- Availability of platform specific compilers (and sometimes libraries) for the language of the source code (TechTarget: What Is Software Portability? [Accessed 21 November 2023])
Readability of source code
- Readability of a program is the ease with which a human reader can understand its purpose, control flow and operation of its source code
- Readability can affect the quality of a program such as its portability, usability and especially its maintainability
- Importance of readability boils down to the fact that programmers invest a great deal of time
- Reading codes
- Trying to understand codes
- Modifying existing source code
- Programmers would rather modify the source code than write a new one
- Unreadable codes are often plagued with bugs, inefficiencies and duplicate codes
- Simple transformations to make codes readable have been shown to shorten the codes and significantly reduce the time needed to understand them (CACM 1982;25:512)
- Several factors can influence the readability of codes, some of which include the following
- Consistency in programming style
- Different indent styles (whitespace)
- Comments
- Decomposition
- Naming conventions for objects (such as variables, classes, functions, procedures, etc.)
- Programmer's talents and skills in regard to content creation
- Use of integrated development environments (IDEs) to integrate various visual programming languages (IONOS: Source Code - What Exactly Is It? [Accessed 21 November 2023])
- Employing techniques, like code refactoring
Programming methodologies
- Programming methodology refers to the approach used by developers to analyze complex problems, plan and control the software development process needed to tackle such problems
- When effectively utilized, programming methodologies can solve real world problems such as
- Inventory management
- Payroll processing
- Student admissions
- Examination results processing
- To develop a formal software, the following step by step approach is utilized by some developers
- Requirements analysis
- Testing to determine value modelling
- Implementation
- Failure elimination (debugging)
- Each of the steps above can be approached in different ways
- For instance, a popular approach to requirements analysis is use case analysis
- Lots of programmers also use agile software development
- In agile software development, various stages of formal software development are integrated together into short cycles that take a few weeks rather than years (Developer.com: Top 10 Programming Methodologies [Accessed 21 November 2023])
- Lots of programmers also use agile software development
- Popular modeling techniques include
- Object oriented analysis and design (OOAD)
- Model driven architecture (MDA)
- Unified modeling language (UML) (a notation used for both OOAD and MDA)
- Popular implementation techniques employed by developers including the following
- Procedural programming: breaks down problems into blocks of code or procedures that perform 1 task each
- It is suitable for small programs with a low level of complexity
- Object oriented programming (OOP): in OOP, solutions to a problem are derived from objects that form part of the problem, especially from how the objects behave relative to one another
- Functional programming: functional programming does the following to solve problems
- Breaks down problems into functional units
- Ensures that each functional unit performs its own task and is self sufficient
- Units are then coupled together to form the complete solution
- Logical programming: in this method, problems are broken down into logical units rather than functional units
- Procedural programming: breaks down problems into blocks of code or procedures that perform 1 task each
- Note that developers may employ a combination of any of the above units in developing a software geared toward certain needs or purposes (Tutorials Point: Programming Methodologies - Introduction [Accessed 21 November 2023])
- Failure elimination (debugging) is discussed under a separate subsection below
Debugging
- In programming, debugging refers to the process of finding and resolving bugs within computer programs, software or systems (Arrow: Debugging in Programming - Basics, Features & IDEs [Accessed 21 November 2023])
- Bugs are defects or problems that prevent the correct operation of a program
- Bugs can significantly hamper the software development process by introducing defects into a program to reduce its usability
- Some programming languages are more prone to bugs than others because their design does not allow multiple checks for bugs as other languages do
- Common coding errors include the following
- Syntax error
- Runtime error
- Semantic error
- Logic error
- Disregarding adopted conventions in the coding standard
- Calling the wrong function
- Using the wrong variable name in the wrong place
- Failing to initialize a variable when absolutely required
- Skipping a check for an error return (TechTarget: What Is Debugging? [Accessed 21 November 2023])
- Debugging is a multistep process that
- Detects possible problems, sometimes with the use of static code analysis
- Attempts to reproduce the problems, using static code analysis for instance
- Corrects problems or determines a way to work around them
- Tests corrections or workarounds and makes sure that they work (TechTarget: What Is Debugging? [Accessed 21 November 2023])
- Debugging strategies include the following
- Static code analysis: the developer analyzes the code without executing the program
- Print debugging (tracing): involves watching live or recorded print statements and monitoring flow
- Remote debugging: involves debugging a program running on a system different from the debugger (TechTarget: What Is Debugging? [Accessed 21 November 2023])
- Postmortem debugging: involves debugging a program after it has already crashed (Dr. Dobb's: Postmortem Debugging [Accessed 21 November 2023])
- Saff squeeze: involves isolating failure within the test using progressive inlining of parts of the failing test
- Time travel debugging or time traveling debugging: involves stepping back in time through source code to understand what is happening during execution of a computer program (Microsoft: Time Travel Debugging in WinDbg Preview! [Accessed 21 November 2023])
- Delta debugging: uses a technique of automating test case simplification (Zeller: Why Programs Fail - A Guide to Systematic Debugging, 1st Edition, 2005)
- Record and replay debugging: involves recording the execution of a software program so that it may be played back within a debugger to help diagnose and resolve defects (Wikipedia: Debugger [Accessed 21 November 2023], arXiv: Engineering Record And Replay For Deployability - Extended Technical Report [Accessed 21 November 2023])
- Relevant software for debugging
- Integrated development environments (IDEs) are often used for debugging
- IDEs can be either standalone products or they may be coupled with development hardware for a particular microcontroller (Arrow: Debugging in Programming - Basics, Features & IDEs [Accessed 21 November 2023])
- GNU debugger (GDB) is a portable debugger that makes use of a command line for debugging (Sourceware: Summary of GDB [Accessed 21 November 2023])
Videos
What a computer program is
Programming languages
Integrated development environment (IDE)
Debugging
Source code
Board review style question #1
Which of the following computer tools can best enhance the readability of source code and removal of bugs in a program?
- Emacs
- GNU debugger
- Integrated development environment (IDE)
- Python
Board review style answer #1
C. Integrated development environment (IDE). An integrated development software is a software toolset that facilitates code writing due to its possession of the following features: intelligent code completion, automatic formatting to match language requirements, color coding and keyboard highlighting to ease readability of the code (OpenLM: What Is An Integrated Development Environment (IDE)? [Accessed 21 November 2023]). In addition to the features above, IDEs can be used for debugging either as standalone products or coupled with other development software (XenonStack: Integrated Development Environment (IDE) - The Complete Guide [Accessed 21 November 2023]). Answer B is incorrect because while the GNU debugger can function as a debugger, it does not enhance readability of a code as much as an IDE. Answer A is incorrect because Emacs are text editors that can be integrated into a GNU debugger software to enhance its visual environment. Answer D is incorrect because Python is a programming language that can be used for data analysis, machine learning and web development.
Comment Here
Reference: Introduction to programming
Comment Here
Reference: Introduction to programming
Board review style question #2
Which of the following refers to the ability of a programming software to run easily on a range of computer hardware and operating systems (OS)?
- Maintainability
- Portability
- Readability
- Reliability
Board review style answer #2
B. Portability. A computer software program is said to be portable if it requires very low effort to make it run on different platforms (TechTarget: What Is Software Portability? [Accessed 21 November 2023]). Answer D is incorrect because reliability refers to how often the results of a program are correct. Answer C is incorrect because readability of a program is the ease with which a human reader can understand its purpose, control flow and operate its source code. Answer A is incorrect because maintainability refers to the ease with which a program can be modified by its present or future developers.
Comment Here
Reference: Introduction to programming
Comment Here
Reference: Introduction to programming