Informatics, digital & computational pathology

Artificial intelligence

Introduction to programming



Last author update: 2 January 2024
Last staff update: 2 January 2024

Copyright: 2023, PathologyOutlines.com, Inc.

PubMed Search: Computer programming

Ugochukwu John Jonah, M.B.B.S.
Anil Parwani, M.D., Ph.D., M.B.A.
Page views in 2024 to date: 59
Cite this page: Jonah UJ, Parwani A. Introduction to programming. PathologyOutlines.com website. https://www.pathologyoutlines.com/topic/informaticsprogramming.html. Accessed March 28th, 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)
  • IDEs can be classified into the following categories
    • Multilanguage 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
      • This type of IDE is specifically built to support developers who work on only 1 programming language; it is the opposite of a multilanguage IDE
      • Examples include Jcreator for Java, Idle for Python and CodeLite for C++
Diagrams / tables

Images hosted on other servers:
Most popular programming languages

Most popular programming languages

Brief history of programming
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)
  • 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)
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
  • 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
    • 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)
  • 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
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
  • 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
  • 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
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?

  1. Emacs
  2. GNU debugger
  3. Integrated development environment (IDE)
  4. 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
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)?

  1. Maintainability
  2. Portability
  3. Readability
  4. 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
Back to top
Image 01 Image 02