Links #1

Employers ask for a return to the office: LinkedIn data shows how things have quickly shifted in one year: remote-work peaked March 2022 – more than 20 percent of job posting comparing with January 2023 where remote-work was at just 13 percent of job posting. This doesn’t align with employee preferences (according to a poll 60 percent prefer to be on a hybrid model while 34 percent prefer to work from home permanently).

https://www.code4it.dev/architecture-notes/caching-strategies: Caching is a process of storing data in a cache – a temporary storage that facilitates faster access to data. Using caching improves application performance. This article describes a couple of strategies used at a application level (there are more types of caching):  Cache-asideRead-throughWrite-through, and Write-behind. You can learn about the advantages and disadvantages of each strategy and you can find some useful links to some further readings.

Conventional commits

What is it?

The Conventional Commits is a specification that seeks to improve the commit messages. It can be considered as a standard format when writing commit messages.

Why use it?

Because:

  • creates explicit commit history (it describes features, fixes, breaking changes, etc) in order to better communicate the nature of changes to teammates/public/stakeholders and making it easier for contributors by allowing them to explorer a more structured commit history
  • can be processed by automated tools to produce documentation such as release notes or to trigger build and publish processes

Examples

  • fix: patches a bug in the codebase
  • feat: introduces a new feature to the codebase
  • BREAKING CHANGE: introduces a breaking change. It can be a part of commit message of any type
  • refactor: improves the existing code base
  • perf: improves the performance of algorithms or general execution time of the product, but does not fundamentally change an existing feature.
  • build: alters the build system or external dependencies of the product (adding, removing, or upgrading dependencies).
  • chore: includes a technical or preventative maintenance task but it is not tied to any specific feature
  • ci: makes changes to continuous integration or continuous delivery scripts or configuration files.
  • docs: makes changes to the documentation
  • style: makes changes to the code style (semicolon, indentation…)
  • test: add tests to an existing feature

Avatar 2 review

Going to the cinema is one of my favorite things. I like films because they give us an opportunity to experience situations which are hard to take place in real life. They can satisfy our desires and imagination.

The film genre I like the most is science-fiction because it is about ideas, exploration, new universes and cultures. It stimulates imagination. This is what I was expecting to experience when I chose to go see the newly released Avatar movie. And it was exactly what I had expected. James Cameron who has long been considered a pioneer in cinema and who has directed movies like « The Terminator » and « Titanic » didn’t disappoint me.

The first Avatar blew away audiences back in 2009, pioneering 3D and spectacular sci-fi that Cameron delivered. The film takes us to a faraway future on a planet named Pandora, where humans of Earth have set up a mining operation and disrupted the lives of  Na’vi, the humanoid natives of Pandora. In an effort to interact with them, the humans have created an « Avatar’, which is the body of a Na’vi, operated by the consciousness of a human. Jake Sully, a paralyzed former Marine, becomes mobile again through one such Avatar, falls in love with a Na’vi woman and is drawn into a battle for the survival of her world.

After eight delays over many years, the second movie called “Avatar 2 – The Way of Water” was released in December 2022. The action takes place among the underwater reefs of Pandora, where Jake who has lived on Pandora for many years after making the choice to permanently transfer his human consciousness into his Avatar body and become the new leader of the Na’vi people, started a family with Neytiri, a Na’vi native. The family is forced to flee their home because of the colonizing forces of the RDA and their mining operations that have returned to Pandora.

 Avatar 2 explores unknown parts of Pandora and focuses on underwater life. Although it was a bit long (3 hours), the visual effects and details truly make you feel like you are transported to another world. They are absolutely amazing. Definitely, a spectacle worth watching in IMAX 3D. Acting is another big plus, each performer having their physical and vocal traits passed on to the characters. The sounds and the music also add a new dimension to the movie experience.

I found the movie beautiful and emotional, even though it had too many war scenes. I’m tired of bad guys with guns and bombs destroying everything left and right. The plot of the film is simple, there are no plot twists and many reviewers said it was predictable. And it was predictable but, in a manner, we usually expect from a film. Personally, I would have loved something that had nothing to do with the human colonizers. I would have preferred a more spiritual and intimate approach and the movie to be like an adventure movie and less about blowing things up. I hope to see that in the next movie.

 The Avatar universe is so vast that there are infinite possibilities within the world to keep creating more tales. Disney plans to release three more Avatar sequels every two years through 2028 and according to its calendar, Avatar 3 is set for release in December 2024.

Avatar 2 – The way of waters might not be a film that changes your perspective of life through self-reflection, but overall, it is a great movie.

Azure IoT

What is Azure IoT?

Azure IoT is a collection of cloud services use to connect, monitor and control IoT devices.

IoT Central – a SaaS solution to connect and manage the IoT devices

IoT Hub – facilitates messages between IoT application and devices

IoT Solution Accelerators – deploys solutions that implement common IoT scenarios.

How git works – Onion View – Content tracker

Files are untracked. Git doesn’t know what to do with them. To commit a file you need to put it in a staging area (whatever it is in staging area it will go in the next commit).

git add/git commit

A commit is compressed like a blob. If we git cat-file the commit we will see that a commit is a simple, short piece of text. Git generates the commit and stores it like a blob. The commit contains all the metadata about the commit (the name of the author, the committer, the date of the commit, the message).

Mariuss-MacBook-Air:cookbook mariusistudor$ git cat-file -p  5a464f88150a3d1c406da815c60e712099e7b4b6

tree be4d5bfce489a2591e7fed5c672f9e52cd695a43

author Marius Istudor <[email protected]> 1584872355 +0200

committer Marius Istudor <[email protected]> 1584872355 +0200

First commit

Plus, it contains the SHA1 of a tree (the way a blob is a file stored in Git, a tree is a directory stored in Git). The commit is pointing to the root directory of the project.

The blob is not a file, it is the content of a file. The file name and the permissions are not store in the blob, they are stored in the tree that points to the blob. If you have the same data, you will get the same hashes. For commit, it will be different, because it will have different content (author, date, etc).

Git tags

A tag is a label for the current state of the project. There are two types of tags in git: regular and annotated.

Annotated tags are created using the git tag command and contain metadata such as name of the tag, message, time and date and an object that the tag is pointing to. A tag can be simply considered as a simple label attached to an git object.

So, the Git object models contains:

blobs (arbitrary content)

trees (directories)

commits

annotated tags

Git can be considered like a high-level file system based on the native file system. Because it uses versioning (by commits) it is also considered a content tracker.

How git works – Onion View – Persistent structure

« Porcelain » commands

« Plumbing » commands – scripting

If you want to master git, you don’t need to worry about learning the commands. Instead, learn the concept model.

Git can be seen like an onion.

A simple persistent structure that maps keys to values (the structure is persistent, it’s stored on your disk) – the basic idea behind git: a map.

values = sequences of bytes (the content of a text value)

keys = git will calculate keys for these values using SHA1 (hash)

Every object (text files, directories, commits) in Git has its own SHA1. It is unlikely they will collide, they are unique.

Inside the .git directory, there is an object directory where Git saves all its objects.

git hash-object

git cat-file to see the content of the file (the original content was compressed to save space and added some more stuff).

Tooling helps improve codebase

What does quality of codebase mean?

  • Robustness
    Decent unit test coverage
    Good error handling
  • Maintainability
    simplicity
    Expressiveness (not obfuscated with large statements of ifs)
    Use of common idioms (
    Clean architecture
  • Ease of use
    Documentation (don’t rely on assumptions)
    Generic
  • Cost
    Development time overhead
    Technical debt
    Return on investment

Is quality worth the cost?

Quality cost is somehow easy to measure but the benefits are harder to evaluate.

  • automation and tooling can help reducing the cost
  • CPU time is cheaper than human time
  • it’s easier to replace hardware than hiring

Quality investment: Companies tend to view code as investment, regardless of its quality.

Refactoring #1

Refactoring – changes made to a piece of code to make it easier to understand and easier to modify without affecting the observable behaviour (meaning it should do the same things it did before refactoring).

Refactoring doesn’t mean cleaning up the code. It is a combination of small steps that won’t leave the code too much time in a broken state. Refactoring can be a part of a code « restructuring ». While developing you can realise that would be much easier if the code were structured differently.

Refactoring is a valuable tool that can be used for several purposes. It is not the answer to all problems.

Regular refactoring helps keep the code in shape and improves the design of software. It make the code easier to understand for the next developer which might be you. If you don’t want/can remember all the things you write, write your code in a way it will help you remember.

Refactoring can help finding bugs because when clarifying the structure of a program you can spot a lot more easier bugs.

Refactoring helps you write code faster because you can leverage the existing things and you can quickly build on what’s already there. Also, if the code is clear, you will know what subset you have to change and you are less likely to introduce a bug.

When?

You can refactor before adding a new feature, preparatory refactoring.

Understand what the code does, comprehension refactoring. Move the understanding of the code from your head to the code.

Refactoring is a part of programming.

There are cases when the refactoring efforts can take weeks to complete. A useful strategy is to agree to gradually work on the problem over the course of time and not having a team dedicated to refactoring.

Refactoring during a code review would be better with having the original author of the code present because he can provide context on the code and fully appreciate the reviewers’ intentions (code review + pair programming).

Don’t refactor when it’s easier to rewrite than to refactor it.

Agile #4 – Estimation and planning

How do you plan and estimate in Agile?

Planning

  • a multilevel planning – release planning (several months), iteration planning (several weeks), daily planning
  • frequent – not a lot of details in the beginning
  • just enough, just in time –
  • adapt and replan – as things change, we are open to change the plan

Estimation

  • Effort vs duration – ideal days (developer days) = will take to complete a story if you work uninterrupted
  • Accuracy vs precision – instead of going into details so you can estimate « with precision », you can use « sizing buckets » (Fibonacci series, XS, S, M, L, XL) and put the stories there
  • relative vs absolute sizing – story points vs ideal days
  • estimation styles
    • Simple – free form
    • Planning poker
      • time consuming
      • uncover misunderstandings
      • collective ownership
      • engaged
      • good for backlog grooming
    • Card sorting
      • useful when estimating large number of stories together

Velocity

  • The amount of work done by the team in a sprint
  • It is used for selecting story in the upcoming sprint
    • the last sprint velocity
    • average of last sprints
    • range
  • it can be adjusted

Release planning

  • Fixed scope – How long it will take?
    • you need know the sprint length, the velocity
  • Fixed date – What can we deliver?
  • How to select stories:
    • story map
    • value market
    • learning
    • short feedback loop

Release tracking

It indicates when the release will be done or if we are on the track for a particular release. There are three ways to do that:

  • release burn-up
  • story board
  • cumulative flow diagram

Agile#3 – Generating user stories

Where do the user story come from?

User story writing workshop

  • Write as many user stories as you can for the selected theme
  • Invite the product manager, the scrum master, the dev team to make sure that everyone is participating and understanding what we want to build
  • It can last from a few hours to a few days
  • Identify the following:
    • who are the users, understand them
    • what functionality we want to build from them
  • create the backlog with all the stories:
    • detailed appropriately – more details for the stories that will be handled in the next future
    • emergent – it should evolve continuously
    • estimated – predict/plan your releases
    • prioritised – pick the top item to work on

Story mapping

  • What does a story mapping help to:
    • Discover user needs
    • organise and prioritise story backlog
    • understand and communicate user needs
    • plan releases and development
  • How to create
    • understand the problem, what is the benefit to the software
    • outline the activities an user will do in the system (what are the steps for each activity)
    • explore variations – happy path + alternatives the user have, capture the details, look for exceptions, consider other users, involve others
    • release meaningfully – what is the impact of that release, what is the success criteria for that release.