Yos Riady optimize for learning

👋 Hi, I'm Yos.

I'm a 👨🏻‍💻 Software Engineer based in ☀️ Singapore

Here are my recent thoughts...

Python dependency management with virtualenv

In this post, I’d like to outline how to create and manage virtual environments each with its own, independent set of dependencies with the following packages:

  • pip, A tool for installing and managing Python packages in the Python Package Index
  • virtualenv, A tool for creating isolated Python environments containing their own copy of python, pip, and other packages
  • virtualenvwrapper, A set of convenient enhancements to virtualenv

virtualenvwrapper is a set of extensions to Ian Bicking’s virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow, making it easier to work on more than one project at a time without introducing conflicts in their dependencies.

The rationale behind virtual environments is to make available reproducible, isolated sets of dependencies/python packages without much configuration and without having to watch and manage the packages’ different versions.

Continue reading →

Learn Vim in 5 minutes

Quick! Let’s learn some minimal vi commands!

In a Vim editor:

  • press i to go into insert mode, start typing your text
  • press Esc to go back to normal mode
  • then write the file and quit with :wq + <Enter>

Congratulations. You have joined the great fraternity of people who know this ancient, revered text editor.

These are the essential commands you will need to get started with git commit messages.

Additional reading:

The Decorator pattern in Python

In object-oriented programming, the decorator pattern (also known as Wrapper, an alternative naming shared with the Adapter pattern) is a design pattern that allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class.

In functional languages such as Scheme and Haskell, functions are first-class. This means that we can pass functions as arguments to other functions, assign functions to variables, and have them as return values just like any other primitive data types such as integers and strings.

In Python, functions are likewise treated as first-class citizens. In fact, the language provides syntactic sugar known as decorators which makes wrapping functions and function transformations even easier.

Continue reading →