Author: Matt

  • Asset Allocations

    Late last week my RRSP transfer from mutual funds into Questrade completed.  It feels as if I lucked out in that the 5 worst days of the year on the market happened while the cheque was in the mail to move money.

    Trying to devise a strategy for investing that is both safe, has the potential to beat the market, and protects me from myself lead me to read a couple of books on portfolio management theory and devise an overall approach to managing my investments.
    The take away from the world’s best investors is that the best approach for investing is:
    1. Diversification is the only guaranteed way to reduce risk and maintain good returns
    2. Rebalance your portfolio no more than twice per year to reset your risk exposures to account for drift
    3. Don’t trade on emotion – you are your own worst enemy
    4. Always consider the tax implications and costs to trade
    One of the biggest lessons I got from working at an investment management company is to hedge all your bets.  You never put all your chips on red because your analysts think it’s the best bet.  You buy the whole board and make small bets.  This way you maintain diversification – which lowers the variance of your whole portfolio.  And provided you can do better than 50% on picking winners and losers the portfolio will do better than it’s benchmark.
    Extending that to the asset allocation for a complete portfolio is relatively straight forward.  It starts with the question: What should my portfolio look like at a high level?  To answer that I’ll go through the break down of how I built my portfolio.
    The asset types I went for were:
    1. 40% Bonds
    2. 50% Stocks
    3. 5% Precious metals
    4. 5% Commodities
    Noticeably missing from this list is REITs.  I own a home which is more than enough exposure to real estate for my liking.
    I’m targetting 90% of my investable assets into broad low cost ETFs. 10% is individual stocks which I believe have good moderate term prospects to beat the market.
    Within each broad asset category things are further diversified:
    Bonds:
    • 1/4 High Yield corporate bond ETF (HYG)
    • 1/8 DEX index Canada government & municipal bonds (XBB)
    • 1/4 Canadian Real Return Bond ETF (XRB)
    • 1/4 Canadian Hybrid Bond ETF (XHB)
    • 1/8 Emerging Market EFT (LEMB)

    For bonds I wanted a good mix of corporate, government, and international bonds that were hedged against interest rate changes a bit with the Real Return bond (XRB).  Once I get a chance to compute the co-variances on this selection I may re-allocate.  In particular it seems a bit under-exposed to US and EAFE bonds.

    Stocks:

    • 4/10 TSX 60 ETF (XIU)
    • 4/10 EAFE ETF (XIN)
    • 1/5 Personal stock picks – currently (AAPL, BA)

    Admittedly this isn’t as diversified as I’d like, future purchases may go towards something very broad like the MSCI World ETF (XWD) or Vanguard World ex US ETF (VEU). I’m betting on Apple because they have a strong product lineup, entering new markets next year and have been doing a lot of stock buy backs.  Boeing is my bet that if oil stays low, airlines around the world will see billion dollar profits and funnel that back into growing their fleets with new planes.  Boeing is also a hunch that it’s possible to get ahead of the next trend by thinking critically about where profit from the current trend could end up.

    Other:

    • Precious metals are in gold bullion (CGL)
    • Commodities are in a broad ETF (CBR)
    There are so many options for things to invest in that it’s hard to choose.  My hope is that this portfolio will be low risk and have great returns.
    New money added to the RRSP will be used strategically to keep the portfolio in balance which will hopefully reduce the need to make big re-adjustments.  The way to think about this is that I will be buying the assets which have become the least expensive – thereby dollar cost averaging down.  It’s a way to frame things to avoid panic selling at the worst possible time.
    It was kind of a fun week to research, read and figure out how to invest things.  Learning is, of course, an endless journey and I’m excited to iterate and get better at investing.  It’ll be exciting to see how this portfolio does over the next year.
  • Why You Should Build Your Own Tools

    Something has happened in the manufacturing world that is nearly irreparable.  As America moved production to China and downsized factories to realize the profit gains from low wage Chinese workers it also decimated an entire skill set from the national tool belt.

    When a factory tools up a new line to produce a new iPhone, sneakers or toy it is the job of a skilled tool maker to decide what custom tools can be designed to make things efficiently.  These may be custom 1 of a kind drill bits, platforms, moulds, or machinery that someone with a creative and technical skill-set needs to design and create.

    When America outsourced it’s factories it also lost these very valuable skills.  Now, as a result of that loss of knowledge spinning up a new factory in America is a very difficult task to accomplish.  That loss will take a long time to recover from.

    In the world of software development, abstraction is often a panacea.  Abstraction has created a similar migration of technical skill sets over the last few decades.  We abstract out the complexities with layers upon layers of helpers, protocols, frameworks and libraries.  These extra abstractions can boost our productivity tremendously so long as we don’t encounter a use case that isn’t handled by our chosen abstraction technology.

    The danger when you completely ignore how those abstractions work is that the skills and knowledge it took to create them die out as well.  Who are the tool makers?

    I have found it incredibly useful when trying to understand a new tool to have a solid grasp of the underlying technology. Knowing how to build a HTTP service at the TCP level (and from time to time actually doing it) makes it easier to reason through issues and push the limits of a framework like Ruby on Rails.

    Software developers everywhere should spend just a little more time writing the tools they need to do things quicker in the future.  It is investments in the tooling that has the chance to compound to make future work exponentially easier.

    Create stand alone services that can be leveraged on multiple projects, write code generators, and libraries. Create your own frameworks.

    The style of programming required for creating a great re-usable library is very different from that used when doing a business application.  Good, flexible code often relies more on using the dynamic capabilities of a language.  You’ll often find yourself needing to use meta classes, introspection and other fun constructs.  The people that know how to wield these tools are going to be better at debugging, see opportunities to improve code, and create their own tools.

    My plea to software developers everywhere: create your own tools.  Know how to create the tools you use, and how to use the tools you create.

  • Strength Training Required

    These last few weeks have been stressful.  Trying to hit deadlines at work and hunched over a computer again at home have left me more sore than I can ever remember being.  My back is shot, and I haven’t been able to sleep comfortably for at least a week.  It’s been brutal.  Once you get past 30, your body just doesn’t handle abuse the same as it could before.

    This week I am going to be switching to a stand-up desk to see if that helps, and at home I’m going to swing the kettle bells.  If I can find time I’m going to work in a 30 minute walk everyday.  Hopefully that will alleviate things.

     

  • How to Get Things Done When You Have no Time

    This last month or so has been a hell of a busy time for me.  Working long hours, with a 1 year old at home who needs attention while trying to squeeze in social events, exercise, sleep, reading and personal projects is a lot to juggle.

    How have I managed to rock a streak of 53 consecutive days with open source github activity, learned Flask, read 3 books this month and made progress on several side projects?

    The Github streak never would have happened if I didn’t have a script to email me every hour after 5pm that I don’t have activity on my account.  This simple nag makes sure I don’t go to bed and forget to write some code each day.

    Thinking of things to code each day has pushed me to explore new ideas, practice concepts, study APIs and do tutorials. In retrospect it is astounding just how much interesting stuff you can get done when you do a little bit every day.

    A simple nag will actually make you find the time when you don’t have it.  Several times per week I find myself up later than I would have been otherwise trying to write just a couple more lines of code.  Once you start on an idea it’s not easy to let it go unfinished; it’s hard to commit code that won’t even compile.

    Activity has spiralled off from this daily coding.  A couple days of hacking on some stock market analysis algorithms got me checking Amazon for books,   which in turn got me to completely overhaul my personal finances.  On another tangent, trying to think of ideas for things lead me to a tutorial on Flask and more books on that subject.

    Want to get more done?  I’ve improved on the Jerry Seinfeld Productivity Secret with a simple script to make sure I don’t destroy my streak by being absent minded.  The knock on and compounding effects from all this daily activity has been unexpected and amazing.

  • Too Many Ideas

    I have a long, long list of software projects that I’d like to create.  Scattered across notebooks, Google docs and text files and collected over years.

    It’s unfortunate that even good ideas are worthless if you don’t have the time or capital to implement them.

  • The Tragedy of Magic Code

    There are many software platforms that offer ‘magic’ like ways to accomplish things. Ruby on Rails has a lot magic going on – pass in a string argument and it gets automatically pluralized, converted from snake case to elephant case, inferred as a class name in the global namespace, instantiated and connected to set of URL routes.  Magic code is dangerous because it’s easy to use without needing to understand how it really works, and leads to a false sense of confidence that you know what’s going on.

    Imagine a professional escape artist.  He has 10 years of experience performing in front of large international audiences, then one day he watches a new magician’s escape trick.  He thinks he knows how it was done so he tries to replicate it.  He chains himself up, puts on a straight jacket, takes a deep breath and locks himself in a glass box filled with water.  Moments later he realizes his understanding of how the trick was done is incomplete… Now he’s in real trouble.

    That is the danger of code that works like magic.  You think you know how something works; you gain confidence that you understand it, and then it fails to do what you expected at a critical point.

    What about the beginner magician?

    The beginner magician can watch a card trick performed 100 times and may not be able to figure how how it works.  If they try to perform the trick themselves it’s almost guaranteed to fail.  You can not easily learn how the magic trick is done by just by watching someone else do it.

    Web frameworks can be like a bag of tricks where you get to tell the professional what trick to do.  “Make this form work with AJAX” can be like asking a magician to guess which card you’re thinking of.  You have no idea how it either of those tricks work.  However, you can become very adept at wielding your bag of tricks and never learn enough to create your own.

  • Exploratory Programming

    One of the unexpected benefits of free coding daily is the chance to explore solutions to problems you have to work on that day. When you write code freely without considering the use of it there is less pressure to keep a poor implementation. It’s practice that is a way to boost your understanding of the problem before writing it for real.

    There are some definite benefits to writing a solution to a problem more than once.  With each iteration you get faster and produce a better solution. When you practice and try to learn from each attempt you get better.  You gain mastery.

  • Why is it so Cold

    This week has been a difficult one for biking to work.  On Friday it hit – 35 with snow.

    Biking required the full snow suit including ski goggles.  Despite the slow slog home it still was probably more pleasant than being stuck in a car, gridlocked and worried about all the cars around that still have summer tires on just tempting fate.  I would much rather be safely off the roads.

    Over the past 3 days Calgary police were called to about 1000 collisions in the city of which at least 57 accidents involved an injury.  And that doesn’t include the number of accidents that didn’t require the police.  Trying to get a grasp of the cost of loss to property (and life) as a result of trying to drive around the city would be a very interesting exercise.

    Luckily this cold snap should break next week and the temperature will jump up by 20-30 degrees for a while.

  • Study Open Source Applications

    I came across an excellent resource last week that more people should know about.

    The Architecture for Open Source Applications is a series of books that examines how some of the best software ever written is designed.

    Programmers rarely get the chance to study the work of others in detail.  You learn the fundamentals in school but when it comes to experience building larger applications it’s not easy to pass on that knowledge in a single semester when writing the code for a large application may take years.

    The books are inspired by how architects learn by studying the designs of other buildings. If you’re tasked with designing an office tower there are no doubt countless lessons that have been learned in the past century about dimensions, materials, efficiency, best practices, capacities for everything from floor space, water pipes, air exchangers and elevators. If architects re-invented the wheel each time they took on a new project almost all buildings would be terrible.

    Software developers do often start each new project as a chance to re-invent everything themselves.  Of course this is a massive risk.  Even the best developers cannot implement the optimal solution to each an every sub problem in a large application.

    Studying design patterns get you part of the way there.  Actually seeing them used in different contexts will deepen your understanding of their value.

    Actually studying the great open source applications will give you inspiration to lean on when solving your own application design issues.

    All software developers should read these books.

  • How to Provide a Great Estimate

    Estimating the cost of developing software is difficult.  Very difficult. That’s because with each new project there are always unknowns, mis-interpretations and assumptions that are not communicated.  If the client knew exactly what they wanted then it would just be a matter of typing it up.  They hire you because they don’t know how to do it themselves.

    Agile development realizes how difficult estimations are by attempting to avoid them entirely.  Instead opting to push clients to time and materials which they have a hard time fitting into a fixed annual budgets.

    Creating an estimate that accounts for uncertainty while fitting in with businesses’ existing processes is non-trivial.

    It all starts by taking the project scope and breaking it into smaller pieces that are easier to estimate effort on.  There are risks even at this early first step that your estimate may be off.  Even with a great deal of thought you will likely overlook things.

    Agile approaches would have you break a project up into ‘stories’ and estimate on those.  I have found that stories generally have some overlap, making it difficult to understand as a line item in an estimate.  I prefer to get down to the level of code structure.

    The second thing to consider in an estimate is that with every guess you make there is some understanding of uncertainty that is not often portrayed.  Creating a login page is fairly concrete, you’ve done it 50 times and are very sure how long it will take.  Creating a custom machine learning algorithm for the application may be a bit more fuzzy. Providing a measure of uncertainty to your estimate turns your fixed estimate into a range of estimates with different probabilities.

    Actually, a machine learning algorithm is useful example to explain my next point.  A good ML algorithm can take time to train and tune and a bad one can be quick. You can take more or less time and still get an algorithm that works.  There is not only an uncertainty but also some elasticity since it is unlikely that an RFP (Request for Proposals) included stipulations on the accuracy of the ML feature.  Elastic features should exist as 2 options on an estimate. 1 for basic implementation and an other that provides a better implementation.  That way the advanced option can be explicitly accepted by the client.

    Next thing to consider is that not everyone’s estimates are equally good.  Some people are overly optimistic others tend to assume worst case, sometimes you have better knowledge that can help cut down the estimate while another person considers things more difficult.  By collecting estimates from many people you can average out their biases and with an open dialog hopefully team members can learn from each other.

    This brings up a couple of major factors that can influence a person’s estimate:

    • Anchoring bias – A person’s estimate can be influenced if they see someone else’s estimate first.  You mitigate this by having estimates done blind.
    • Optimism bias – People tend to want to impress.  It may be to stand out from the team as better, or because they haven’t thought of some of the complexity in a solution. There is a tendency to under estimate.
    • Lack of information – All estimates are made without complete knowledge.  The client likely doesn’t have all the information either.  When you don’t have all the information there is more uncertainty in an estimate.

    Anchoring bias can be dealt with through procedures that make estimates independent of each other.  Games like Planning Poker have rules to prevent anchoring bias (everyone turns over their card at the same time).

    Optimism bias is more difficult to account for.  Perhaps the best (though as of yet untested in software development) approach is to use reference class forecasting to provide some insight given historical realized costs on similar tasks.  If setting up a new server has for the last 20 projects taken an average of 2 days, but the team has estimated it will take 1 day then they may be some optimism bias in the estimate.

    Lack of information is accounted for by adding uncertainty to the estimate.  Although we don’t always know what we don’t know so some amount of unknowns should usually be added as a buffer in the final estimate.

    Using this information hopefully you can create better more realistic estimates for your clients.  If you are a client accepting bids on an RFP you should be looking for bids that detail where there is uncertainty.