Programming Concepts for Beginners

Computers operate at a low level of bits and bytes that are difficult for humans to understand. To program a computer, we use higher level languages that are closer to how humans think and reason. These programming languages make it easier to us to instruct what a computer should do.

While there are dozens of programming languages, all of them share a number of basic constructs. All languages must have constructs to do basic things such as initializing data, adding numbers, storing data, checking for certain conditions, repeating some tasks, and so on. This article introduces these basic concepts to someone new to programming.

The actual syntax of each language may be different. There are also different programming paradigms. These are not covered in this article.


  • What's the difference between hardware and software?

    Hardware refers to a physical device. For example, a computer and its peripherals such as monitor, keyboard, and mouse are all part of the hardware. Software is a set of instructions that are executed step by step to perform a specific task. Software is otherwise called code or program.

    Although we think of desktops and laptops as computing hardware, any device that executes a program can be considered a computing device. Thus, digital cameras and smartphones contain both hardware and software. Some devices such as Wi-Fi routers and firewalls are called networking devices because of their specialized functions, but these too contain both hardware and software.

    We may say that hardware is tangible and software is not. Some say that hardware is about atoms and software is about bits. This is because software is made of ones and zeros, which are the values that a bit can take.

    Computing hardware without software does nothing and is therefore useless. Software needs hardware to do its job. Thus, both are needed for delivering a useful application.

  • Why do we need programming languages?
    Conversion of high-level code into machine code. Source: Adapted from Peter D 2019.
    Conversion of high-level code into machine code. Source: Adapted from Peter D 2019.

    Computers have been designed to work with ones and zeroes. They can't understand human languages. However, writing a program with ones and zeros is extremely hard for human programmers. Programming languages have therefore been invented for this reason.

    Programs are written in high-level languages such as C, Java or Python. Such languages are independent of the hardware architecture on which they are meant to execute. This has the added advantage that the same program can execute on different hardware. There are tools called compilers or interpreters that translate high-level code into lower level instructions.

    It's possible to write programs using hardware-specific instructions called assembly-level languages. In fact, compilers output assembly code. Assemblers translate them into machine code of ones and zeroes. Hand-crafted assembly code may be more optimized code (in terms of memory or speed). The trade-off is that such code can't be reused across different hardware architectures.

  • What are the basic constructs of a programming language?
    Basic constructs of programming. Source: Devopedia 2019.
    Basic constructs of programming. Source: Devopedia 2019.

    Here are some basic constructs of any language:

    • Variables: These are names for easy storage and access of data. A program is essentially about manipulating and storing data.
    • Expressions: Data needs to be manipulated and expressions involving mathematical operations are used to achieve this.
    • Assignments: The output of an expression, if needs to be stored into a variable, is saved using an assignment.
    • Conditionals: Program execution sometimes involves branching based on conditions. If some condition is true, do one thing; if not true, do something else.
    • Loops: When something has to be repeated a number of times, loops are useful. Loops typically have well-defined exit conditions.

    For example, balance is a variable to refer to a person's bank account balance. The expression newbalance = balance - withdrawal calculates new balance from two variables and assigns the result to another variable. The condition if (balance > 0) checks if the balance is positive. To calculate the sum of all withdrawals, stored in all_withdrawals, we would use a loop such as for i in all_withdrawals: total_withdrawals += i, assuming that total_withdrawals is initialized to zero.

  • How is data stored and manipulated during program execution?

    Content stored in memory is of two types: instructions that are executed by the computer; and data that are accessed and manipulated by instructions. Using memory addresses, instructions point to relevant data that need to be processed. Variables are simply names that translate to memory addresses where their values are stored.

    Consider the statement, a = a + b, where "a" and "b" are two variables. In algebra, this equation implies that "b" must be zero. In computing, this is not an equation but an assignment statement. The right side is evaluated and the result is assigned to the left side. For example, if "a" and "b" start with values 3 and 4, after this execution, "a" will contain the value 7 while "b" will remain unchanged. In this example, we're are not concerned with preserving the original value of "a" and hence we overwrite it with the recent result. To preserve the original value, we can introduce another variable (memory location), c = a + b.

  • What are the common types of data?
    Data types in some languages. Source: Kemp 1993, table 3.
    Data types in some languages. Source: Kemp 1993, table 3.

    Numeric data is mostly either an integer or a decimal. Programmers can specify how much memory they wish to allocate to number variables using type names such as short, long, float, or double. More memory implies a bigger range of values.

    Among the non-numeric types is the character type. A sequence of characters form a string. Thus, "Hello World" is a string of characters, enclosed in quotes. To store the result of conditionals, we have boolean types that have only two valid values: true or false.

    It's common to deal with a sequence of data values. For example, we wish to store the names of all students in a single variable. We can do this by creating a list or array data type. Each item of the list can be accessed using an index. In computing, indices often (but not always) start with zero.

    Since arrays accept only integer indices, we can create an associative array (also called map or dictionary) that accept strings as indices. This is useful when storing key-value pairs.

  • What are conditional expressions?
    Boolean logic on combinations of A and B with Q as the result. Source: Astels 2018.
    Boolean logic on combinations of A and B with Q as the result. Source: Astels 2018.

    Any expression that yields a boolean result of either true or false can be considered a conditional expression. For example, balance > 0 is a numerical comparison that has a boolean result; lastname == 'Smith' is a string comparison that has a boolean result.

    The purpose of such expressions is to do branching in code. For example, if account balance is positive, allow withdrawal; else, show customer an error message.

    Conditional expressions can be combined using logical operators. The most common of these are the "and" and "or" operators. For example, firstname == 'John' and lastname == 'Smith' can be true only for John Smith. Another example is balance <= 0 or accountDisabled where accountDisabled is of boolean type. If either condition is true, we disallow account withdrawal. A value can be inverted using "not" operator.

    When combining multiple boolean expressions, Boolean logic is used to determine the final result.

  • What are the different ways of implementing loops?
    There are three main looping constructs. Source: mbajada95 2017.
    There are three main looping constructs. Source: mbajada95 2017.

    There are three main looping constructs:

    • do-while: One or more statements are executed, then a condition is checked. If condition remains true, the next iteration of the loop is entered. If condition is false, loop is exited.
    • while: Similar to do-while, but the condition if checked first. This implies that statements within the loop may not be executed even once if the condition starts as false. This is unlike do-while where the statements execute at least once.
    • for: This starts with an initialization, such as initializing a loop counter. Then the condition if checked, and if true, loop statements are executed. Next, the loop counter is incremented before attempting the next iteration.

    Statements within the loop can be any valid programming construct. They can contain their own loops, resulting in nested loops. They can contain conditions, which if false, can help us exit the loop completely or skip following statements and move to the next iteration. These are usually called break and continue loop statements respectively.

  • What are comments in the context of programming?

    A programmer may write excellent code but he or she is most likely not the only person reading that code. Other members of the development team and managers will read the code. Code will be maintained and possibly improved by others. To make it easier for others to understand the code, it's good practice to write comments. The purpose of comments is to explain what the code does, particularly those parts that may not be obvious.

    Comments are meant for humans and are ignored by compilers and interpreters. In other words, comments don't affect program execution. However, some tools process comments with the goal of automatically generating software documentation. This documentation is again useful for only humans. Some tools use comments to give hints and warnings to programmers while they write code. This enables programmers to catch problems early.

  • What's the purpose of functions, classes and methods?
    Illustrating a function in Python. Source: Software Carpentry Foundation 2016.
    Illustrating a function in Python. Source: Software Carpentry Foundation 2016.

    Modern applications are often complex, running into thousands or even millions of lines of code. The solution is to break up a large program into small manageable units, each of which connects with other units via well-defined interfaces.

    A function, also called a subroutine or a procedure, is a block of code that encapsulates a specific functionality. It takes in input parameters, executes and returns an output. Thus, functions can be called from other parts of code with different inputs. They promote code reuse. For example, float add(float a, float b) is a function that takes two decimal numbers, adds them up and return the result as a decimal number. Calling add(2.3, 1.2) should return 3.5 as result.

    A class encapsulates not only code but also data and expose well-defined interfaces. Functions encapsulated within classes are called methods. Consider Rectangle as a class with two data attributes length and breadth. One of its methods could be float area() that returns the rectangle's area as a decimal number.

  • What tools does a programmer need to program a computer?

    To write code, the programmer needs at least a text editor. A better approach is to use an Integrated Development Environment (IDE). IDEs provide a useful set of features out of the box. These include language syntax highlighting, flagging programming errors, powerful code search, code formatting, and many more.

    Code must be compiled or interpreted into their lower level instructions. Thus, programmers need to install compilers or interpreters. For example, C and C++ are compiled whereas JavaScript and Python are interpreted.

    What if the program doesn't work as expected during execution? Where could be the problem? This is where a debugger becomes a useful. A debugger can help us inspect the value of a variable step by step during program execution. We can also ask the program to break at a specific line of code.

    Code undergoes changes. To keep track of who has changed what, a Version Control System (VCS) such as Git is essential. In coding projects, it's common to use many other tools for planning, scheduling, tracking progress, or recording issues.



Ada Lovelace translates a French article written by Luigi Menabrea on the Analytical Engine invented by Charles Babbage. She adds extensive notes to the translation detailing how the Engine might be instructed by a sequence of operations to solve problems. She is often regarded as the "world's first programmer".


George Boole publishes The Mathematical Analysis of Logic. This shows the rules for manipulating expressions containing True and False values. This later influences the design of digital circuits and programming with boolean data types.

ENIAC is programmed using wires and switches. Source: Calimero 2014.
ENIAC is programmed using wires and switches. Source: Calimero 2014.

At the Moore School of Electrical Engineering of the University of Pennsylvania, work begins on ENIAC. Unlike earlier electromechanical computers, ENIAC is electronic (no moving parts) and therefore more than thousand times faster. Possibly inspired by telephone switchboards, it's programmed using panel wiring and switches. It uses 18,000 vacuum tubes and weighs 30 tons.

An early flowchart to represent program flow. Source: Goldstine and Neumann 1947, fig. 7.10.
An early flowchart to represent program flow. Source: Goldstine and Neumann 1947, fig. 7.10.

Herman H. Goldstine and John von Neumann invent a graphical method to represent the execution flow of a program. This is called a flow diagram, later named as flowchart.


Mathematician Grace Hopper completes A-0 compiler that allows the use of English-like words instead of numbers to program a computer. This marks the beginning of the move towards high-level programming languages and compilers.


Edgser Dijkstra publishes an article titled Go To Statement Considered Harmful. Goto is a programming construct that allows execution to jump to another part of the code. Dijkstra recognizes that excessive use of goto can result in confusing code. The alternative is to adopt structured or procedural programming. In modern programming languages, goto is not quite as bad since jumps are restricted.


Bjarne Stroustrup publishes The C++ Programming Language. This makes C++ the dominant object-oriented language to tackle complex applications.


This decade sees the invention of a number of high-level languages: Python (1991), Java (1994), and JavaScript (1995). Python and JavaScript are interpreted languages. Java is compiled to bytecode, which is then executed by the Java Virtual Machine.


  1. Al-mulla, Mohammed R. 2017. "Selection/Branching, Boolean Expressions & Loops." Computer Programming I, March 04. Accessed 2019-06-14.
  2. Astels, Dave. 2018. "Boolean Logic." Adafruit, March 22. Updated 2019-06-14. Accessed 2019-06-14.
  3. Calimero. 2014. "Computers History, Marcin Wichary, ENIAC cables." Wallpaper Up, January 17. Accessed 2019-06-14.
  4. Computer History Museum. 2019. "Timeline of Computer History: Software & Languages." Accessed 2019-06-14.
  5. Computer History Museum. 2019b. "Ada Lovelace." Accessed 2019-06-14.
  6. Computer Hope. 2018. "What are the differences between hardware and software?" Computer Hope, November 13. Accessed 2019-06-14.
  7. Dietrich, Erik. 2017. "Code Documentation and Code Comments Aren’t the Same Thing." Blog, SubMain Software, September 26. Accessed 2019-06-14.
  8. Goldstine, Herman H. and John von Neumann. 1947. "Planning and Coding of Problems for an Electronic Computing Instrument." Part II, Volume 1-3, The Institute for Advanced Study, Princeton. Accessed 2019-06-14.
  9. Gramshackle. 2017. "Go To Statement Did Nothing Wrong." Hacker Noon, November 28. Accessed 2019-06-14.
  10. Holowczak, Richard. 2019. "Programming Concepts: A Brief Tutorial for New Programmers." Accessed 2019-06-14.
  11. Karlgaard, Rich. 2013. "Atoms Versus Bits: Where To Find Innovation." Forbes, January 23. Accessed 2019-06-14.
  12. Kemp, Karen. 1993. "Environmental Modeling with GIS: A Strategy for Dealing with Spatial Continuity." Technical Report 93-3, NCGIA, University of California, Santa Barbara, May. Accessed 2019-06-14.
  13. Matuszek, David. 2009. "Assignment statements." Java Syntax, October 26. Accessed 2019-06-14.
  14. Page, Trevor. 2012. "Programming 101 – The 5 Basic Concepts of any Programming Language." June 30. Accessed 2019-06-14.
  15. Paul, Javin. 2018. "10 Useful Tools and Libraries for Programmer and IT Professionals." Hacker Noon, September 25. Accessed 2019-06-14.
  16. Peter D. 2019. "What are translators?" Computing Nerds. Accessed 2019-06-14.
  17. Phpenthusiastic. 2019. "Classes, objects, methods and properties." Accessed 2019-06-14.
  18. Singh, Avi. 2016. "Conditional Code Branching in Power BI Query: if…then…else => then…else…if." Medium, May 16. Accessed 2019-06-14.
  19. Software Carpentry Foundation. 2016. "Creating Functions." Programming with Python, Software Carpentry, on GitHub, July 19. Accessed 2019-06-14.
  20. Tan, Shawn. 2010. "Instruction vs Data." Technical Intercourse, July 01. Accessed 2019-06-14.
  21. Visual Studio Docs. 2019. "First look at the Visual Studio Debugger." Visual Studio Docs, Microsoft, April 08. Updated 2019-05-15. Accessed 2019-06-14.
  22. W3C. 2019. "PHP 5 Arrays." Accessed 2019-06-14.
  23. Walker, Aaron. 2018. "What is an IDE: Integrated Development Environments for Beginners in 2019." G2 Crowd, November 19. Accessed 2019-06-14.
  24. Wikipedia. 2019. "Subroutine." Wikipedia, February 21. Accessed 2019-06-14.
  25. Wolfe, John. 2018. "A Brief History of Python." Medium, March 05. Accessed 2019-06-14.
  26. de St. Germain, H. James. 2008a. "Commenting." School of Computing, University of Utah. Accessed 2019-06-14.
  27. de St. Germain, H. James. 2008b. "Data Types." School of Computing, University of Utah. Accessed 2019-06-14.
  28. freeCodeCamp. 2019. "Assembly Language." Guide, Computer Science, freeCodeCamp. Accessed 2019-06-14.
  29. mbajada95. 2017. "Types of Loops in Java." All About Programming 2017, May 16. Accessed 2019-06-14.

Further Reading

  1. Page, Trevor. 2012. "Programming 101 – The 5 Basic Concepts of any Programming Language." June 30. Accessed 2019-06-14.
  2. Holowczak, Richard. 2019. "Programming Concepts: A Brief Tutorial for New Programmers." Accessed 2019-06-14.
  3. Peregoy, Bill. 2018. "A Brief History of Programming." Medium, January 11. Accessed 2019-06-14.
  4. Computer History Museum. 2019. "Timeline of Computer History: Software & Languages." Accessed 2019-06-14.

Article Stats

Author-wise Stats for Article Edits

No. of Edits
No. of Chats

Cite As

Devopedia. 2019. "Programming Concepts for Beginners." Version 3, June 15. Accessed 2023-11-12.
Contributed by
1 author

Last updated on
2019-06-15 17:28:53

Improve this article
  • Programming Language Generations
  • Procedural Programming
  • Object-Oriented Programming
  • Coding Guidelines
  • Naming Conventions
  • Programming Paradigms

Article Warnings

  • In References, replace these sub-standard sources: