"My pragmatic summary: A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in. In a multithreaded environment, the lack of understanding and the resulting problems are greatly amplified, almost to the point of panic if you are paying attention. Programming in a functional style makes the state presented to your code explicit, which makes it much easier to reason about, and, in a completely pure system, makes thread race conditions impossible."
» John Carmack: Functional Programming in C++ (via Phillip Bowden)
Whenever possible:
Avoid mutable strings, arrays, sets, dictionaries, date or data as a property of an object.
Avoid creating a method that takes a reference as an input to be modified.
Avoid manipulating a global variable.
Achieve high cohesion and low coupling.
(Source: buzz)
» via buzz
thechangelog:
The ever-awesome @mattt has released Postgres.app. From the README:
Postgres.app is the easiest way to get started with PostgreSQL on the Mac. Open the app, and you have a PostgreSQL server ready and awaiting new connections. Close the app, and the server shuts down.
Even with homebrew, installing postgres can kind of be a pain sometimes. I’m always for any project that makes software installation even easier.
You can get Postgres.app from its website or check it out on GitHub.
This will definitely increase the usage of PostgreSQL.
» via thechangelog
Mantastic is a small Heroku web service for storing man pages and cheat sheets in the Markdown format which is converted to Roff for you!
Next challenge:
Converting docx format to markdown.
(Source: onethingwell)
» via onethingwell
While I’m watching “Moving to the Apple LLVM Compiler” WWDC 2011 video, I found new things that maybe useful in cases where I know what I’m doing with the code that I’m working on.
The first one is to control Clang diagnostics via pragmas:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmultichar"
char b = 'df'; // no warning.
#pragma clang diagnostic pop
The second one is to control Clang static analyzer diagnostics:
#ifndef __clang_analyzer__
// Code not to be analyzed
#endif
Now, what I would really like is to selectively analyze the source code via Xcode. This is because, I often need to ignore the result of analyzing 3rd party source code. In most cases, I don’t really need to change them, and I don’t want to add these pragmas or preprocessors on their files.