Programming

I've been programming since the mid-90s, starting with QBasic, then moving on to Visual Basic, C++, C, and dabbling in assembly in college. Currently, my main languages are C++, C, and Python. I kind of hate where C++ is heading, with its over-reliance on the standard library and templates, and its increasingly weird syntax, but it is still the best tool for most jobs I encounter (in scientific computing). Python is fantastic for providing a frontend to low-level high-performance code, and C is a nice refreshing departure from high abstraction, and is the lingua franca among all languages and foreign function interfaces.

As far as the other languages, I can work with shell, Perl, Lua, Java, Mathematica, R, Matlab, and PostScript. I am intrigued by Rust. I had high hopes for Julia, but, alas, it uses 1-based indexing, and completely lacks the ability to do object-oriented programming with any reasonable syntax.

My C++ style guide:

  1. Tabs, not spaces. All tabs must exist only at the beginning of a line, never proceeding a non-tab character. That is, all lines must match the regex
    ^\t*[^\t]*$
    . Changing tab width should never impact readability of the code, but I prefer 1 tab = 4 spaces.
  2. All code is ASCII.
  3. Line length is arbitrary, but preferred to be within 80 characters for header files.
  4. Comments should be
    //
    whenever possible to allow block commenting around it.
  5. Whitespace should be minimal around keywords (
    if(cond){
    is preferred), and opening curly braces should almost never be on their own line. For loops look like this:
    for(int i = 0; i < 10; ++i){
    .
  6. Names should be CaptializedWords or with_underscores, but never javaCamelCase. Hungarian notation is right out.
  7. Exceptions are never to be used.
  8. No preprocessor shenanigans, unless absolutely necessary.
  9. No preprocessor shenanigans.
  10. No RTTI.