Resolutions: Why Have Them and How to be Successful

Resolutions

What’s Up With Resolutions?

It’s that time of year! You know, where everyone is thinking back on all of the things they wish they had actually accomplished this year and they’re convincing themselves they’ll get it done next year. It’s time to set some New Year’s resolutions!

But what’s up with that? Why does it take people a whole year to reflect on what’s going right or wrong in their life and try to change their direction? Why does it take you a year to realize your diet and exercise regime is something you couldn’t stick to and you’re no better off than you were last year? Why were you still unmotivated in your career doing the same old thing? Why didn’t you get your head in the game for school? Why did you continue to pursue toxic relationships?

Continuous Improvement

Resolutions are all about trying to get better; we’re trying to continuously improve. Often when I talk to people about “agile” software development, all that I really try to drive at is that “continuous improvement”, in my own personal opinion, is really the important part.

So to continuously try to improve, you need to analyze what’s going well and what’s going not so well, set some goals, try things out, and re-evaluate. It’s a nice iterative cycle. It’s kind of like setting mini resolutions for yourself (or in the case of software development, maybe for your team or teams).

The big difference is the amount of time between measuring whether or not your change is having an effect! Waiting an entire year to try and measure your success would be absolute insanity in a fast moving software environment… why haven’t we gotten better at realizing this for our own personal continuous improvement?

Mark Manson

I’ve been reading a ton of Mark Manson material lately because of events going on in my life and the fact that the way he writes really aligns with how I often talk to my close friends. There’s analysis, there’s some humour, but it’s often a bit blunt and to the point. It’s actually a really nice change from many leadership, self help, or similar content where everything almost feels impossibly positive. This just feels like a real person talking to you.

Mark talks about setting goals in this blog post, and it got me motivated to reflect on my own goals and even write this post. In Mark’s post, he talks about our identities being built up by a bunch of habits, and goes on to state that some research shows that often habits only take about 30 days to form. In his opinion, using a whole year to set a goal of changing, adding, or dropping a habit just allows us to procrastinate for the entire year and then ultimately we fail.

His suggestion? Shorten the time frame.

If it takes on average 30 days to make a habit, why not have a “New Month’s Resolution”? Setting resolutions this way should then allow you to establish a new habit and then at the end of the month reflect on whether or not it worked well. You have less time to procrastinate. Your iteration is much shorter. Interesting.

My Own Goals

I figured I’d wrap this up by sharing some of my own goals publicly. I have a few things I’d like to work on coming up for the year, so I’ll outline them briefly:

  • Read more:
    • I’ve definitely dropped the ball on this one. I always had the excuse for myself that I don’t have time to do it. However, I found when I read the most consistently was when I found a decent book that I could read for a few minutes before I fell asleep every night. No pressure to get through it, but the books were there if I felt intrigued or needed to relax my brain a bit.
  • Try meditation:
    • I’ve always associated meditation with being spiritual or religious. Both of these things don’t really mesh well with me, personally. Mark Manson mentioned meditation in his post that I mentioned earlier, and it gave me a different perspective. I know I get stressed easily and I used to have pretty bad anxiety problems. Maybe this is something I could try out?
  • Write more:
    • I used to blog a lot. Between this blog, my fitness blog, and my car blog, I used to write content multiple times per week. It was always a bit of a social media experiment to get a better feel for how internet traffic works and where different types of content get the best visibility, but it also let me express myself. My content production has been almost nothing over the past year, and it’s something I’d like to look at more of.
  • Try public speaking:
    • This was something my HR Director had a chat with me about as a potentially cool opportunity. We were discussing getting more involved with the community and pushing boundaries, and she proposed speaking to students at local colleges or similar. I was turned off by it at first because I don’t like public speaking. But then the more I thought about it, I don’t know what public speaking is because I’ve never really done it. So why not try it?

But those aren’t my resolutions! Those are all just ideas for things I’m interested in improving. So taking some of Manson’s advice, I’m going to take ONE of those things and try to form a habit out of it for a month. Focusing on one thing at a time allows you to really give yourself an opportunity to establish the habit without worrying about too many other things, and ultimately setting yourself up for failure.

My first resolution is going to be to try out meditation. So for the first month, I’m going to try meditating four times per week for about 10 minutes at a time. I should be able to easily do this for two days on Saturday and Sunday where I don’t really have any external commitments, and then during the week I should be able to find at least two days before work where I can give this a shot.

Small steps, but small steps still take you forward.


How to Refocus: Getting Back in the Groove

How to Refocus: Getting Back in the Groove

Identifying when you need to refocus

It happens to everyone at some point to varying degrees, for various reasons, and at different times in our lives–but it’ll happen! You hit a period or a rut where you can’t keep your focus on continuing to be successful (and I’m over-generalizing that for a good reason).

Maybe this means you can’t focus at work to perform at an optimal level. Maybe you’re falling off the diet you’ve been working hard on. Maybe your training in the gym or for your sport is taking a hit because your head isn’t in the game. Maybe you find yourself unable to hit the books studying or completing your projects in school.

It can look different for everyone.

There are a bunch of different little warning signs that things aren’t quite on track and you need to refocus:

  • You’re losing interest in what you’re working on or have been working towards
  • You can’t seem to keep your mind on the goal(s) that you’ve set
  • You feel like you’re plateauing in your progress toward your goal(s)
  • You’re suddenly finding you’re not happy or not feeling fulfilled
  • You’re taking out stress on your co-workers, friends, or loved ones
  • You’re isolating yourself from friends and family
  • You find yourself overly concerned with things you can’t change (dwelling on the past or fearing a future event, like an exam)

But don’t freak out just yet… you need to see and acknowledge the signs before you can start to make any progress. Feeling pretty good about everything in your life? Then keep doin’ what you’re doin’! If any of those points seemed to resonate with you, then let’s continue on!

Don’t worry

If you’ve found that you’re in a bit of a rut, it’s important to not worry. You need to remind yourself that you were once on track and you’ll get back on track. You’ve already identified you need to refocus, so you have the power to get back on track.

Worrying about the fact you’ve identified you’re not in an ideal state of mind doesn’t help anything; in fact, it makes it worse.

“I can’t seem to find my focus at work… I’m going to be such a bad employee. I wonder if I can even get my work done now. My colleagues are going to notice… My manager will notice!”

“Training has really been kicking my butt… Why am I even doing this? I wonder if I should just give up. I haven’t seen any progress in my abilities in the past couple of weeks. I’m hopeless at this.”

“There’s a lot going on at school now and I can’t seem to keep up anymore. I’m going to fail this project that’s due next week because I can’t seem to get started on it. And my exams are coming up and I can’t seem to study. I’m going to fail this term.”

All of that kind of talk is negative and it’s not going to help you progress! So why are you continuing to focus on hampering your progress? Don’t do it. Instead, acknowledge you’re looking for a positive change, and then acknowledge that you’re in full control to start making that change.

And step one is to stop worrying and drop the negativity.

Analyze what’s getting you down

I get told that the engineer in me talks too much about analysis… but I think it’s a critical step! You need to understand the things that are getting you down. You’ve identified that you need to refocus because you’re not happy with your current behaviour or state of mind, but what are those things that are getting you down?

If you understand what’s getting you down you can start to take corrective actions. It’s got a (cue the fancy buzzword) synergistic effect with my previous point–Drop the negative thoughts and work on correcting them in parallel.

Let’s look at a couple of potential examples:

  • You’re unable to see any progress in your work, schooling, or training
    • How are you measuring progress right now?
      • Some things aren’t well suited for quantitative measurement
      • Try and identify a consistent mechanism for measuring progress
    • How often do you measure progress?
      • Some things don’t change very frequently so it’s hard to notice progress
      • Many things don’t progress in a totally linear fashion
    • Is it time to update your strategy for continuing success?
      • How long have you been doing the exact same thing expecting to get the same increase in results?
      • Have other environmental factors changed that suggest you should update what you’re doing?
    • Have you actually compared your current status to a previous point in time, or is it just how you feel?
      • Maybe it’s all in your head!
      • Try reflecting on where you were a month ago, 6 months ago, and a year ago.
  • You’re constantly comparing yourself to others
    • Do you actually know all the ins and outs of a person’s life?
      • Just because you observe certain things, it doesn’t mean they’re exactly as they seem
      • If you don’t have the full perspective and details on someone’s life, you’re guaranteed to be misunderstanding something
    • Can you change other people?
      • … Even if you could, you shouldn’t!
      • See the next major point 🙂
    • Are you comparing different subsets of your lives and expecting them to align a certain way?
      • Other people are not you and are living a different life
      • You can only truly compare yourself to your own self at various parts in your life
  • You’re dwelling on things you can’t change
    • Are you expecting to change something in the past that’s already happened?
      • Unless you have a time machine, you absolutely cannot change past events
      • Trying to understand past events can be helpful learning for the future
    • Are you dreading an event in the future that’s unavoidable?
      • If you can’t avoid it, then work at accepting it’s going to happen. (Things like exams or year-end reviews for work, for example)
      • Ask yourself why you’re dreading it. Try applying this example of analysis to THAT reason and dive deeper.
    • Are you focused on the thoughts and emotions of other people?
      • You can’t (and shouldn’t try to) control how other people think and feel
      • The best you can do is focus on yourself and live the values that you believe in
      • When it comes to thoughts and feelings, we all observe and interpret on our own
    • Have you considered whether this situation is temporary?
      • When you don’t know how long you’ll be out of control, it can make you feel helpless
      • Knowing there’s a point in time where there’s a change that can affect your situation can be a great help (i.e. money is tight for two weeks and you just need that next pay cheque to come through)

These are just a handful of examples, but hopefully you can see a pattern:

  1. Identify a particular thing that you know is getting you down.
  2. Ask yourself what effects it’s having and why you believe it’s having those effects on you.
  3. Dive deeper on each one of those by repeating these steps.

It’s nothing groundbreaking and I’m not claiming it will magically fix your problems… But analyzing things can lead to understanding, and understanding can lead to progress.

Remind yourself of your strengths

Everyone gets down on themselves at some point and this will cause you to lose focus on your goals. But I guarantee you if you stop and think about it, there’s a lot of great things that you got going on!

Don’t believe me? I challenge you to take a pen and something you can write on.

  • Write three things you’re proud of or that you’ve accomplished
  • Write three things about why your best friends like you
  • Write down the thing you love doing most or loved doing most before this point in time
  • Write down the thing you think you’re best at

Now step back for a second and think about the things you wrote.

  • It’s very likely the accomplishments you made or things you’re proud of required you to overcome something. Unless you got lucky or had some magic, odds are you used your strengths to achieve these things.
  • Your friends stay by your side because they admire you. They admire the qualities you have and see strength in you. You might not realize these strengths, but your friends perceive these about you.
  • If you love doing something, you’re probably pretty good at it, and if you’re not, odds are you’ll get good at it because you love to do it! Acknowledge and understand what you’re passionate about because it will tell you about your strengths.
  • Sometimes you’re good at things that you’re not totally passionate about. That’s cool too! What makes you good at this thing? Can you apply this to other areas in your life?

Set some goals

At this point you’ve:

  • Identified that you’re not content with your current state
  • Reminded yourself that you can make a change
  • Analyzed what’s getting you down so that you have a better understanding of some direction to take
  • Reflected on your own personal strengths

And now… It’s time to set some goals!

Goals you set should ideally align with SMART goals. Do yourself a favour and check that page out for a little bit more information so you can set yourself up for success. You want to make sure you’ve agreed your goal is achievable within a certain period of time and that you can measure progress in some way as you go. This is critical for a few reasons:

  • No time box? How will you know if you’re on track?
  • No way to measure? … Same problem!
  • Not realistic or achievable? You’re setting yourself up for failure.

It seems obvious when it’s laid out like that, but this will keep you from setting goals like “I’m going to do better at work”, “I’ll kick my training up a notch”, or “I’ll worry less about what’s going on in other peoples’ lives”. None of those goal statements indicate when you’ll be done by or how you’re going to measure progress.

Here’s a simple example:

In the next month, instead of missing on average three practices per week, I’ll reduce this to one. I’ll make sure that I have things put into my agenda ahead of time so I won’t schedule things over practice sessions, and if something critical comes up last minute, I can use the following week to compensate for it.

  • Specifically about not missing practices
  • Measured weekly by an average of missed practices
  • Achievable because it’s an improvement and not an expectation of perfection
  • Realistic and with the reward of getting to more practices
  • Time boxed to one month.

Start slow and set one or two SMART goals. As you build confidence that you’re progressing in your goals, try adding in another. You don’t want to overwhelm yourself!

Be brave enough to ask for help

If you’re reading this and you’re considering making changes then you’re already starting your path to progress. That’s AWESOME and you’re a strong person for being able to get started.

Sometimes things can get tough though. You might feel you’ve made progress over a few weeks or months and seemingly fall back to square one. You might feel like you’ve set SMART goals but you’re having trouble even getting started. Maybe you read this and still don’t even know how to get started.

There are a million reasons why getting started or continuing can be hard. Be brave though. Ask for help. I can guarantee you have some amazing friends and family that love you that want to see you be successful. There’s nothing to be ashamed of when asking for help! It’s a courageous thing to admit that you’d like assistance on your path for doing better, and people see that. You might feel embarrassed or ashamed, but other people see a brave person trying to move forward.

Summary

It’s a common thing for people to fall into a figurative rut in life. It happens to everyone at some point and it’s nothing to get down on yourself about. You’re not a bad human being if it happens to you, so don’t sweat it.

Analyzing your current situation and why you feel certain ways can help you gain an understanding of what’s going on. Focus on driving out the negativity and create actions to try making progress by leveraging your strengths.

In the end, remember that you control your life and you can make all the positive changes to it that you want to see. It takes time and hard work, but if you put in the effort, you’ll always get to where you want to be.

Now get out there and go kick some ass.


What Makes Good Code? – Should Every Class Have An Interface? Pt 2

Should Every Class Have an Interface?

This is part two in the sub-series of “Should Every Class Have an Interface?“, and part of the bigger “What Makes Good Code?” series.

Other Peoples’ Code

So in the last post, we made sure we could get an interface for every class we made. Okay, well that’s all fine and dandy (I say half sarcastically). But you and I are smart programmers, so we like to re-use other peoples’ code in our own projects. But wait just a second! It looks like Joe Shmoe didn’t use interfaces in his API that he created! We refuse to pollute our beautiful interface-rich code with his! What can we do about it?

Wrap it.

That’s right! If we add a little bit of code we can get all the benefits as the example we walked through originally. It’s not going to completely fix “the problem”, but I’ll touch on that after. So, we all remember our good friend encapsulation, right?

Let’s pretend that Joe Shmoe wrote some cool code that does string lookups from an Excel file. We want to use it in our code, but Joe didn’t use the IStringLookup interface (because… it’s in OUR code, not his) and he didn’t even use ANY interfaces. The constructor for his class looks like:


public ExcelParser(string pathToExcelFile);

On this class, there’s two methods. One method allows us to find the column index for a certain heading, and the other method allows us to get a cell’s value given a column and row index. The method calls looks like:


public int GetColumnIndex(string columnName);

public string GetCellValue(int columnIndex, int rowIndex);

We can wrap that class by creating a wrapper class that meets our interface, like so:


public sealed class ExcelStringLookup
{
  // ugh... we have to reference the class directly!
  private readonly ExcelParser _excelParser;

  // ugh... we have to reference the class directly!
  public ExcelStringLookup(ExcelParser excelParser)
  {
    _excelParser = excelParser;
  }

  public string GetString(string name)
  {
    var columnIndex = _excelParser.GetColumnIndex(name);
    // assumes all of our strings will be under a column header
    var cellValue = _excelParser.GetCellValue(columnIndex, 1);
    return cellValue;
  }
}

And now this will plug right into the rest of our code that we defined originally.

This doesn’t totally eliminate “the problem” though (the problem being that some class doesn’t have an interface (what this post is trying to answer)). There’s still a class we’re making use of that doesn’t have an interface, but it looks like we’ve reduced the exposure of that problem to JUST this class and the spot that would construct this class. Are we okay with that?

Thoughts So Far…

Let’s do a little recap on what we’ve seen so far:

  • Having interfaces for our classes is a nice way to introduce a layer of abstraction
  • Interfaces are just *one* tool to get layers of abstraction introduced
  • If you wanted to have interfaces for all of the classes in your code and some third party didn’t use interfaces, that code is likely not as common in your code base (especially if you wrap it like I mentioned above). This may not always be true in your code base, but it’s likely the case.
  • The amount of work to wrap things can vary greatly. Some things are straight forward to wrap, but you need to add many methods/properties. Sometimes it’s the inverse and you only have a few things to wrap but they’re not straight forward.
  • The number of classes you’d need to wrap to get to this state can vary greatly… Since even built-in System classes aren’t all backed with interfaces!
  • There’s certainly a trade off between the original work + maintenance to wrap a class in an interface versus the benefits it provides.

Is that last point blasphemy?! So there may actually be times we DON’T want to have an interface for a class?

Watch this space for part 3 where we start to look at a counter-example!

 


API: Top-Down? Bottom-Up? Somewhere in the Middle?

A Quick Brain-Dump on API Desgin

I’ll keep this one pretty brief as I haven’t totally nailed down my thoughts on this. I still thought it was worth a quick little post:

When you’re creating a brand new API to expose some functionality of a system, should you design it with a strong focus on how the internals work? Should you ignore how internals work and make it as easy to consume as possible? Or is there an obvious balance?

I find myself trying to answer this question without ever explicitly asking it. Any time I’m looking to extend or connect systems, this is likely to come up.

Most Recently…

Most recently I started trying to look at creating an API over AMQP to connect my game back-end to a Unity 3D front-end. I had been developing the back-end for a little while now, so I had a pretty good idea for how things needed to work from that perspective. The front-end? Not so much really. I knew some basic actions that I was considering, so I tried coding up an early API for them.

A lot of my focus was around how I was going to implement the code on the back-end to make this API work. It resulted in some of the API calls looking a little bit gross. But the idea was that if I settled on an API that would make the back-end easy to implement, I could get it up and running faster.

After a little while, I feel like my API isn’t getting any cleaner from a consumer perspective, and funny enough, it’s not actually as easy to implement as I was hoping on the back-end. Which had me reflect on a work example…

Once Upon a Time at Work…

Well, it was only a couple of months ago, really. I was working with a colleague on integrating a new system into an existing code base. We decided we wanted to approach the API problem from a consumer perspective. We said “let’s make this as easy to call and use as possible so that people ACTUALLY want to use it”.

We set out with this mission, and created a pretty simplistic API. The challenge? There was a lot of heavy lifting and a bit of voodoo going on behind the scenes. But you know what? We hid the magic in one spot of the code (instead of having ugly stuff scattered all over the code base) and it ended up being a very usable API.

So…

So does this consumer-first, top-down approach to API design always work? I’m not sure. Some similarities/differences in the scenarios:

  • In my current situation, I have a back-end implemented and very minimal code implemented on the caller side. In the work example, we had nothing implemented on the back-end, and a ton of code implemented where the caller side would be.
  • In both examples, at least one of the caller side or back-end side was reasonably well understood. For my game, the back-end was pretty well understood. For work, the caller side was pretty well understood and we had experience with what we’d call a “failed’ back-end implementation (that we were actually setting out to redesign).
  • The work example was a relatively small subset for an API, but the game example was about to be a very specific implementation that I’d need to adapt into a pattern for all messaging in my AMQP system

So there’s a few things to consider there. I think I’m at the point in my game where I’d like to revisit how I’m forming this API and try it from a client-first perspective. Now that I know some of the catches, maybe I’ll shed some new light!

How do you approach API design?


What Makes Good Code? – Should Every Class Have An Interface? Pt 1

What Makes Good Code? - Should Every Class Have An Interface?

What’s An Interface?

I mentioned in the first post of this series that I’ll likely be referring to C# in most of these posts. I think the concept of an interface in C# extends to other languages–sometimes by a different name–so the discussion here may still be applicable. Some examples in C++, Javaand Python to get you going for comparisons.

From MSDN:

An interface contains definitions for a group of related functionalities that a class or a struct can implement.
By using interfaces, you can, for example, include behavior from multiple sources in a class. That capability is important in C# because the language doesn’t support multiple inheritance of classes. In addition, you must use an interface if you want to simulate inheritance for structs, because they can’t actually inherit from another struct or class.

It’s also important to note that an interface decouples the definition of something from its implementation. Decoupled code is, in general, something that programmers are always after. If we refer back to the points I defined for what makes good code (again, in my opinion), we can see how interfaces should help with that.

  • Extensibility: Referring to interfaces in code instead of concrete classes allows a developer to swap out the implementation easier (i.e. extend support for different data providers in your data layer). They provide a specification to be met should a developer want to extend the code base with new concrete implementations.
  • Maintainability: Interfaces make refactoring an easier job (when the interface signature doesn’t have to change). A developer can get the flexibility of modifying the implementation that already exists or creating a new one provided that it meets the interface.
  • Testability: Referring to interfaces in code instead of concrete classes allows mocking frameworks to leverage mocked objects so that true unit tests are easier to write.
  • Readability: I’m neutral on this. I don’t think interfaces are overly helpful for making code more readable, but I don’t think they inherently make code harder to read.

I’m only trying to focus on some of the pro’s here, and we’ll use this sub-series to explore if these hold true across the board. So… should every class have a backing interface?

An Example

Let’s walk through a little example. In this example, we’ll look at an object that “does stuff”, but it requires something that can do a string lookup to “do stuff” with. We’ll look at how using an interface can make this type of code extensible!

First, here is our interface that we’ll use for looking up strings:

public interface IStringLookup
{
    string GetString(string name);
}

And here is our first implementation of something that can lookup strings for us. It’ll just lookup an XML node and pull a value from it. (How it actually does this stuff isn’t really important for the example, which is why I’m glossing over it):

public sealed class XmlStringLookup : IStringLookup
{
    private readonly XmlDocument _xmlDocument;

    public XmlStringLookup(XmlDocument xmlDocument)
    {
        _xmlDocument = xmlDocument;
    }

    public string GetString(string name)
    {
        return _xmlDocument
            .GetElementsByTagName(name)
            .Cast<XmlElement>()
            .First()
            .Value;
    }
}

This will be used to plug into the rest of the code:

private static int Main(string[] args)
{
    var obj = CreateObj();
    var stringLookup = CreateStringLookup();
    
    obj.DoStuff(stringLookup);
 
    return 0;
}
 
private static IMyObject CreateObj()
{
    return new MyObject();
}
 
private static IStringLookup CreateStringLookup()
{
    return new XmlStringLookup(new XmlDocument());
}
 
public interface IMyObject
{
    void DoStuff(IStringLookup stringLookup);
}
 
public class MyObject : IMyObject
{
    public void DoStuff(IStringLookup stringLookup)
    {
        var theFancyString = stringLookup.GetString("FancyString");
        
        // TODO: do stuff with this string
    }
}

In the code snippet above, you’ll see our Main() method creating an instance of “MyObject” which is the thing that’s going to “DoStuff” with our XML string lookup. The important thing to note is that the DoStuff method takes in the interface IStringLookup that our XML class implements.

Now, XML string lookups are great, but let’s show why interfaces make this code extensible. Let’s swap out an XML lookup for an overly simplified CSV string lookup! Here’s the implementation:

public sealed class CsvStringLookup : IStringLookup
{
    private readonly StreamReader _reader;
 
    public CsvStringLookup(StreamReader reader)
    {
        _reader = reader;
    }
 
    public string GetString(string name)
    {
        string line;
        while ((line = _reader.ReadLine()) != null)
        {
            var split = line.Split(',');
            if (split[0] != name)
            {
                continue;
            }
 
            return split[1];
        }
 
        throw new InvalidOperationException("Not found.");
    }
}

Now to leverage this class, we only need to modify ONE line of code from the original posting! Just modify CreateStringLookup() to be:

private static IStringLookup CreateStringLookup()
{
    return new CsvStringLookup(new StreamReader(File.OpenRead(@"pathtosomefile.txt")));
}

And voila! We’ve been able to extend our code to use a COMPLETELY different implementation of a string lookup with relatively no code change. You could make the argument that if you needed to modify the implementation for a buggy class that as long as you were adhering to the interface, you wouldn’t need to modify much surrounding code (just like this example). This would be a point towards improved maintainability in code.

“But wait!” you shout, “I could have done the EXACT same thing with an abstract class instead of the IStringLookup interface you big dummy! Interfaces are garbage!”

And you wouldn’t be wrong about the abstract class part! It’s totally true that IStringLookup could instead have been an abstract class like StringLookupBase (or something…) and the benefits would still apply! That’s a really interesting point, so let’s keep that in mind as we continue on through out this whole series. The little lesson here? It’s not the interface that gives us this bonus, it’s the API boundary and level of abstraction we introduced (something that does string lookups). Both an interface and abstract class happen to help us a lot here.

Continue to Part 2


Staying Productive

Staying Productive

Background

I wrote a post a long while back about how I started to use Google Keep to get myself organized. Google Keep has been a go-to app for me on my phone for a long time now. I love using it to make lists of things, and I find it much more convenient than a paper notebook.

Don’t get me wrong–I think a paper notebook still has plenty of uses! I love my notebook for long running meetings with open-ended discussions or brain storming sessions. It’s great to be able to take a pen/pencil and doodle down any idea that comes to mind. When I’m having a free-form conversation, I need a free-form way to take notes.

However, my phone is something I almost always have with me–and my paper notebook isn’t. My phone allows me to take my Google Keep notes and email them to myself. It allows me to have a reminder right on my homescreen every time I unlock my phone. It’s just more convenient.

But something happened since the last time I wrote about using Google Keep. I use it more and more, and at some point I felt like I was getting less and less done. This is less about in the office and more about how productive I feel at home. So how can I be getting less done (or at least feeling that way) if I’m taking my own advice and using Google Keep to hack my TODO list?

I have tons of lists and no actions.

I think that’s the big take away. I list all the things I’m thinking about, and I keep making more lists. There’s no time frame around actioning things with the lists I’m making! So, in the spirit of continuous improvement, I set out to make some changes.

Inspiration

I know I wanted to make some changes with this part of my life because it was starting to weigh down on me; I didn’t feel productive. But I knew this wasn’t going to be something I’d answer over night. I kept my eyes and ears open for ideas for a little while before I thought up some tweaks.

The first thing I came across while living my alter ego was an Instagram post by Big J. Big J is this guy that’s incredibly big and incredibly strong. He’s lived the bodybuilding life and has a lot to show for it… And because being successful in the bodybuilding and strength world means being extremely motivated and hardworking, it’s no surprise I picked up this little bit from Big J:

Simple idea, right? Put some time into planning your schedule for the upcoming days. It almost seems to obvious to not be doing. I mean, don’t I do this already? I have meeting invites and stuff in my calendar for work… But, that’s right! I don’t have anything in my calendar for my own personal things that I like to do outside of work. Hmmm…

The next little tip to push me along was after a conversation with a teammate of mine at work. Our conversation was mostly about work-life balance, but my colleague was telling me about something he was trying out around forming habits. Essentially, over a period of time he’s been recording his success at keeping on top of good habits and identifying reasons why he’s sometimes missing them. Definitely right up the continuous improvement alley! Another great point he brought up was that good habits need to be introduced one at a time and only once you’ve been consistent with your other habits. By adding too much at once, you can derail the whole good habit process.

The “Staying Productive” Hack

This is the hack I’ve been implementing for a bit over a week now, and it’s helped tremendously with feeling productive!

Every night when I’m laying in bed, I spend about 5-15 minutes with my phone and I schedule personal activities in my calendar for the following day.

There it is. It’s not rocket science or something Earth shattering, but it’s definitely helping. Taking a page out of Big J’s book and a tip from my colleague, I’ve modified my schedule to introduce a very brief planning period every day. And it’s just one change that I think is helping introduce a good habit into my life.

This has helped me:

  • Stay on top of prepping food (which is a big part of the lifestyle I try to live)
  • Schedule time to relax (yes, I even schedule time for things like video games!)
  • Schedule time to blog (I run three blogs, and sometimes finding time to write feels like a chore)
  • Work on personal projects
  • … Feel like I’m being productive.

And no, I didn’t drop Google Keep–It actually helps feed into my scheduling! It’s great to look over my lists of things and try to create actions for them.

Next Steps

This simple hack is not only nothing particularly fancy, it’s also not bullet proof! But that’s okay when you’re always trying to continuously improve. Some snags I’ve run into or things I’ve thought about are:

  • How do I adjust my planned schedule when unexpected things come up? If someone drops in for a visit out of nowhere, or my car breaks down, or my dog decides to tear up the furniture, how do I make sure I can continue on with my planned schedule? Right now some things drop off the schedule or I push other things off to compensate. This hasn’t been too big of a problem so far, but sometimes this has a bit of a landslide effect and it makes the rest of the day feel unproductive. A little bit of dirt in the cogs seems to throw the whole thing off for me! This is something I’ll be thinking about as I encounter it and I’ll try to thing of some easy solutions.
  • How can I be more like Big J?! Aside from being bigger and stronger, how can I plan for more days? Big J plans every Sunday but I plan every night for the next day. Is there a happy medium? Planning every Sunday would potentially amplify the landslide effect I previously mentioned, but it would be a convenient single planning session for the whole week. Perhaps I’ll continue with the advice of my colleague and modify one part of my new habit at a time and look at planning for an extra day at a time and see how that goes!

If you’ve been making checklists and find that you’re unable to action items, try this approach! It takes only a few minutes every day, and so far I’ve been having great success in feeling productive. It’s not difficult, so it’s worth a try!


What Makes Good Code? – Patterns and Practices Series

What Makes Good Code?

It’s been a while since I’ve had a programming oriented post, and I figured this would be a great topic to write about. It’s been a topic I’ve been thinking about more and more over the last year and I’ve been experimenting with certain patterns and practices to see if certain things actually make code “better”. A lot of the information presented in this series will be completely based on my opinion, but I’ll try to back up my opinion with as many concrete examples as I can. If you have a differing opinion, I’d love to hear it in the comments.

I’d also like to call out that much of what I’ll be discussing is in the context of object oriented programming. To be specific, there may be mostly C# examples used. If this isn’t something you’re actively doing, then don’t worry! It would be great to hear if you see parallels in the work you’re doing.

What Is “Good”?

So let’s start by defining what “good” or “better” means (and I’ll leave this high level and we can dive in afterwards)…

  • Extensible: Re-writing of code is minimized when adding more functionality. It feels straight forward to extend the code. Developers won’t do “the wrong thing” when trying to extend the code.
  • Maintainable: Many of the same qualities that go with extensible. Fixing bugs or making tweaks involves touching few places in the code base.
  • Testable: It’s straight forward to write coded tests that can exercise functionality of the code under test.
  • Readable**:  Developers should be able to read code and understand what it’s doing. The flow of execution within and between different modules of code shouldn’t cause anyone a headache,

All of these describe qualities of the code. I could argue that you could write very maintainable, extensible, and testable code and it would be awful if it didn’t actually solve the customers’ needs. I’d like to try and leave this aspect out of the discussion, and focus on the actual patterns/practices that we can implement in code. I’d love to write something separate about writing code that actually solves a problem versus code that may potentially solve some possible problem at some potential point in the future (and yes, all of the uncertainty in that sentence was on purpose).

Why Should We Care?

It’s kind of a funny question, I guess, but I think it’s a fair one to ask. Why should we care what good code is? If we agree on the definition of good code, so what? Maybe those criteria for good code are obvious to some people. Maybe they weren’t so obvious to some people, but they still don’t really care. So why the fuss about what good code is?

If you’ve read other posts on DevLeader or you know me personally, you may know that I started work at a digital forensics startup a few years back in Waterloo Ontario. What you may not know is that that startup has grown significantly, and based on the accolades we’ve received as an entire organization, we’re actually one of the fastest growing software companies in North America in terms of revenue. I’m not trying to do the horn tooting without a reason though… I think one of the reasons we’ve been able to have such great success on the development side of things is because we’re always trying to improve.

We didn’t always write “good” code, and we certainly don’t always write “good” code right now. However, we’re always trying to figure out how we can get better. So why might WE care as developers at our office? I think it comes down to trade-offs.

In the real world of software development, you’re often faced with trade-offs. You can get a product out faster if you don’t test it. Or you can get a product out and test it, but maybe you had to take a lot of shortcuts in the code. Or maybe you can get all the features in the product and tested, but you can’t hit the deadline. There’s countless more combinations of trade-offs that we make in real software development every day. I think that by understanding what “good” code means allows a team to recognize just what kinds of corners they’re cutting sometimes. When teams talk about introducing “tech debt”, there’s a better grasp around what type of debt you’re introducing. If you need to get some extra features and bug fixes in but they’re getting added with some tech debt, what could that end up meaning?

Even if you don’t agree with what my criteria are for good code, I think it’s important that you establish this within your team. If everyone can agree on what good code is, it makes constructive conversations about different implementations much easier. Just because some new code is different doesn’t instantaneously make it scary and/or wrong… Maybe it’s a new way that emphasizes one of the criteria for good code a bit more than another implementation might emphasize. Perhaps it doesn’t… You can at least refer back to a reference point for what “good” is.

It’s also important to recognize that the criteria for “good” may change over time. Revisiting the definition periodically might allow you to recognize when your team is redefining what “good” means to them.

Enough Rambling! Where’s This Going?

Right. Okay. I want to write some follow up posts that will focus on a few of the following items:

  • Does every class need an interface?
  • Does every class need a factory that can create it?
  • Unit tests versus functional tests
  • Is there a benefit to only passing interfaces to objects around?
  • Is there a way to enforce that interfaces HAVE to be passed around?
  • Is the single responsibility principle even helpful?
  • Mutability and immutability
  • Is it always good to follow patterns and practices in all scenarios?

And after I feel that I’ve covered enough on these topics, I’d like to circle back and revisit what “good” code is. It’ll be cool to see if the definition changes at all!

**Readability was an after thought and I’m not sure how… I started writing the first example post for this series and QUICKLY realized I had omitted this.


Timur Kernel on 2013 Nexus 7 WiFi (flo)

Timur Kernel on 2013 Nexus 7 WiFi (flo)

Background on Timur’s Kernel

I got fed up with having a pretty crummy head unit in my 2012 Audi TT RS (named Ignantt), and decided that it was time to take matters into my own hands. Part of doing a Nexus 7 head unit install in a vehicle involves powering the tablet up with a USB on-the-go (OTG) cable and being able to not only power the device but also plug in USB devices into the tablet to use. In order to get this working, everyone seems to be relying on this kernel from Timur. As per Timur’s site:

This feature allows you to connect one or more USB slave devices to your tablet and charge it at the same time. This allows you, say, to operate an external USB DAC without the tablet ever running out of power. To use this feature you will need an “OTG charging” – or a std. OTG adapter combined with a USB-Y cable.

Right-o. So yesterday evening after work I spent almost the entire night trying to get this going (aside from eating dinner and hitting the gym). I really feel that this should have been significantly easier for me, and when I reflect on how the whole thing went down, the actual process IS actually easy… It’s just that there are a few points where if you deviate slightly based on your device, EVERYTHING stops working. With that said:

This guide is for ASUS Google Nexus 7 Tablet (7-Inch, 16 GB, Black) 2013 Model only (Android 5.1.1 build LMY48G). It can be adapted to work with other models, I’m sure, but I plan to explicitly call out where my missteps where so that anyone with the exact same hardware as me can have a smoother ride. I also take ABSOLUTELY NO RESPONSIBILITY if you brick your device.

Step-by-Step

  1. Make a folder somewhere on your computer (like your desktop) that you are going to put all of your downloads into.
  2. Make sure you have ADB and FastBoot on your path, OR you put all of the necessary files to run ADB and FastBoot from a command prompt into the folder you made in step 1.
  3. You’re going to need to unlock your bootloader if you haven’t already. Unlocking your bootloader WILL erase your device. Follow the steps outlined here. In short, these steps are:
    1. Enable USB debugging on the device
    2. Open a command prompt in your folder from step 1
    3. Type: adb reboot bootloader
    4. Press enter to execute the command
    5. Wait for the device to boot into the bootloader…
    6. Type: fastboot oem unlock
    7. Press enter to execute the command
    8. Use the volume buttons on the device to change selection to Yes
    9. Use the power button on the device to select Yes
    10. Unlocked!
  4. You’re going to need to flash a new stock ROM to your device. Timur doesn’t call out LMY48G as supported in his instructions, but LMY48T is!) so go to Factory Images for Nexus Devices and download the image for 5.1.1 (LMY48T).
  5. Extract the contents of the LMY48T tar.gz file into your folder from step 1.
  6. Run the flash-all.bat file that was extracted from the LMY48T download. When this completes successfully, you will have a phone in a brand new state…
    1. Follow all the instructions on the device to get set up again with your new factory ROM
    2. Go to “About tablet” in settings and check that build number is now LMY48T… If it’s not, then DO NOT CONTINUE. You’ll need to get LMY48T before continuing with these steps.
    3. Follow all the steps again to get USB debugging available again
  7. You’re going to need to flash a recovery onto your device next. I used TWRP for this. HOWEVER, not just any TWRP worked for me. I needed to use the “multirom” version of TWRP (specifically, I used TWRP_multirom_flo_20150328).
    1. Download the TWRP multirom image to your folder created in step 1
    2. Put your phone into bootloader mode by typing: adb reboot bootloader
    3. Press enter to execute the command
    4. Wait for your phone to enter bootloader mode
    5. Type: fastboot flash recovery TWRP_multirom_flo_20150328.img
    6. NOTE: if you did not download the EXACT same TWRP as me, then change it to the correct file name…
    7. Press enter to execute the command. The device should inform you that flashing worked.
    8. Use the volume buttons on the device to change selection to booting to recovery
    9. Use the power button to select boot to recovery
    10. … You should see the TWRP splash as you boot to recovery
    11. Wait for this to load
  8. You’re almost there!
  9. We need to grab the timur files now. I was a little thrown off when navigating the FTP, but you only need TWO files: the host and the services files.
    1. Download timur-services-N7-2-511e-v3-2015-10-06.zip (or whatever the latest version of services is with 511-e is) into your folder created in step 1
    2. Download timur-usbhost-flo511-v3.0-2015-10-20.zip (or whatever the latest version of usbhost is with flo511 is) into your folder created in step 1
    3. We need to push these two files to the device’s internal SDCARD, so…
    4. NOTE: please use the correct file names in the following commands if yours are different…
    5. Type: adb push timur-services-N7-2-511e-v3-2015-10-06.zip /sdcard/
    6. Press enter to push the file… ADB should tell you if it worked.
    7. Type: adb push timur-usbhost-flo511-v3.0-2015-10-20.zip /sdcard/
    8. Press enter to push the file… ADB should tell you if it worked.
  10. On the device, press the big “install” button on the main part of the TWRP recovery
  11. Add both zips that you pushed to the device (remember, they are in the /SDCARD/ folder and you’ll need to make sure TWRP is filtering by zips)
  12. Flash ’em…
  13. Use TWRP to reboot… mine prompted me to install supersu. I opted for YES.
  14. As the phone is booting up, it may say some stuff about optimizing apps… If it does this for forever and then reboots and keeps doing this again for forever, it’s very likely that you mismatched the timur files… I encountered this problem twice and had to reflash the correct stock ROM again… so head back to step 1 🙂
  15. Once the phone boots up, go to about tablet under settings and check your kernel… It should say timur in there!
  16. If you saw timur in step 15… You’ve done it!

NOTE: If anyone goes through this guide and wants to suggest clarifications, please comment and I’ll try to update it.

Gotchas

  • I had to use the correct version of TWRP (the multiboot one) to get anywhere with this. I tried latest releases of CWM and TWRP but neither could seem to mount my system partition when doing the zip installs. This was incredibly frustrating and probably chewed up around two to three hours of my time debugging. I tried rooting etc… Nothing would fix it. The ONLY thing that seemed to work was TWRP multiboot.
  • My first pass through getting timur kernel installed resulted in a bootloop, which was super frustrating. Timur called out specific builds of Android that his kernel works for, and even though LMY48G wasn’t listed, I guess at which files to use and it failed miserably. Lesson learned. This is why i suggested flashing one of the supported stock Android images RIGHT at the beginning. If you don’t get everything lined up (and he’s explicit about this… I was just being dumb) then you will very likely encounter problems and need to redo everything.

Yeah, We’re an “Agile” Shop

Everybody Has Gone “Agile”

If you’re a software developer that’s done interviews in the past few years, then you already know that every software development shop has gone agile. Gone are the days of waterfall software development! Developers have learned that waterfall software development is the root of all evil, and the only way to be successful is to be agile. You need to be able to adapt quickly and do standups. You need to put story point estimates on your user stories. You need retrospectives… And agility! And… more buzz words! Yes! Synergy! In the cloud! You need it!

Okay, so why the sarcasm? Every single software development team is touting that they’re following the principles of agile software development, but almost no team truly is. Is it a problem if they aren’t actually following agile principles? Absolutely not, if they’re working effectively to deliver quality software. That’s not for me to say at all. I think the problem is that people are getting confused about “being agile”, but there’s nothing necessarily wrong with how they’re operating if it works for them.

Maybe We’re Not So “Agile”

I work at Magnet Forensics, and for a long time now, I’ve been saying “yeah, we’re an agile shop”. But you know what? I don’t think we are. I also don’t think that’s a problem. I think our software development process is best defined by “continuous improvement”. That’s right. I think we’re a “Continuous Improvement” shop. Our team has identified the things we think work well for us in how we develop software, and we experiment to improve on things that we think aren’t working well. I’m actually happy that we operate that way instead of operating by a set of guidelines that may or may not work for us.

So, why aren’t we agile? When I look at the Agile Manifesto, I feel like there’s a few things we actually don’t do, and we don’t even worry about them. We don’t necessarily have business people working with developers daily through things, for example. Our delivery cycles are much longer than a couple of weeks most of the time. Sometimes people on our teams don’t communicate best face-to-face. I mean, just because we’re not focusing on those things isn’t necessarily proof that we aren’t agile, but I truly don’t think we’re trying to embody all of the components that make up agile.

As I stated previously, I do think that we try to focus on continuous improvement above all else, and I’m absolutely content with that. I think that if over time we continued our retrospectives and our team ended up operating closer to a traditional waterfall process then it would be the better thing for our team. Why? Because we make incremental changes for our team in an attempt to keep improving. Switching to waterfall is a bit of a contrived example, but I definitely stand by it. Another example might be that maybe working with business people daily isn’t actually effective for our team. I don’t know, to be honest, because we’re currently tweaking other parts of our development process to improve them. Maybe we’ll get around to worrying about that at some other point.

I do know that the way we operate, we’re always trying to improve. Whether or not we get better sprint to sprint is for the retrospective to surface for us, but if we took a step back, at least we can try a different path when we try to take our next step forward.

So, We Don’t Need To Be Agile?

I think my only point of writing this post was to get this across: If you’re not actually an agile software development shop, then don’t call yourself that. There’s absolutely nothing wrong with not living and breathing agile. Maybe you’re a software shop that’s transitioning into Agile. Maybe you’re moving away from Agile. Maybe you have no parts of your software development process that are agile. Who’s to say that because you’re not 100% agile your setup is bad?

I can’t advocate that agile software development is the absolute best thing for all software development teams. I personally like to think that it’s a great way to develop software, but… I don’t know your team. I don’t know your codebase. I don’t know your products, services, or clients. How the heck could I tell you the best way to go make your software?

Again, there’s nothing wrong with not being 100% agile, but we should try to be honest with ourselves. Find what works for your team. Find out how you can effectively deliver quality software.


Article Roundup: Burn Out

Article Roundup : Burn Out

Burn Out

I had a lot of really positive feedback from my friends and family after writing about my experiences of going through burn out. If you haven’t read the post, check it out here. I’ve done some article summaries on the topic of burn out before, but I feel like it’s probably a good topic to bring up again in light of my recent post.

For a bit of background, burn out is a process that can occur to an individual that’s dedicating too much time to a particular activity. It leads to an imbalance in terms of what his or her time is put towards and can result in a person feeling depressed without any energy. Wikipedia does a pretty good job of summarizing it in one quick sentence:

Burnout is a psychological term that refers to long-term exhaustion and diminished interest in work.

With that said. please enjoy a couple of articles that I’ve surveyed from the web.

Articles

  • Job burnout: How to spot it and take action: This article is from a clinic’s staff, so it has an interesting unbiased perspective. It talks about the lack of drive or interest that people might experience from burn out, which is interesting, because I personally never felt that I started to lack drive or interest in my work. Personally, it was more about losing interest/drive in other areas of my life. I also wanted to draw attention to one of the symptoms the article mentions: irritability with colleagues/clients. This one is pretty dangerous because you can actually cause some damage based on your inability to control emotions because of this. It’s worth noting that if you constantly find yourself irritated by colleagues and/or clients and have some of the other symptoms present, you might be on your way to burning out. If you’ve always been irritated by your colleagues/clients, maybe you’re just sour. 🙂 The list is pretty short, but the article does a good job of covering some of the common causes and symptoms, so it’s worth it for a quick read.
  • 10 Signs You’re Burning Out — And What To Do About It: This article by Lisa M. Gerry speaks to a story very similar to my own. Our burn out experiences were really not something like working overtime for a couple weeks straight… it took years to happen, and that’s why it’s dangerous. Lisa lists several symptoms that should be familiar now if you’ve checked out Wikipedia and the previous article(s).  Interpersonal problems come up again as a symptom and same with cynicism… They’re probably related. The interpersonal problems can come on multiple fronts too, whether it’s an individual removing his or herself from their friends and family, or finding that they’re getting in more arguments (or just plain not getting along) with their friends/family. Lisa goes on to list some ways to get back on track, including cultivating a rich non-work life (something I’m seriously lacking right now) and actually taking a break from work. Those are two really important things, but she lists a handful more.
  • I Came Undone: One Woman’s Horrifyingly Real Experience With Burnout: I really loved this article by Glynnis MacNicol because it felt like the same experience I was going through… Except I never got to the point where I quit my job. One thing I keep pointing out because I feel it’s a bit different is that most people that go through burn out seem to resent their job… But I still love what I’m doing, and maybe that’s the only reason things didn’t go too far for me. Glynnis talks about being overly connected (thanks to social media, smart phones, email, etc…) and how it’s a struggle to actually just go home and be away from work. Are you even able to do that in your career? I’ve always felt like I like being connected to work when I go home so I can help out when it’s necessary… but on days where I’m feeling burdened, I have to explicitly tell myself “Close Outlook. Only use your phone when you want to get a hold of someone. Close the work instant messenger.” It does the trick for me, but I suppose it’s unfortunate that “home time” doesn’t actually mean “time to not work”.
  • Burn out and chronic stress: This one is another sort of “fact sheet” on burn out and chronic stress. It re-iterates many of the same points regarding symptoms of being over-stressed and feeling burnt out, but I liked the latter portion of the listing. Specifically, the very last point on the page says to re-evaluate your priorities and goals. Many of the other posts suggest that taking time off and forcing yourself to slow down are necessary, but few of them actually say to re-evaluate your goals. I think that without re-evaluating, you’re setting yourself up for some difficult times… at least if you’re feeling like me. I know I’m starting to burn out. I know I should slow down… but if I don’t change my priorities around, taking that time off and disconnecting is going to feel like a mental burden to me. How could I remove myself from work if my goal was to get more work done? If I can re-evaluate my goals to say that spending more time with friends and family is important and that taking X amount of time off for myself is important, then it’s a lot easier to convince myself that I actually do need that time off.

Thanks for reading! If you like this post, follow Dev Leader on social media:


  • Nick Cosentino

    Nick Cosentino

    I work as a team lead of software engineering at Magnet Forensics (http://www.magnetforensics.com). I'm into powerlifting, bodybuilding, and blogging about leadership/development topics over at http://www.devleader.ca.

    Verified Services

    View Full Profile →

  • Copyright © 1996-2010 Dev Leader. All rights reserved.
    Jarrah theme by Templates Next | Powered by WordPress