Skip to content

Files

Latest commit

ab86e59 · Aug 12, 2023

History

History
672 lines (649 loc) · 31.8 KB

soft-dev-notes.md

File metadata and controls

672 lines (649 loc) · 31.8 KB

Software Development Notes

General

What is Agile in regards to software development

Summary:
Agile is a structured and iterative approach to project management and product development. It recognizes the volatility of product development, and provides a methodology for self-organizing teams to respond to change without going off the rails.


More Information:

When it comes to implementing Agile and DevOps, kanban and scrum provide different ways to do so.

It's easy to point out the differences between scrum practices and kanban practices, but that's just at the surface level. While the practices differ, the principles are largely the same. Both frameworks will help you build better products (and services) with fewer headaches.

Agile is a structured and iterative approach to project management and product development. It recognizes the volatility of product development, and provides a methodology for self-organizing teams to respond to change without going off the rails.

What is Kanban

Kanban is all about visualizing your work, limiting work in progress, and maximizing efficiency (or flow). Kanban teams focus on reducing the time a project takes (or user story) from start to finish. They do this by using a kanban board and continuously improving their flow of work.

Kanban helps visualize your work, limit work-in-progress (WIP) and quickly move work from "Doing" to "Done.". Kanban is great for teams that have lots of incoming requests that vary in priority and size. Whereas scrum processes require high control over what is in scope, kanban let’s you go with the flow. Let’s take a look at the same five considerations to help you decide.

Kanban cadence Kanban is based on a continuous workflow structure that keeps teams nimble and ready to adapt to changing priorities. Work items—represented by cards— are organized on a kanban board where they flow from one stage of the workflow(column) to the next. Common workflow stages are To Do, In Progress, In Review, Blocked, and Done. But that’s boring. The best part of kanban is making custom columns for how your team works. My team ships content, so our columns(simplified) go from Backlog, to Prioritized, to Outlines Ready, to Writing, Designing, Technical Review, and Shipped. Our board helped us learn that we ship about one piece of content per week, and where our bottlenecks are (looking at the Technical Review!).

Release methodology In kanban, updates are released whenever they are ready, without a regular schedule or predetermined due dates. In theory, kanban does not prescribe a fixed time to deliver a task. If the task gets completed earlier (or later), it can be released as needed without having to wait for a release milestone like sprint review.

Kanban roles The whole team owns the kanban board. Some teams enlist an agile coach but, unlike scrum, there is no single “kanban master” who keeps everything running smoothly. It’s the collective responsibility of the entire team to collaborate on and deliver the tasks on the board.

Key metrics Lead time and cycle time are important metrics for kanban teams. The deal with the average amount of time that it takes for a task to move from start to finish. Improving cycle times indicates the success of kanban teams. The Cumulative Flow Diagram (CFD) is another analytical tool used by kanban teams to understand the number of work items in each state. CFDs help identify specific bottlenecks that need to be resolved for better throughput. Another way to deal with bottlenecks is through Work In Progress (WIP) limits. A WIP limit caps the number of cards that can be in any one column at one time. When you reach your WIP limit, a tool like Jira Software caps that column, and the team swarms on those items to move them forward.

Change philosophy A kanban workflow can change at any time. New work items can get added to the backlog and existing cards can get blocked or removed based on prioritization. Also, if the team capacity changes, WIP limit can be recalibrated and work items adjusted accordingly. It’s all about being flexible in kanban.

What is Scrum

Scrum teams commit to completing an increment of work, which is potentially shippable, through set intervals called sprints. Their goal is to create learning loops to quickly gather and integrate customer feedback. Scrum teams adopt specific roles, create special artifacts, and hold regular ceremonies to keep things moving forward. Scrum is best defined in The Scrum Guide.

With scrum, your team promises to ship some valuable increment of work by the end of each sprint. Scrum is built on empiricism, focusing on small increments of work that will help you learn from your customers and better inform what you do next. Here's how it breaks down:

Scrum cadence: Scrum moves fast, with sprints that usually last between one to four weeks, which have clear start and finish dates. The short time frame forces complex tasks to be split into smaller stories and help your team learn quickly. A key question is this: Can your team ship useable code that fast? Sprints are punctuated by sprint planning, sprint review, and retrospective meetings and peppered with daily scrum (standup) meetings. These scrum ceremonies are lightweight and run on a continuous basis.

Scrum roles: Scrum has three clearly defined roles.

  • The product owner advocates for the customer, manages the product backlog, and helps prioritize the work done by the development team.
  • The scrum master helps the team stay grounded in the scrum principles.
  • The development team chooses the work to be done, delivers increments, and demonstrates collective accountability.
Who manages the scrum team? Well, nobody. Scrum teams are self-organizing and everyone is equal, despite having different responsibilities. The team is united by the goal of shipping value to customers.

Common metrics: Scrum metrics are data points scrum teams can use to improve efficiency and effectiveness. They can inform decision-making and help teams become more efficient in planning and execution. During the sprint planning phase, teams can use metrics such as sprint goals, team velocity, team capacity, and type of work. During stand-ups, teams can also benefit from measuring progress towards sprint goals, reviewing a sprint burndown, understanding workload distribution, and more.

Change philosophy: Teams strive to understand how much they can accomplish within their sprint time boundaries. They commit to its delivery within a sprint. However, scrum teams can receive customer feedback that encourages them to pivot and change the sprint to deliver the most customer value. During the sprint retrospective, scrum teams should discuss how to limit change in the future, as changes put the potentially shippable increment at risk. If a team frequently changes scope mid-sprint, it may signify work was selected that isn’t adequately understood. It could also mean the team has operational/unplannable work that interferes with the plan.

Kanban VS Scrum Comparison

  • Kanban is continuous, fluid and visualized process whereas Scrum is short and structured, where work is shipped during fixed intervals known as sprints.
  • Kanban is less structured compared to other frameworks like Scrum.
  • Kanban is more visualized way of managing the development process
  • Kanban has fewer meetings and formal roles compared to other frameworks like Scrum.
  • Scrum is suggested for larger team for better management, while Kanban is suggested for smalled developer teams.

Programming

What are static typed(or simply typed) programming languages?

In static typed languages the variable type is know at compilation time instead of run time.

Some examples of static programming languages:

  • C
  • C++
  • Java
Expressions and Statements

Expressions

An expression is anything that results in a value(even if the value is None). Basically, any sequence of literals so, you can say that a string, integer, list, etc. are all expressions.

Statements

Statements are instructions executed by the interpreter like variable assignments, for loops and conditionals (if-else).

What is Object Oriented Programming?

Object-Oriented Programming (OOP) is a programming paradigm in computer science that relies on the concept of classes and objects.It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects. There are many object-oriented programming languages, including JavaScript, C++, Java, and Python.

A class is an abstract blueprint that creates more specific, concrete objects. Classes often represent broad categories, like Car or Dog that share attributes. These classes define what attributes an instance of this type will have, like color, but not the value of those attributes for a specific object.

Classes can also contain functions called methods that are available only to objects of that type. These functions are defined within the class and perform some action helpful to that specific object type.

Class templates are used as a blueprint to create individual objects. These represent specific examples of the abstract class, like myCar or goldenRetriever. Each object can have unique values to the properties defined in the class.

Benefits of OOP for software engineering

  • OOP models complex things as reproducible, simple structures.
  • Reusable, OPP objects can be used across programs.
  • Polymorphism allows for class-specific behaviour.
  • Easier to debug, classes often contain all applicable information to them.
  • Securely protects sensitive information through encapsulation.

Source
educative.io - Object Oriented Programming
Object Oriented Programming - Classes

In a nutshell, classes are essentially user-defined data types. Classes are where we create a blueprint for the structure of methods and attributes. Individual objects are instantiated from this blueprint.

Classes contain fields for attributes and methods for behaviors. In our Dog class example, attributes include name & birthday, while methods include bark() and updateAttendance().

Object Oriented Programming - Objects

Objects are, unsurprisingly, a huge part of OOP! Objects are instances of a class created with specific data.

Object Oriented Programming - Attributes

Attributes are the information that is stored. Attributes are defined in the Class template. When objects are instantiated, individual objects contain data stored in the Attributes field.

The state of an object is defined by the data in the object’s attributes fields. For example, a puppy and a dog might be treated differently at a pet camp. The birthday could define the state of an object and allow the software to handle dogs of different ages differently.

Object Oriented Programming - Methods

Methods represent behaviors. Methods perform actions; methods might return information about an object or update an object’s data. The method’s code is defined in the class definition.

When individual objects are instantiated, these objects can call the methods defined in the class. In the code snippet below, the bark method is defined in the Dog class, and the bark() method is called on the Rufus object.

Methods often modify, update or delete data. Methods don’t have to update data though. For example, the bark() method doesn’t update any data because barking doesn’t modify any of the attributes of the Dog class: name or birthday.

The updateAttendance() method adds a day the Dog attended the pet-sitting camp. The attendance attribute is important to keep track of for billing Owners at the end of the month.

Methods are how programmers promote reusability and keep functionality encapsulated inside an object. This reusability is a great benefit when debugging. If there’s an error, there’s only one place to find it and fix it instead of many.

The underscore in _attendance denotes that the variable is protected and shouldn’t be modified directly. The updateAttendance() method changes _attendance.

Four Principles of OOP

The four pillars of object-oriented programming are:

  • Inheritance: child classes inherit data and behaviours from the parent class.
  • Encapsulation: containing information in an object, exposing only selected information.
  • Abstraction: only exposing high-level public methods for accessing an object.
  • Polymorphism: many methods can do the same task.
Inheritance

Inheritance allows classes to inherit features of other classes. Put another way, parent classes extend attributes and behaviors to child classes. Inheritance supports reusability.

If basic attributes and behaviors are defined in a parent class, child classes can be created, extending the functionality of the parent class and adding additional attributes and behaviors.

For example, herding dogs have the unique ability to herd animals. In other words, all herding dogs are dogs, but not all dogs are herding dogs. We represent this difference by creating a child class HerdingDog from the parent class Dog, and then adding the unique herd() behavior.

The benefits of inheritance are programs can create a generic parent class and then create more specific child classes as needed. This simplifies programming because instead of recreating the structure of the Dog class multiple times, child classes automatically gain access to functionalities within their parent class.

Note: Parent classes are also known as superclasses or base classes. The child class can also be called a subclass, derived class, or extended class.

In JavaScript, inheritance is also known as prototyping. A prototype object is a template for another object to inherit properties and behaviors. There can be multiple prototype object templates, creating a prototype chain. This is the same concept as the parent/child inheritance. Inheritance is from parent to child. In our example, all three dogs can bark, but only Maisel and Fluffy can herd. The herd() method is defined in the child HerdingDog class, so the two objects, Maisel and Fluffy, instantiated from the HerdingDog class have access to the herd() method. Rufus is an object instantiated from the parent class Dog, so Rufus only has access to the bark() method.

Encapsulation

Encapsulation means containing all important information inside an object, and only exposing selected information to the outside world. Attributes and behaviors are defined by code inside the class template. Then, when an object is instantiated from the class, the data and methods are encapsulated in that object. Encapsulation hides the internal software code implementation inside a class and hides the internal data of inside objects.

Encapsulation requires defining some fields as private and some as public.

  • Private/Internal Interface: methods and properties accessible from other methods of the same class.
  • Public / External Interface: methods and properties accessible from outside the class.

Encapsulation adds security. Attributes and methods can be set to private, so they can’t be accessed outside the class. To get information about data in an object, public methods & properties are used to access or update data.

This adds a layer of security where the developer chooses what data can be seen on an object by exposing that data through public methods in the class definition.

Within classes, most programming languages have public, protected, and private sections. The public section is the limited selection of methods accessible from the outside world or other classes within the program. Protected is only accessible to child classes. Private code can only be accessed from within that class. To go back to our dog/owner example, encapsulation is ideal so owners can’t access private information about other people’s dogs.

Note: JavaScript has private and protected properties and methods. Protected Fields are prefixed with a _; private fields are prefixed with a #. Protected fields are inherited. Private ones aren’t.

Encapsulating & updating data: Since methods can also update an object’s data, the developer controls what values can be changed through public methods. This allows us to hide important information that should not be changed from phishing and the more likely scenario of other developers mistakenly changing important data.

Instead, developers create public methods that allow other developers to call methods on an object. Ideally, these public methods come with documentation for external developers. The benefits of encapsulation are summarized here:

  • Adds security: Only public methods and attributes are accessible from the outside
  • Protects against common mistakes: Only public fields & methods are accessible, so developers don’t accidentally change something dangerous
  • Protects IP: Code is hidden in a class; only public methods are accessible by the outside developers
  • Supportable: Most code undergoes updates and improvements
  • Hides complexity: No one can see what’s behind the object’s curtain!
Abstraction

Abstraction is an extension of encapsulation that uses classes and objects, which contain data and code, to hide the internal details of a program from its users. This is done by creating a layer of abstraction between the user and the more complex source code, which helps protect sensitive information stored within the source code.

  • Reduces complexity and improves code readability
  • Facilitates code reuse and organization
  • Data hiding improves data security by hiding sensitive details from users
  • Enhances productivity by abstracting away low-level details

Abstraction can also be explained using cars. Think of how a driver operates a vehicle using only the car’s dashboard. A driver uses the car’s steering wheel, accelerator, and brake pedals to control the vehicle. The driver does not have to worry about how the engine works or what parts are used for each movement. This is an abstraction – only the important aspects necessary for a driver to use the car are visible. Similarly, data abstraction allows developers to work with complex information without worrying about its inner workings. In this way, it helps to improve code quality and readability.

Abstraction also serves an important security role. By only displaying selected pieces of data and only allowing data to be accessed through classes and modified through methods, we protect the data from exposure. To continue with the car example, you wouldn’t want an open gas tank while driving a car.

The benefits of abstraction are summarized below:

  • Simple, high-level user interfaces
  • Complex code is hidden
  • Security
  • Easier software maintenance
  • Code updates rarely change the abstraction
Polymorphism

Polymorphism means designing objects to share behaviors. Using inheritance, objects can override shared parent behaviors with specific child behaviors. Polymorphism allows the same method to execute different behaviors in two ways: method overriding and method overloading.

Method Overriding

Runtime polymorphism uses method overriding. In method overriding, a child class can implement differently than its parent class. In our dog example, we may want to give TrackingDog a specific type of bark different than the generic dog class.

Method overriding could create a bark() method in the child class that overrides the bark() method in the parent Dog class.
Method Overloading

Compile Time polymorphism uses method overloading. Methods or functions may have the same name but a different number of parameters passed into the method call. Different results may occur depending on the number of parameters passed in.

The benefits of Polymorphism are:

  • Objects of different types can be passed through the same interface
  • Method Overriding
  • Method Overloading.
Compiler VS Interpreter
Compiler:

"A compiler is a translator used to convert high-level programming language to low-level programming language. It converts the whole program in one session and reports errors detected after the conversion. Compiler takes time to do its work as it translates high-level code to lower-level code all at once and then saves it to memory."

Interpreter:

"Just like a compiler, is a translator used to convert high-level programming language to low-level programming language. It converts the program line by line and reports errors detected at once, while doing the conversion. With this, it is easier to detect errors than in a compiler."

SOLID Design Principles
SOLID Design Principles are about:
  • Makes it easier to extend the functionality of the system.
  • Makes the code more readable and easier to maintain
SOLID stands for:
  • Single Responsibility - A class, module, component, entity, etc., should have one responsibility reason to change. It was edited by Robert Martin due to wrong understanding of principle
  • Open-Closed - A class should be open for extension, but closed for modification. What this practically means is that you should extend functionality by adding a new code and not by modifying it. Your system should be separated into components so it can be easily extended without breaking everything
  • Liskov Substitution - Any derived class should be able to substitute the its parent without altering its corrections. Practically, every part of the code will get the expected result no matter which part is using it
  • Interface Segregation - A client should never depend on anything it doesn't uses. Big interfaces must be splitted to smaller interfaces if needed
  • Dependency Inversion - High level modules should depend on abstractions, not low level modules
What is YAGNI and DRY?
YAGNI

YAGNI stands for You aren't gonna need it and it means that you mus only add functionality that will be used. No need to keep functionality that is not really needed.

DRY

DRY stands for Don't Repeat Yourself.Actually it means that you shouldn't duplicate logic and use functions/classes instead. But this must be done smartly and pay attention to the domain logic. Same code lines don't always mean duplication!

The four pillars of Object Oriented Programming
  • Abstraction - you don't need to know how this class implemented. You need to know what functionality does it provide (interface) and how to use it
  • Encapsulation - keep fields for class purposes private (or protected) and provide public methods if needed. We must keep the data and code safe within the class itself
  • Inheritance - gives ability to create class that shares some of attributes of existing classes
  • Polymorphism - same methods in different contexts can do different things. Method overloading and overriding are some forms of polymorphism
Recursion Explanation

Recursion is the process (or strategy), when function calls itself. It has recursive case and exit case. In recursive case we call function again, in exit case we finish function without calling it again. If we don't have exit case - function will work infinite, until memory overload or call stack limit.

Example of recursive code:

The Fibonacci Sequence