Archive for May, 2021

Objectives & Key Results: First Steps to OKRs

At a Glance – What are OKRs?

If you’ve arrived at this post, you’ve probably heard of OKRs but maybe you’re looking for a bit more of an introduction to them. Not to worry! We’ll keep this light and practical for getting started.

OKRs are a framework for helping define, communicate, and measure progress towards goals. Their intention is to not be specifically top-down, but instead there’s goal setting and transparency that works both ways. Objectives, the ‘O’ in OKRs, are essentially single sentence that communicates what you’re trying to achieve. These should drive the point home at a high level, and there’s nothing wrong with making them feel exciting. Key Results, the ‘KR’ part of OKRs, are the metrics that you will be using to gauge how successful you are to achieving your objective. Usually you group about 3-5 KR’s with an objective, but if you’re just getting started with this I don’t think there’s any issue with trying to just nail down ONE. It might be trickier than you think!

Here’s a little example to demonstrate:

Have a world class service that operates at the speed of light, as measured by:

  • Decreasing response latency on API A from 100ms to 60 ms
  • Increasing throughput on API B from 10 MB/sec to 20 MB/sec

In the example above, the first line is the objective. For this OKR, the objective indicates that we’re interested in having a FAST service. The two line items are the key result portion of this OKR and they both describe two different metrics that we’re looking to improve in very specific ways. It’s also important to mention that like with any good set of goal setting, OKRs are timeboxed. In your work environment, you might do these annually, semi annually, quarterly, or some other interval that allows your team to make progress.

A Closer Look at Key Results, the KRs of OKRs

One of the most important parts about setting your KRs is that these should be measurable and specific with a start and end measure. These are supposed to be used to gauge your success when reflecting back to see if you accomplished your objective, so it’s important that they represent something you can measure. And you’ve probably heard something like “You get what you measure” before and this is VERY true for OKRs. If you put a set of metrics in front of a team and tell them to optimize them, generally you’ll get results specific to those measures! If they don’t actually tie back to represent your objective well, you might get awesome progress but for the wrong reasons.

Another call out is that KRs should not be binary. For example, going from 0 to 1, on to off, or going from a feature not landed to feature landed don’t really make good KRs. These might be specific tasks you need to do to help influence the metrics, but they don’t lend themselves well for progression. Why? Consider an example where you might do 99% of the work in your time period and miss landing the feature that enables allllll the goodness for your change that gets you that huge performance boost. From the KR perspective, that’s still a 0% improvement until it’s landed. How were you tracking your progression to reaching your goal if the entire time you were pinned at 0% progress? How does your team feel to have 0% on target after all the hard work that went into something? How do your stakeholders feel when it’s the last week of your period and you’re still trending at 0%? Nobody is saying it’s easy to avoid, it’s just that it’s not very helpful to pick KRs like this. It’s also helpful to think through situations like this and maybe find ways where you can incrementally deliver functionality to avoid these all-or-nothing situations in general! So ideally, your measurements should be on a sliding scale that allow you to demonstrate progress towards a goal.

Finally, the KR’s you pick for your OKRs should be ambitious but achievable. One of the major purposes of using OKRs is getting alignment to drive change in an area, so the “spirit” of the KRs you’ve picked should be understood. If people find these KRs too easy, then you’re not necessarily getting the most effectiveness out of setting up OKRs to help rally progress in an area. However, if they’re too challenging this might be demotivating if people feel they can’t make any progress. I personally think that aggressive KRs can be great if your team can truly influence the KR metrics in meaningful ways.

… What If There Aren’t Metrics Yet?

Right, so if this is all making sense so far you might be thinking through some potential scenarios relative to your job/team/product/service and thinking “I’d love to improve X, but… we haven’t been measuring anything. How can we even have OKRs if we can’t measure? Isn’t that a requirement?”. Technically, you’re right. But not to worry! We all have to start somewhere.

Personally, I believe getting started with OKRs is the most important part. No metrics yet? Instead, spend time to figure out what you WOULD want. Then, start building the measurements out and try making your improvements as you’re figuring out how to measure things. Is that breaking the rules? Yup, you bet it is. Is it going to be a learning experience and something you can improve on next time? Absolutely. Remember, the “spirit” of the OKRs you’re using is to help drive change.

Going through the OKR process is still a useful exercise, helping you to envision what success criteria might look like. While you may not have rock-solid super granular metrics now, maybe there’s some other things you can infer in the short term to guide you! You don’t have performance telemetry being reported with awesome dashboards? No sweat. You’ve been hearing from customers about 10x per week now that performance isn’t up to par? Great! Start with that. Your goal is to try making improvements such that you hear on average 6x reports about performance per week, and in the meantime, you’re going to start building out that awesome performance telemetry and dashboard. A rough metric might be better than no metric, and maybe next time you want to focus on this, you’ll be in WAY better shape with your new telemetry.

As you’re building metrics out, consider if they something the stakeholders care about. OKRs ideally focus on some understandable business value. Another important aspect is if these metrics are something that change-drivers (i.e. maybe the engineers or other roles on your team) can influence. If people are investing all this time and effort to help influence metrics but the actual measure is something they don’t directly affect, it can be frustrating. Ideally, your metrics are something with clear business value AND something your team feels they can directly influence.

Another thing to consider is if something warrants a rolling-average or trend compared to a value at a single point in time for the metric to be measured. Often times with things like services you might be concerned with trends, and in order to avoid statistical blips or other factors causing noise in your measurements, it might make sense to average your measurements out to smooth the numbers! Continuing with our performance example, if you reached your target one week because you measured your service over a holiday when nobody was using it and the small amount of traffic therefore looked incredible, that might not be a great representation of your actual progress. Conversely, if there was some type of outage or incident that caused your measures to temporarily be outliers, you shouldn’t toss in the towel and give up! Rolling averages can be your friend here but ultimately this is something you’ll want to think through.

Finally… Just Get Started With OKRs!

We just talked about all these “rules” for good KR’s, but especially when you’re getting started, you won’t get it “right” the first time. That’s okay. It’s going to take time, practice, refinement, and building out new measurement methods you might not have yet! Until you’re in the groove of setting up good OKRs, think about what the “spirit” of the OKR is supposed to be. Focus on how your objectives and key results will motivate your team to drive change in the areas that matter.

When you’re creating your next set of KRs, reflect on the previous ones! Continuously improve! Were your goals too easy? Too hard? Were you “gaming” the metrics or did your metrics line up with the “spirit” of the KRs? Did the metrics truly tie back to the objective in the end? Were those responsible for delivering changes empowered by the KRs? There’s so many things to reflect on and try to make sure you’re doing better next time. It’s definitely a process.

At a minimum, OKRs should help focus the team’s attention… And that’s a win even if you don’t have the most perfect metrics and clear-cut objectives. Try some things out. Reflect on your success. Get better. Repeat. You got this!


TileMap – How To Get ALL The Tiles

If you’re building a 2D game in Unity3D, odds are you’ve come across the TileMap component. The TileMap is a powerful tool that allows you to create a grid of tiles that you can render your tiles with instead of hand-placing individual game objects with sprites. It has a host of built in functionality that you might otherwise find yourself manually writing, like mapping coordinates to particular cells on a map. And what’s even cooler about using a TileMap? You don’t need to handroll your own editor to paint tiles! I think I’d pass on having to do that. But have you found yourself in a situation where you want to get all of the painted tiles on a TileMap? You may have found it’s not quite as obvious as you’d have hoped!

What We Have To Work With On A TileMap

As I mentioned, a TileMap can do a lot for you. In particular, I found myself wanting to get all of the cells that have a Sprite associated with them and what that Sprite actually is. We can use the built in method GetSprite for this:

var cellPosition = new Vector3Int(x, y, 0);
var sprite = tilemap.GetSprite(cellPosition);

Simple enough. But how do we know which coordinates to use for x and y? Is it good enough to just go from 0 to a really high number on the x and y axes with two loops and hope it’s good enough? We can do better than that! The TileMap class has a handy property on it called cellBounds. This gives us an integer rectangle that defines the bounds of all of the TileMap cells that have been modified:

tilemap.cellBounds

If you have found you’re doing a lot of editing on a TileMap, you may be erasing sections to focus on another area. If that’s common, you may benefit from calling CompressBounds() to shrink this back down to the currently assigned cells:

tilemap.CompressBounds()

And with all of these, we can approach how we might tie them all together to get what we need!

Be Careful With TileMap.cellBounds And Starting From Zero!

If you have a keen eye, you’ve probably realized that we want to use two loops to go through the cell bounds on the x and y axes to get the cells we’re interested in on the TileMap. You’re spot on! But there’s something we should be careful about here!

It’s an easy mistake to make because it’s how we commonly write loops:

for (int x = 0; x < bounds.max.x; x++)
{
    for (int y = 0; y < bounds.max.y; y++)
    {
        // do stuff
    }
}

But what’s wrong with this? The starting value! You need to be careful when working in 2D space like in Unity. There’s nothing that actually guarantees your Tiles have been drawn starting from position zero on the TileMap and only going in a positive direction. In fact, in my game I had no tiles on the positive y axis! So a simple change to make sure you don’t mess up is use the MINIMUM as your starting point:

for (int x = bounds.min.x; x < bounds.max.x; x++)
{
    for (int y = bounds.min.y; y < bounds.max.y; y++)
    {
        // do stuff
    }
}

Simple as that!

Wrapping It All Up

You’re probably looking for a full-blown code snippet by now. Fair enough. Here’s what I whipped up:

public static class TileMapExtensionMethods
{
    public static IEnumerable GetAllTiles(this Tilemap tilemap)
    {
        // note: optionally call tilemap.CompressBounds() some time prior to this
        var bounds = tilemap.cellBounds;

        // loop over the bounds (from min to max) on both axes
        for (int x = bounds.min.x; x < bounds.max.x; x++)
        {
            for (int y = bounds.min.y; y < bounds.max.y; y++)
            {
                var cellPosition = new Vector3Int(x, y, 0);

                // get the sprite and tile object at the specified location
                var sprite = tilemap.GetSprite(cellPosition);
                var tile = tilemap.GetTile(cellPosition);

                // this is a sanity check that i've included to ensure we're only
                // looking at populated tiles. you can change this up!
                if (tile == null && sprite == null)
                {
                    continue;
                }

                // create a data-transfer-object to yield back
                var tileData = new TileData(x, y, sprite, tile);
                yield return tileData;             
            }
        }
    }
}

public sealed class TileData
{
    public TileData(
        int x,
        int y,
        Sprite sprite,
        TileBase tile)
    {
        X = x;
        Y = y;
        Sprite = sprite;
        Tile = tile;
    }
    
    public int X { get; }

    public int Y { get; }

    public Sprite Sprite { get; }

    public TileBase Tile { get; }
}

The above example provides a nice extension method to get you back a TileData instance for all the populated cells on your TileMap!


TL;DR: Unit vs Functional Tests

Here’s a super quick peek into unit tests compared to functional tests. And full disclaimer here is that depending on your circle of influence, these might be given slightly different names. Try not to dwell on that but instead the comparison and contrast presented!

Unit Tests

Coded tests that take a white-box visibility approach to exercising and asserting that written code, generally a specific function/method, works as it was designed.

Pros:

  • Generally very programmer-focused
  • Very granular coverage (breaks can identify exact lines where an issue occurs)
  • (Should) run extremely quickly
  • Have very little test setup in ideal cases
  • Provide full control (generally via ‘mocking’ dependencies) to exercise very specific logical paths

Cons:

  • Generally more challenging to convey coverage to other stakeholders
  • By nature these are brittle and break with refactoring
  • Require sets of design patterns to help ensure tests are easy to write/maintain
  • Sometimes present false sense of confidence in large codebases (i.e. systems working together) due to mocking requiring assumptions

Functional Tests

Coded tests that take a black-box visibility approach to exercising and asserting that software performs particular functionality as expected.

Pros:

  • Generally easier for non-programmer stakeholders to understand
  • Generally covers multiple classes/systems/methods working together to demonstrate behavior
  • More resilient to refactoring since this approach ignores the internals of what’s being covered
  • Exercises REAL parts of the codebase with no mocking

Cons:

  • More coarse than unit tests. Breakages might need more investigation.
  • Can potentially have more test setup given that multiple things will be interacting

Summary

So which one of these should you and your team be writing? The answer is probably both! There are benefits and drawbacks to both of these testing strategies and they overlap really nicely together. If you know you’re going to be refactoring a complex piece of your system, functional tests would be great to put in place so you can check expected behavior after. Unit tests might be great for mocking out complex dependencies or validating a variety of inputs quickly into a function. If you have an understanding of how you can leverage these, you have more tools in your programming toolbox!

Don’t like reading? Listen to me instead!


What Does an Engineering Manager Do?

This is a question that I see get asked all of the time and I figured I’d chime in on my perspective on it. Specifically, this is with the perspective of a software engineering manager in a tech organization. So, what are the primary responsibilities of an engineering manager at a tech company? Well before I dive in, I’ll explain my background and then I’ll offer up my perspective about the key parts to an engineering manager role.

My Background as an Engineering Manager

First off, here’s full disclosure that I have only been an engineering manager at two different companies. However with that said, I have been an engineering manager at two extremely different types of organizations for just under a decade now. My role at Magnet Forensics as an engineering manager started off as a team-leadership role when we were still a scrappy startup. As we hired on more folks, I helped lead small teams (sometimes 10+ but generally settled around 4-8) as a mix of software engineers and software testers. I was fortunate enough to grow along with our product offering, but only until shortly before I left was I still writing code regularly and managing small teams.

At Microsoft, I’m responsible for a team of under ten direct reports and I have several remote “dotted-line” reports (i.e. they have their own manager, but they’re working with my direct reports as a cohesive team). The work we do is nothing like my previous role, but what’s common is that we have some business requirements, some constraints, and really smart engineers working towards working through these challenges. A fundamental difference is that at Microsoft my team is entirely composed of engineers and no other dedicated roles (i.e. software testers). We carry out work differently but my focuses in my role are very similar.

A lot of my philosophies around management and leadership boil down to focusing on servant leadership. That’s not to say this is the only way an engineering manager can be successful, but as I discuss the focus areas this will likely shine through.

Engineering Manager Roles Are Different Everywhere

I think this is the first critical thing to call out, so if you’re going to take anything from this it’s the following:

An engineering manager at one organization may have very different expectations placed upon them compared to another organization, so if you're pursuing a career at a company as an engineering manager, research and understand how that company structures this role.

This might not be obvious to some people, but it’s true and it’s worth the time to understand. Some organizations place the emphasis of an engineering manager entirely around people interactions and career progression. Some have a large focus on managing projects while others have expectations that an engineering manager is directly contributing to the code base. If you’re interested in this type of role, hopefully you know where your interests and strengths are (and if not, I urge you to reflect and think about this!) so that when you’re evaluating organizations you can find a good fit.

Engineering Managers Put People First

Well in my opinion at least, the good ones do. The people that engineering managers lead are the most important part of their role. Ensuring that their team is engaged, working on challenging problems, learning, has access to the tools and resources they need, feeling supported in their career, etc… All of these aspects are the primary part of the role. They’re all intertwined and influence each other so finding the right set of challenges can ensure people are learning, but different challenges might be more engaging. And while something might be more engaging, it might not be well-suited for someone progressing at their particular career stage.

While all of these things are focus areas for all of the individuals on the team, an engineering manager also needs to keep in mind that… they’re individuals! In order to be effective they need to ensure that they’re leveraging situational leadership and truly working with people one on one. It’s something that’s easily overlooked by many even though it might feel glaringly obvious when you read it. Different people are at different points in their career. Different people appreciate different types of recognition. Different people are motivated by different challenges or learning opportunities. There’s different perspectives. Different career history. Different culture. Everyone is different. An engineering manager truly needs to understand this to be an effective leader because a cookie-cutter approach to trying to lead a diverse team won’t go very far.

It’s important to note that even in roles where the engineering manager has a technical individual contribution portion of their regular work, the overall effectiveness of the team will outweigh individual contributions. It can certainly be a trap especially if the engineering manager is highly technical and productive in the technical domain, but trying to remain a multiplier for the overall effectiveness of the team should be paramount. Between ramping up more junior people to be more effective, giving principal level engineers opportunities to focus on design and strategy, or finding new advanced challenges for senior engineers, finding the right way to bring out effectiveness in the team through situational leadership is the goal here.

Engineering Managers Understand Business Needs

There’s an element to the engineering manager role that is focused on a blend between project and product management. For clarity, I define (in a short version) project management as the process of managing time and resource allocation pertaining to work efforts and product management as interpreting customer requirements as work efforts. These two things together allow an engineering manager to understand shifting timelines and understanding changes in business priorities. It can be very difficult to lead a team if the engineering manager lacks the ability to coordinate the team members effectively or adjust to roadmap changes (as inevitably happens).

And when organizations have dedicated roles for either/both project and/or product managers, it’s still beneficial for the engineering manager to have a deep understanding of both of these. If not solely responsible, they will generally still be actively coordinating with these roles. Effectively, the engineering manager helps represent the team to these roles by relaying team status and needs while also bringing feedback back to the team to adjust as necessary. Depending on the size and complexity of the organization, an engineering manager may spend a large portion of their time actively collaborating with individuals in product and project management positions across a variety of intersecting teams.

Engineering Managers Are Technical

Some might say this isn’t a must, and while I agree it may not be a must, I think it’s really valuable! So I like looking at this as a spectrum to make it a bit more understandable. On one end of the spectrum there are individuals that can jump right in and be an active individual contributor with an extremely high degree of effectiveness. In software, this could look like someone that can work in the codebase to add features or fix bugs or otherwise has a high-degree of understanding of all of the systems working together. On the other end of the spectrum, there are individuals that understand the domain just enough to check the box for understanding the business needs. In my experience, there generally seems to be an inverse relationship between how technical an engineering manager is and how well they focus on the people on the team. It’s not a rule though. I think the really good ones keep up the technical focus without skipping a beat on all the people-related responsibilities.

And it’s a tricky balance. The more time spent working with people and coordinating with other stakeholders, the less time there is for individual contribution. In many engineering manager roles, there isn’t even an expectation of individual contribution so it’s especially hard to keep up on the technical details. The engineering managers that I’ve seen balance this well may not be so far on the technical side of the spectrum that they can dive into the codebase, but they have an overall architectural view. They can also understand and relay technical aspects from team members to other stakeholders, and similarly apply stakeholder feedback with more technical context when communicating back with the team.

Aside from some of the obvious benefits technical skills bring to communication and coordination, I think an aspect that is overlooked comes down to trust and respect of team members. In my personal experience, I have seen engineering managers get buy in from team members when they can prove they understand the technical challenges the team has to work through. Suddenly the engineering manager becomes much more relatable and in those delicate situations where an authoritative decision must be made, it’s easier to get behind it when you trust the person understands the technical details.

While not every engineering manager role may define expectations around technical aspects, I do think that it’s extremely beneficial.

In Summary

To recap, everything discussed is my perspective from my career as an engineering manager and software developer. It’s not the only way, but I think it touches on three of the most important aspects:

  • Focus on enabling people on the team to do their best work
  • Understand project and product requirements to translate between the team and stakeholders
  • Have a thorough technical understanding of the domain to tie this all together

RPG Game Dev Weekly #1

As I’ve been trying to get more YouTube content put together more steadily, one of the themes I’m interested in is doing some behind-the-scenes of the role playing game (RPG) I’m making with some friends in Unity3D. I’ve found that being able to work on an RPG outside of my regular day job is a really awesome way for me to keep up on my technical skills. I love coding, and the further along I move in my career as an engineering manager, the less time I actually spend writing code myself. I pride myself in being a technical engineering manager, so for me working on this RPG is a great outlet for creativity and practice. I mentioned this in my LinkedIn post here:

Persisting Game Objects Across Maps

In this video, I focus on one of the challenges the game was facing due to how objects are materialized onto the playable map. The map that we load from disk to be shown and interacted with in the playable RPG commonly has “templates” and “spawners”. Both of these are responsible for creating objects at runtime given some criteria. As a result, uniquely placed game objects appear on the playable map for the player to interact with.

Sounds good then, right? Well the two challenges I focused on addressing were:

  1. If we leave the map and go to another one, there’s no way to persist the player across maps! That means you get a brand new character every time you transition maps. In an RPG, this is definitely not going to work out.
  2. If we return to an existing map, we expect it to be in the same state as when we were last on it. This means that the objects generated from templates or spawners must remain and NOT be respawned (which would effectively make completely new game objects).

Check out the video below:

RPG Dev Log 1 – Persist Game Objects Across Maps

Persisting Map Game Objects in a Cache

Next up was actually implementing some of the changes being discussed previously. In order to make this work in our RPG, my goal was to:

  1. Allow maps to save a lookup of the unique IDs for game objects that were generated
  2. Save the list of game objects generated into a “cache”
  3. Upon revisiting a map, tap into the “cache” to reload the existing game objects

One of my mental hurdles with this was acknowledging that we don’t yet have a solid serialization foundation for our game. I was thinking I’d want to serialize the game data to something persistent to make this work, but I was also worried writing things to disk would be overkill (and how does this mix with save game concepts?). Instead, I opted for the lightweight approach was “get something working” and I can revisit this later to extend it to persist things to disk if necessary.

Check out the video below:

RPG Dev Log 2 – Persisting Map Game Objects in a Cache

Which Domain Does This Belong To?

We’ve been trying to practice Domain Driven Design (DDD) concepts in our game. One pattern I’ve taken to an extreme is over-separating domains into very granular pieces and the result is that we have HUNDREDS of C# projects. It’s overkill, for sure. However, I feel that it’s offered some flexibility in having boundaries we can collapse later. My experience so far has told me it’s easier to collapse boundaries than it is to split.

This is all and well until we have situations where I need a class that has knowledge of two domains. That’s what this next video was about. I talk through acknowledging that I don’t know what to do and that I’ll move ahead with something best effort. I think the answer to my dilemma is that I need to translate things into a new domain for usage, but it feels like overkill. If you have thoughts on this leave a comment on this post or on the video!

Check out the video below:

RPG Dev Log 3 – Which Domain Does This Belong To?

Death Animations For All!

Finally, this last update was about something hopefully less boring… Death animations! I worked through how:

  1. I can extend our reusable sprite animation factory to create a death animation to be reused by ALL our actor sprites
  2. I can build a system that checks actor life and changes the animation as necessary to death

Unfortunately I had some hiccups the first time through recording this, but I wanted to code the whole thing live. After a Blue Screen of Death interrupted my first attempt, my second attempt I think worked pretty well! Without much code at all we could get this system fired up and it worked the first time! Well, close. I didn’t realize that our animation system already supports an animation that has an “infinite” duration final frame (in this case, the body laying on the tile). This is handled by a null value instead of a set length in seconds. I fixed it right after recording! Overall, I was incredibly happy with the result.

Check out the video below:

RPG Dev Log 4 – Death Animations For All!

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