101.school
CoursesAbout
Search...⌘K
Generate a course with AI...

    Intro to computers and programming

    Receive aemail containing the next unit.
    • Computer Basics
      • 1.1Overview of Computers
      • 1.2Understanding Operating Systems
      • 1.3Understanding Computer Networks
    • Introduction to Programming
      • 2.1What is Programming?
      • 2.2Basics of a Program
      • 2.3How a Program Runs on a Computer
    • Introduction to Coding
      • 3.1Writing your First Code
      • 3.2Language of Coding
      • 3.3Common Coding Practices
    • Scripting Basics
      • 4.1What is Scripting?
      • 4.2Difference Between Coding and Scripting
      • 4.3First Look at Shell Scripts
    • Basics of a Programming Language
      • 5.1Understanding Syntax
      • 5.2Basic Constructs – Loops & Conditionals
      • 5.3Functions and Procedures
    • Intermediate Programming
      • 6.1Arrays and Lists
      • 6.2File Handling
      • 6.3Error Handling
    • Introduction to Object Oriented Programming
      • 7.1Principles of Object Oriented Programming
      • 7.2Classes and Objects
      • 7.3Inheritance and Encapsulation
    • Practical Uses of Scripting
      • 8.1Process Automation with Scripts
      • 8.2Using Scripts for Data Manipulation
      • 8.3Web Scraping with Scripts
    • Algorithms and Data Structures
      • 9.1Basics of Algorithms
      • 9.2Introduction to Data Structures
      • 9.3Practical Uses of Data Structures
    • Code Efficiency
      • 10.1Writing Efficient Code
      • 10.2Debugging and Testing
      • 10.3Code Performance Analysis
    • Managing Code Project
      • 11.1Understanding Version Control
      • 11.2Use of GitHub for Project Management
      • 11.3Collaborative Coding Practices
    • Real World Coding Examples
      • 12.1Review and Analysis of Real World Code
      • 12.2Case Study—Use of Code in Solving Real World Problems
      • 12.3Building and Presenting a Mini Coding Project
    • Future Learning and Wrap Up
      • 13.1Essentials for Advanced Learning
      • 13.2Overview of Other Programming Languages
      • 13.3Course Wrap Up and Next Steps

    Introduction to Coding

    Common Coding Practices

    In this unit, we will delve into the common coding practices that every programmer should know. These practices are essential for writing clean, readable, and maintainable code.

    Importance of Code Readability and Maintainability

    Code readability refers to how easy it is for a human to understand a program's code. Readable code is important because it helps others understand your code, which is crucial when working in a team or when you need to revisit your code in the future.

    Maintainability, on the other hand, refers to how easy it is to extend and fix the code. Maintainable code is modular, uses meaningful names for variables and functions, and is well-documented.

    Coding Standards and Style Guides

    Coding standards are a set of guidelines, rules, and specifications used when writing code. These standards ensure that the code is high quality, error-free, and readable. They can include rules on how to name variables, how to use indentation, how to write comments, etc.

    Style guides are specific to programming languages and provide a set of rules and best practices on how to write code in that language. For example, Python has a style guide called PEP 8 which provides guidelines on how to format Python code.

    Don't Repeat Yourself (DRY)

    The DRY principle is a fundamental concept in software development. It states that "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." In simpler terms, it means that you should never have two pieces of identical code in two different places. Instead, that code should be abstracted into a function or method and called when needed. This makes the code easier to maintain and less prone to errors.

    Error Handling and Exceptions

    Error handling is an essential part of coding. It involves writing code to handle potential errors that may occur when the program is running. This can include checking for invalid input, handling failed network connections, or dealing with unavailable resources.

    Exceptions are events that occur during the execution of programs that disrupt the normal flow of instructions. In many programming languages, exceptions are handled in blocks of code specifically designed for them. This allows the programmer to control the program flow and the handling of exceptional situations.

    By understanding and implementing these common coding practices, you can ensure that your code is clean, efficient, and maintainable. This not only makes your code easier to understand but also makes it less prone to errors and easier to debug.

    Test me
    Practical exercise
    Further reading

    Hey there, any questions I can help with?

    Sign in to chat
    Next up: What is Scripting?