Professional Programming

Professional Programming is yet another excellent list of resources, such as books, articles, and courses, for people pursuing programming as a professional career.

The more, the better, I say.

Vim: persistent undo

Learning Vim is an endless process. Even after using it for two decades I still keep discovering new settings, features, and plugins that significantly improve my productivity.

The other day I came across “Ask HN: Best things in your bash_profile/aliases?” thread, with plenty of tips and tricks. One particular comment highlighted a feature that I kind of heard about but never got to setting up – persistent undo.

It turns out that starting with Vim 7.3 you can preserve the undo history between editing sessions. Which means that you make changes to a file, save it, close it, and when you reopen it later, you can press ‘u’ to undo the changes you’ve done during the last edit.

In order to set this up, you first need to create a folder, where Vim will store the undo history files. For example:

$ mkdir ~/.vim/undodir

Then, you need tell Vim that you want to use persistent undo and where to store the files. Edit the .vimrc file and add the following:

set undofile
set undodir=~/.vim/undodir

As long as you are using Vim 7.3 or newer and the directory exists, your persistent undo history will work like a charm.

Read the rest of the thread for more tips on how to clean it up periodically, and how to further improve your experience with Vim’s undo, using plugins that help navigate the undo tree.

Reading postmortems

Once in a while a seemingly straightforward article turns into a goldmine of links and resources. This happened to me today with this one – “Reading postmortems“.

Not only this article itself is a very nice roundup of common sources for system failures, but it also links to a couple of awesome references:

  • Simple Testing Can Prevent Most Critical Failures: An Analysis of Production Failures in Distributed Data-Intensive Systems. This is both a talk and a paper.
  • danluu/post-mortems – a GitHub repository with a collection of publicly available postmortems from a variety of organizations, like Google, Amazon, Facebook, NASA, GitHub, and more.

If you still have no idea what postmortem is, Wikipedia explains.

New in PHP 7.4

New in PHP 7.4” is a quick and simple introduction into changes and new features of the upcoming PHP 7.4, which is planned for release in December of 2019. In brief:

  • Preloading (parsed source code caching)
  • Typed properties
  • Improved type variance
  • FFI (Foreign Function Interface) – a way to run C code from within PHP
  • Null coalescing assignment operator (??=)
  • ext-hash always enabled
  • Password hashing registry

GrumPHP – PHP quality control tool

GrumPHP is yet another quality control tool for PHP. But unlike a million other – PHPUnit, PHP CodeSniffer, and the like – this one is more of a tying knot. GrumPHP integrates via git hooks. It runs one more of the other tools, making sure that the changes you are committing are up to the par.

The support for other tools is excellent. You’ll find anything from the basic unit tests and coding style checks to commit message formatting and content, Robo tasks, and even custom shell scripts.