DEV Community

Cover image for The Power of Micro-Philosophy in Software Development
Caio Borghi
Caio Borghi

Posted on

The Power of Micro-Philosophy in Software Development

I am convinced that the best way to develop a computer program is by applying the "micro-philosophy".

In this article, I'll briefly talk about:

  • GNU
  • TailwindCSS
  • Refactoring
    • Trunk Based Development
  • Clean Code and The Pragmatic Programmer

And I will demonstrate how this approach is present in each one of these entities.

The micro-philosophy is a method that breaks down big challenges into micro tasks, simplifying problem-solving.

"Slowly, we get to where we want to get" - ExaltaSamba

GNU

GNU
I am not an expert on the history of Unix, GNU, and Linux.

But, what I understand is that:

  • Unix was an Operating System written in C
    • Launched in 1971
    • It worked on various processors and architectures
    • Something rare at the time
    • It was from a private company and sold commercially.
  • GNU is a free code project/movement.
    • It was initiated in 1984
    • Its initial goal was to build an Operating System
    • Completely free
    • With open code.
    • It had various mini-programs that performed various functions of an operating system
    • It was almost ready in 1992, only the kernel (main module) was missing to combine them.
  • Linux is actually an abbreviation for GNU/Linux.
    • In 1992, Linus Torvalds created a kernel that used all the subprograms of GNU
    • With this, he created the first distribution of the GNU/Linux operating system.

In a very abbreviated way, now you understand what GNU is.

Okay, what does this have to do with micro? Well... Let's go there.

GNU/Linux is the personification of the Free Software philosophy, which advocates for collaborative and open-source development. Its principles are:

  • Copyleft
    • The opposite of copyright (copyright)
    • It ensures that any and all changes made in the software are "free from copyright".
  • Transparency
    • All code and documentation are open and available to everyone.
  • Collaboration
    • It believes in the collaborative power of developers united by a common goal.
  • Simplicity: The GNU packages are examples of micro-programs that solve a single problem.

GNU encourages and defends the micro-philosophy!

The movement saw the operating system as a collection of small programs that do only one thing but do it very well!

Some of the programs that are part of the GNU package are:

  • ls | cat | cp | mv | rm | wc
  • Bash (The default Terminal of almost all GNU/Linux distros)
  • Nano (Text editor present in all GNU/Linux distros)

One of the best things about using Linux, or some unix-based operating system (Hi Mac OS) is being able to create combinations of programs to perform some task.

This is possible through the "pipe (|)" command, for example, if you want to generate a rank of most used words, you can use:

cat file.txt | tr ' ' '\n' | sort | uniq -c | sort -nr | head -10
Enter fullscreen mode Exit fullscreen mode

There isn't a specific program that does this, but it is possible to carry out this task by combining the commands: cat, tr, sort, uniq, and head.

TailwindCSS

TailwindCSS has revolutionized the way I use CSS.

It is a CSS framework that calls itself utility first.

Unlike other CSS frameworks such as Bootstrap, MaterialUI, and ChakraUI, TailwindCSS has no complete components.

It is nothing more than a set of micro-classes of CSS, where each class applies only one style.

Although it may seem contradictory, working with tiny classes provides a lot of flexibility, power, and stimulates creativity.

These classes are shortcuts to styles that have already been written countless times on millions of websites on the web, in addition to having dynamic classes (like p and m) and accepting fixed parameters, ex: h-[300px].

Padding Section in the Tailwind documentation

Just like GNU, Tailwind also believes in the power of the micro-philosophy for problem-solving.

Refactoring

Refactoring book by Martin Fowler
Recently, I have been reading the book Refactoring by Martin Fowler. In it, several strategies and techniques to improve code are addressed.

According to the author, refactoring is a controlled technique to improve the design of an existing code.

It's a disciplined way to clean up code that minimizes the chances of introducing bugs.

The refactoring process according to Martin Fowler involves:

  • Making small changes that do not alter the code's behavior.
  • Taking small steps, to make fewer mistakes.
  • Running builds and tests with each new change, only updating if it is working.

By doing this, you ensure that the code is always functional and, little by little, it gets better.

The book also comes with 70 code improvement techniques.

Big refactorings are done taking advantage of the power of the micro-philosophy applied to code improvement.

According to Martin, the quickest way to solve a problem or improve a project is to solve small sequential micro-problems that, combined, solve a giant problem.

Trunk Based Development

It's a project versioning strategy, focused on maintaining short-lived branches and:

  • Always merge to main
  • Merge frequently (ideally once a day)
  • Use Feature Flags to hide features that are not ready

This helps to avoid:

  • Complex merge conflicts
  • Commit-racing

The explanations for these two assumptions can be found in this SENSATIONAL article by Martin Fowler.

Here, the micro concept appears in advocating that micro changes should be merged into the main project as quickly and frequently as possible.

With this, it becomes easier to:

  • Review PR
  • Resolve merge conflict
  • Keep all branches updated

If you are able to maintain a strategy with short-lived branches.

Clean Code and Pragmatic Programmer

Two great books about system development coding and a career as a programmer.

Both defend:

  • Small functions
    • With descriptive names
  • Readable code
    • Understandable
    • Self-explanatory
    • Without comments
  • Good Neighbourhood Policy
    • Leave the code better than you found it
  • Continuous refactoring
    • Never be afraid to change the code for the better, never!
    • Refactor to improve reading, understanding, or maintenance
  • Unit tests
    • Common point in the 3 books
    • Facilitates maintenance (more security to change)
    • Facilitates understanding of business rules
    • Forces the creation of small and decoupled functions

Micro-Philosophy

It is present in each of these entities of programming.

It consists of breaking down large problems, daunting tasks, or complex features, into micro-tasks.

All authors assert that the true speed in software development
is tied to the practice of small, iterative, testable, and maintainable steps.

In my experience, adopting this approach has simplified complex problems and amplified safety in software development practices.

Believe me, integrating micro-philosophy into your workflow could be a game-changer.

Thank you for reading, I would love to hear some of your thoughts on the comments section, have a nice day!

Top comments (0)