Programming Foundations
A summary of what I learned while taking the LinkedIn Learning Programming Foundation course series
Hi there, I'm sharing my journey in becoming a software engineer, living, learning, and leveling up one day at a time.
Programming Foundations: Algorithms
An algorithm is a set of step-by-step instructions or rules to solve a problem or accomplish a specific task. It must have a well-defined sequence of steps or instructions.
Characteristics of Algorithms
An algorithm must have a well-defined sequence of steps or instructions.
Input: An algorithm takes some form of input, which could be provided externally or obtained from a previous step or computation.
Output: An algorithm produces a result or output based on the given input and the sequence of steps it follows.
Unambiguity: The instructions or rules of an algorithm should be unambiguous, leaving no room for confusion or multiple interpretations.
Algorithm Complexity
The complexity of an algorithm is the analysis of how the performance of an algorithm scales as the size of its input grows. Time and space complexity are two metrics to measure the efficiency of an algorithm.
Time Complexity: Time complexity measures how the running time of an algorithm grows as the input size increases. Time complexity is typically expressed using big O notation, such as O(1), O(n), O(n^2), etc.
Space Complexity: Space complexity measures the amount of memory or space an algorithm requires to solve a problem based on the input size. Space complexity is also expressed using big O notation, similar to time complexity.
Algorithm Classification
Algorithms could be classified as:
Serial / Parallel
Exact / Approximate
Deterministic / Non-deterministic
Common Algorithms
Search algorithms: Find specific data in a structure ( for example, a substring within a string). Example Binary search
Sorting algorithms: Take a dataset and apply a sort order to it. An example is the Quicksort algorithm
Computational algorithms: Given one set of data, derive another from it ( is a given number a prime?). An example is the Fibonacci Sequence
Collection algorithms: Manipulating or navigating a set of data stored within a particular structure (count specific items, navigate among data elements, filter out unwanted data, etc). An example is the Linear search algorithm
Common Big-O Terms
Notation | Description | Example |
O(1) | Constant time | Looking up a single element in an array |
O(log n) | Logarithmic time | Finding an item in a sorted array with a binary search |
O(n) | Linear time | Searching an unsorted array for a specific value |
O(n log n) | Log-linear time | Complex sorting algorithms like heap sort and merge sort |
O(n2) | Quadratic time | Simple sorting algorithms, such as bubble sort, selection sort, and insertion sort |
Programming Foundations: Data Structures
What are Data Structures?
Data structures are like containers - there's one for every kind of data says Kathryn Hodge. While structures like arrays and queues are sometimes taken for granted, a deeper understanding is vital for any programmer who wants to know what's going on "under the hood" and understand how the choices they've made impact the performance and efficiency of their applications.
Data types represent the kind of values that can be stored and manipulated, they specify the size, format, and range of values that a variable or data item can hold. Hence, data structures are implemented using combinations of data types.
Commonly used data structures
Arrays: a collection of elements of the same data type in a contiguous block of memory. Elements can be accessed and manipulated using their indices.
Linked Lists: A collection of nodes, where each node contains data and a reference (or link) to the next node in the sequence. Linked lists can be singly linked (one reference) or doubly linked (two references).
Stacks: A Last-In-First-Out (LIFO) data structure that allows operations only at one end, typically called the "top." Elements can be added (pushed) or removed (popped) from the top of the stack.
Queues: A First-In-First-Out (FIFO) data structure that allows insertion at one end (rear/enqueue) and removal from the other end (front/dequeue).
Trees: Hierarchical data structures composed of nodes. Each node has a value and references to its child nodes. Trees can be binary (each node has at most two children), binary search trees, AVL trees, etc.
Graphs: Collections of nodes (vertices) connected by edges. Graphs can be directed (edges have a specific direction) or undirected.
Hash Tables: Data structures that use a hash function to map keys to array indices, allowing for efficient key-value pair storage and retrieval.
These are just a few examples, and there are many more data structures available, each with its own advantages and use cases. The choice of a data structure depends on the specific requirements of the problem at hand and the desired operations' efficiency.
Programming Foundations: Databases
I learned that once you get beyond basic programming, you'll need a database.
Why use a database?
Databases provide a reliable and organized way to store and manage large amounts of data, enable data sharing and collaboration, offer security features to protect sensitive information, and allow for efficient querying and analysis of data.
Types of database
There are several types of databases, they include - Graph databases, NoSQL databases, Object-Oriented databases, Document databases, and more, but by far the most common is the Relational database.
Relational Databases (RDBMS): Relational databases organize data into tables with rows and columns, and they use structured query language (SQL) for data manipulation. Examples of popular relational database management systems (RDBMS) include MySQL, PostgreSQL, Oracle Database, and Microsoft SQL Server.
Database Relationships
Tables: In relational databases, data is organized into tables, which consist of rows (also called records or tuples) and columns (also called fields). Each row represents a single entity or record, while each column represents a specific attribute or property of that entity. Tables provide a structured way to store and retrieve data.
Relationships: Relationships define how tables in a database are related. The two common types of relationships are:
One-to-One (1:1): Each record in one table is associated with exactly one record in another table.
One-to-Many: Each record in one table is associated with multiple records in another table.
Many-to-Many: Records in one table can be associated with multiple records in another table, and vice versa. This relationship is typically implemented using a join table.
Database optimization
Database normalization involves breaking down larger tables into smaller, more atomic tables, and applying specific rules called normal forms. Each normal form represents a set of guidelines to ensure data is stored in an organized and efficient manner.
Normalization is typically achieved through a step-by-step process known as normal forms. The most common normal forms are:
First Normal Form (1NF): This ensures that each column in a table contains only atomic (indivisible) values and that each record is unique. No repeating groups or arrays are allowed.
Second Normal Form (2NF): Building on 1NF, 2NF eliminates partial dependencies by ensuring that each non-key column in a table is dependent on the entire primary key.
Third Normal Form (3NF): Going further, 3NF removes transitive dependencies by ensuring that non-key columns are only dependent on the primary key and not on other non-key columns.
Denormalization: Denormalization is the opposite of normalization. It involves intentionally introducing redundancy into a database design to improve query performance.
Database security
Normally we expect a user will enter valid information into a field, but an attacker could try to enter a value that is part of an SQL command to hijack the query we think we're running and change how it works. This is called SQL injection.
Proper design of access control, best practices for interacting with data, safety features offered by programming languages, and proper processing of input data can all help to secure a database against injection attacks.
Programming Foundations: Object-Oriented Design
I learned that all good software starts with a great design. Object-oriented design helps developers plan applications before they write a single line of code, and break down ideas into reusable and maintainable components.
What is object-oriented design?
Object-oriented design is a programming paradigm that organizes software design around objects, which are instances of classes. It focuses on modeling real-world entities as objects, each with its data (attributes) and behavior (methods). The key principles of object-oriented design include encapsulation, inheritance, and polymorphism.
Encapsulation refers to the bundling of data and methods within an object, allowing for controlled access and manipulation. Inheritance enables the creation of new classes based on existing ones, inheriting their properties and behaviors. This promotes code reuse and the establishment of hierarchical relationships between classes. Polymorphism allows objects of different classes to be treated as instances of a common superclass, facilitating flexible and extensible code.
Unified Modeling Language (UML)
Unified Modeling Language (UML) is a standardized visual modeling language used to design, document, and communicate the structure and behavior of software systems. It provides a set of graphical notations that enable software engineers, analysts, and stakeholders to represent and understand various aspects of a system.
Some of the commonly used UML diagrams include:
Class Diagrams: Illustrate the structure of the system by representing classes, their attributes, methods, and relationships
Use Case Diagrams: Depict the interactions between system components (actors) and their use cases, representing the system's functionality from a user's perspective.
Programming Foundations: APIs and Web Services
Communication on the web using web services involves the exchange of data and information between different applications or systems over the internet regardless of the programming languages or platforms you're using.
What is a web service?
A web service is a technology that allows different applications to communicate and exchange data over the internet.
Web services typically follow a client-server architecture, where the client application requests a service from the server application, and the server provides the requested service and sends a response back to the client. This interaction is often based on the principles of service-oriented architecture (SOA).
Sets of protocols and standards are used to enable communication and data exchange. The most common protocols are:
Representational State Transfer (REST): REST is an approach for building web services that use standard HTTP methods like GET, POST, PUT, and DELETE to perform operations on resources identified by URLs, enabling easy communication and data exchange between different applications on the web
Simple Object Access Protocol (SOAP): SOAP is a protocol that uses XML for structuring messages exchanged between web service providers and consumers. It defines rules for message format, message exchange patterns, and protocol bindings.
Programming Foundations: Software Testing/ QA
Quality assurance (QA) engineering can mean many different things to different people
What is Quality Assurance?
In simple terms, quality assurance is a set of activities and processes carried out to ensure that products, services, or processes meet certain standards and are of good quality. It involves checking and verifying that everything is working as intended, following established guidelines, and meeting customer expectations. Quality assurance aims to prevent defects, identify and fix problems early on, and ensure that customers receive reliable and satisfactory products or services.
The role of a QA
The role of a QA can differ based on the individual, the team, and the company they are working for. It depends on the team and what needs to be get done. However, some common roles and responsibilities of a QA engineer include:
Test planning
Test design and execution
Test automation
Defect management
Risk assessment
Documentation
Type of testing QA focuses on
- Box Testing
Black box testing: Black box testing is a testing technique in which the internal structure, design, or implementation details of the system under test are not known to the tester. The QA is responsible for this type of test.
White box testing: White box testing, also known as clear box testing or structural testing, is a testing approach where the tester has full knowledge and visibility into the internal structure, design, and implementation details of the system being tested. The developer is responsible for this type of test.
Gray box testing: Gray box testing is a hybrid testing approach that combines elements of both black box and white box testing. In gray box testing, the tester has partial knowledge of the internal workings of the system. The QA is responsible for this type of test.
Manual Testing: It is a process in software testing where human testers manually execute test cases and interact with the software to validate its behavior and functionality.
UI automation testing: This involves the use of specialized tools and software to automatically test the graphical user interface (GUI) of an application.
Integration testing: In integration testing, individual components or units of the software are combined and tested as a group to identify any issues that may arise from their interactions. The purpose is to uncover errors or defects that may occur at the interfaces between these components.
Performance testing: This is done to benchmark how a system performs under load. It will help ensure an application can scale over time and use. There are a few different types of performance testing:
Loading testing: checks the application's ability to perform under anticipated user load.
Endurance testing: is done to make sure the application can handle the expected load over a long period.
Stress testing: involves testing an application over extreme workloads, and seeing how it handles data processing. The objective is the identify the breaking point of an application.
- Security testing: is performed to reveal flaws or vulnerabilities that can be exposed by users. It looks to expose problems in the application that can cause it to behave unexpectedly or stop it from working.
Conclusion
Sigh, most of these concepts were entirely new to me, but taking the programming foundation LinkedIn course has helped solidify my fundamental knowledge of software engineering.
Mata ne (See you again next time...)