Recent Posts (page 20 / 67)

by Leon Rosenshein

Continuous Education

One of the things that I think is important for developers is continuous learning. There’s always something. From new fields to new techniques in an old field to new tools to really understanding the toolsets that are already in use.

Consider MS Word (or Google Docs). It took me a surprisingly long time to really internalize how to handle simple layout in those tools. Using page and section breaks instead of just hitting enter a bunch. Or using “Repeat as header row” for big tables. It takes a little longer at first, but until you really start doing things that way you end up spending a lot of time manually fixing the format of things. And still end up weird gaps in your docs where you used space to format and then something else changed and screwed it up.

The same is true for most (all?) of the tools we regularly use. Shell aliases. Shell pipelines. Git power tools. Rectangular operations on VSCode/Jetbrains/<Editor of choice>. There are the things we do all the time, the things we do occasionally and look up the details for, and things we have workarounds for, because we never figured out a better way.

One of the reasons I like to work through problems with others, beyond the immediate benefit of a fresh viewpoint and different experiences, is learning more about the tools we share, but use in different ways. Next time you’re pair/ensemble working with someone and you see someone do something in an interesting way stop and get more details. It’s a great way to learn something new, and if you’re in a group setting, you probably won’t be the only one.

Another great resource is MIT’s Missing Semester of your CS Education. A set of sessions that talk about using the tools of the trade. Not the algorithms, data structures, compiler design, or architecture patterns. Instead, how to get the most out of your tools. Automation. Validation. Consistency. How to remove friction from your daily life. Because very often the best way to be faster overall is not by increasing top speed, but by removing drag when you’re going slowest.

by Leon Rosenshein

Like A Baby

Slept like a baby

Taking candy from a baby

Taking baby steps


What do those phrases mean to you? The generally accepted meaning is something like

Slept like a baby        -> Slept soundly and deeply

Taking candy from a baby -> Easy

Taking baby steps        -> small tentative steps

I’ve got 4 kids, and let me tell you, in my experience, reality doesn’t match that. Babies may fall asleep at random times, but they can fight it if there’s something interesting to them, and when they do fall asleep they’ve all got unique hair triggers that will wake them up and keep them from going back to sleep.

Have you ever tried to take something from a baby or toddler that wants what it has? It’s not easy. If they hold it it’s theirs. If they can see it, it’s theirs. If they once saw it and want it now, it’s theirs. When my oldest was a baby she got a hold of her hair and wanted to taste it. But it wasn’t long enough, so she pulled on it. It hurt so she grabbed tighter and pulled harder. You can see where this is going. We had to pry her tiny little fingers out of her hair to get her to calm down. Definitely not easy to take something they want.

Baby steps. When a baby goes from crawling to cruising he furniture to walking they do take small steps. But that’s because their legs are so short. They can’t take bigger steps. But I wouldn’t call them tentative. All walking is falling with style, catching yourself before it’s too late. But babies don’t know that they can catch themselves. They throw it all out there and hope. Eventually they figure out how to catch themselves. That’s not tentative. That’s confident and assertive.

By now you’re asking what this has to do with software development. First, easy things often aren’t. After all we’ve got compilers, so anything is possible, but that doesn’t mean it’s easy or that it has no other impacts. Ownership and boundaries are real obstacles. And just like my daughter and her hair, we’re dealing with systems with inherent feedback loops, and sometimes those loops can make things worse. Putting a load balancer in front of multiple instances of a service makes things more scalable and resilient, until you hit some point and a slight delay in one instance causes the entire system to become unstable and fall over.

Second, doing things in small steps. Doing things in small steps makes sense. Do the smallest thing that you expect to add value. You don’t know if it will since you haven’t done it. But do it completely. Do the whole thing. If refactoring is needed, do it. If data migration is needed, do it. Take the step. Then catch yourself. Reevaluate and do it again.

That’s how software development is like talking about babies. What about slept like a baby you might be asking. That’s just there because it’s wrong, just like the other two, and I think lists should have at least three items, or they’re not lists.

by Leon Rosenshein

Realms

“Bounded Contexts” sounds stuffy and arcane, the sort of term whiteboard warriors would cook up so henceforth I’ll refer to them as “Realms” because Realms have boundaries and Context is King.

    -- Dan Bara

As I’ve mentioned, I think context is important. And I like bounded contexts because boundaries are important too. They help in knowing what you need to worry about and what you don’t.

But as Dan points out, the term bounded contexts is pretty abstract. It’s not a term used in the physical world. Noone points to a patch of ground and says “That’s a bounded context”. Also, “bounded context” sounds static to me. It makes it seem like the bounds are fixed, unchanging.

I think that does a real disservice to people trying to learn about them. Because there’s a lot of tension on the boundaries. Is something inside or outside? Should it be inside or outside? If it were up to the thing itself, would it want to be inside or outside?

Which is where Realms comes in. Realms have clear borders. Often there's some kind of process/ceremony when you change realms. Sometimes there's even a cost. Meanwhile, the realm is held together by a shared something. A context if you will, that all inhabitants of the realm agree on. They might not all like it, but while inside the realm they use that context. Sometimes a group leaves. Realms get split apart. Sometimes realms join, like the cities of Buda and Pesht. Sometimes there’s struggle, and sometimes it’s easy, like Pheasant Island. The key though, is dynamism and tension.

The same holds true with software and bounded contexts. In your typical e-commerce system you’ve got customers, orders, inventory, and more. Which domain is pricing in? Is it part of the inventory? What about sales and specials? Coupons and discount codes? Preferred pricing? Are they all their own domains? Lots of options. All are correct in some ways, but incorrect in others. So you pick one. Then you pay attention to the tension. And when necessary, the boundaries shift. Just like in the physical world.

I’m still going to call them bounded contexts, because in the ubiquitous language of software development the term has shared meaning, but in the back of my head I’ll keep the idea of realms and their tension in mind.

by Leon Rosenshein

More Comments

Code should be self documenting. That sounds good, but what does it mean? It’s about making your code legible. Names of things, variable, method, class, package, library, executable, etc should mean something. What the code is doing should be obvious from reading. Encapsulation and decomposition helps a lot here.

Writing the code itself is a conversation between you and the compiler/interpreter. It has to be very precise in what it does. And since it defines what happens, it is the ultimate source of truth for how things will be handled. But it’s not the source of truth for everything that was in your head during the conversation.

That’s where comments come in. They’re a conversation with the next developer that provides context for the maintainer. Even (especially?) if it’s you. Things like why the code was written this way. The external constraints that had to be met. The choices not taken. Things that work fine now, but will be a problem later when scale changes.

And since they’re a conversation with another person they don’t have the limitations of whatever language you’re writing in. They can be about more than the why. You can talk about approximations. You can talk about generalities. You can talk about how this piece is expected to fit into the bigger picture without breaking your encapsulation. You can have simple artwork like flowcharts or truth tables. You can even have links to entire documents that provide even more context.

So don’t let anyone tell you that your code is fully self documenting and there’s no need to add comments. Your code isn’t, and there is a need.

Just don’t add comments like this

// Increment i
i++;
by Leon Rosenshein

The Tyranny of Or

“The test of a first-rate intelligence is the ability to hold two opposed ideas in the mind at the same time, and still retain the ability to function.

One should, for example, be able to see that things are hopeless and yet be determined to make them otherwise.”

― F. Scott Fitzgerald, The Crack-Up

A or B? Pick one. Many problems are answered that way. And maybe they’ve even been posed that way. But is A or B really a binary choice? Sometimes it is. But often it’s not.

Think about code reviews vs pair/ensemble programming. Code reviews are imperative and the only way to ensure quality code. Pair/Ensemble programming is critical and the only way to ensure quality code. Code reviews (or PR reviews) were instituted to solve a number of problems. Knowledge transfer. Bug detection/prevention. Adherence to the style guide. Getting a different perspective. What about pair programming? Shared knowledge. Bug detection/prevention. Shared style. Team cohesion.

Both methods are pretty good at achieving their goals. And those are pretty similar. On the other hand, code reviews can slow things down and knowledge transfer isn’t perfect. Pair (and especially ensemble) programming can miss parallelization of clearly separable work and you lose the benefit of a different perspective. So you have to choose one or the other. Right?

Maybe. You could do both as well. That gets you all the benefits. But it also has all the downsides. Maybe there’s a better approach. A hybrid approach that avoids the tyranny of or.

Defense in depth. Code in small groups. Talk a lot. Share approaches and changes as you develop. Automate as much as you can. Adherence to style guides. Lint for common structural issues. CI and automated tests, both unit and integration, so you know you haven’t had an unexpected impact on downstream customers/consumers. Selective code review from interested/relevant downstream partners and people more familiar with the ecosystem in general and environment, when appropriate. Get the benefits of both, and minimize the downsides.

Which is not to say that binary decisions are bad and that we should never make them. There are true binary choices. Especially when you look at other constraints. But just because something is presented as a binary choice does not mean you have to make one. Take the time to make a good decision in context, because, like all good decisions, it depends.

by Leon Rosenshein

Legibility

Definition of legible

1: capable of being read or deciphered
legible handwriting

2: capable of being discovered or understood
murder sweltered in his heart and was legible upon his face

-- Merriam Webster

The first one you know. UI/UX/Design stuff. Being easy to read. But the impact, positive and negative, of making things legible, especially the second definition, runs way deeper than choice of font size and foreground/background color.

Code can be readable and completely illegible. Green text on a black background with a monospace font that makes it easy to distinguish between 1 (the number one), I (the capital letter `eye`), and l (the lowercase letter `ell`) will make your code readable. But it doesn’t do much to help with discovery or understandability.

At the simplest, legibility in code comes from clean code. Separation of concerns. SOLID. KISS. DRY. All those acronyms. If you do those things reasonably well your code will be reasonably legible. At least at the tactical level.

But having truly legible code goes way beyond that. It’s about applying the same principles you would apply to a module/library to an entire system. It’s about your abstractions and data models and APIs. It’s about making sure that the system is understandable/discoverable at both the large and small scales, and that it’s easy transition between the levels as needed.

One thing that’s important to keep in mind while making things legible is that your model(s) of the system need to truly match reality, not just how you want reality to be. Take a complex system, make some simplifying assumptions, idealize things, and make it happen. When you do that it often feels correct, because you have control over what you’re doing. It’s predictable, understandable, and subtly wrong. But you won’t know it at first. It will mostly work. Until you hit that edge case.

So you patch around it. Until the next edge case. Rinse and repeat. Pretty soon your simple, elegant, legible system is none of those. So you come up with a new model and try again. And that cycle repeats.

Unless your models acknowledges that things aren’t that simple. That they allow for unexpected interactions. And that’s hard. Especially in large systems. 

by Leon Rosenshein

Prioritization vs. Categorization

MoSCoW. The method, not the capital of Russia (or any other city) or the mule.


Must: The system must meet these requirements or is considered a failure
o
Should: The system should meet these requirements, but if it doesn't we can do it later
Could: The system could meet these requirements. No one will object, unless there are must and should requirements that are unmet
o
Won't: The system won't do this. It will make the system worse and/or any time spent on these things is completely wasted. Don't do them. 


Seems pretty straightforward. The differences are clear. Do them in that order. You don't need any more information so get to work,

Not so fast. There are at least a couple of problems here. First, those are just labels. Labels on buckets of similarly important things. There's no sequencing provided inside a bucket. What happens if there are more items in the must bucket than there are teams to work on them? Even if there's enough time to serialize them, you don't know which one should be done first. So it's really categorization.

If there's only one team, and the requirements are all completely orthogonal, sequencing doesn't matter. Of course, in all the time I've been doing this I've never worked on a project like that. And I don't know anyone who has. It's probably happened somewhere, but it's rare enough to not worry about right now. Which means sequencing is important.

Second, while those are words, not numbers, there's really no difference between Must and Priority 1 (or 0, or -1). It's just the group with the highest importance. And they both suffer from the same kind of inflation. Every group/team/stakeholder thinks their problem/requirement is the most important. Or if not critical overall, critical to them, so they label it must. Because we all know that the shoulds almost never happen and they coulds are there for amusement only.

Which is not to say that categorization is unimportant. It's not. It's critically important. But it's not enough. You have to go beyond the categorization and really prioritize. You need an ordered list of what's the most important, balancing urgency and short and long term gain. You need to keep that list current. And most importantly, you need to follow it. Even (especially?) when a single stakeholder starts arguing loudly for their favorite thing.

by Leon Rosenshein

Problem Solving

A puzzle is a problem we usually cannot solve because we make an incorrect assumption or self-imposed constraint that precludes a solution

    -- Russell Ackoff

Similar to the XY Problem and my favorite question, “What are you really trying to do here?”, when you get stuck on a problem, make sure you understand the space you’re working in.

In development those constraints often come from the existing systems. The data structures and flow that are in use to solve the problem as it was understood last week. They were appropriate then, and we used them to solve that problem.

But this week we know more. And might understand the problem differently. But our first instincts are to treat all of the previous work as constraints on solving today’s problem. That’s a good place to start. After all, it worked so far. And it will likely work again.

Unless our new understanding of the problem has changed the underlying assumptions enough so that the constraints we’ve built for ourselves have become part of the problem. Maybe even the biggest part of the problem. Then you need to take another look at your assumptions and make sure they’re not holding you back.

Consider a workflow system. At first, getting things working and making the work flow is the problem and you can relegate problems and issues to some kind of exception handling. As the system matures and workload increases you continue to make things more robust. Smoother running. The percentage of issues goes down. But the raw number of issues goes up.

Until at some point the sheer number of issues, no matter how rare, becomes an issue itself. You reach a point where you can’t solve the problem by making them even rarer. Your problem space has changed. Your system has changed from a workflow system to an error handling system. The workflows keep happening, but instead of focusing time and effort on making them happen, now you need to focus on handling errors.

Which means the assumption that you can ignore errors is now incorrect and the place you’ve been stashing them for later is now a constraint. When you need to solve the current problem you need to revisit those constraints. You need to remove them from the problem solving at least, and probably from the system as well. And that’s OK. The code works for us, we don’t work for the code. If it needs to change then change it. Solving the problem, adding value, is the goal, not working within the existing constraints.

That doesn’t mean you should throw everything out and start again. That (almost) never works. You need to find the balance. And finding balance starts with knowing which of your assumptions and constraints are real, and which are just there because they’re comfortable.

by Leon Rosenshein

(Work) Spaces

"Multitasking" is probably too crude a category. When I first heard of XP, I thought pair programming was the *second* stupidest idea I'd ever heard. The stupidest was everyone working in the same team room (*not* an "open office"). But…

   -- Brian Marick

That’s something that resonates with me. And also a big part of what I miss about going to the office. I’ve been doing this programming thing for a while now, and I’ve done it in a lot of different environments. Before I was getting paid for it, it was late at night, alone as a teenager in my bedroom, in the back of a high school classroom mostly ignoring the calculus teacher (Sorry Mr. Topper), or in some cold, noisy, basement computer lab with rows and rows of computers.

Once I started getting paid it was still the noisy computer room, but sometimes the seat was in an F-16 simulator (since we only had one monitor and that’s where it lived) or the control room for the simulator (after we got another monitor). In the late 80s and 90s it was single offices with doors. Some folks wanted offices with outside windows, others wanted no windows (even at Microsoft, some folks didn’t like windows). It was easy to isolate yourself and focus on what you were doing. That meant it was also easy to lose track of time, what others were doing, and how what you were doing fit into what everyone else was doing. So it was easy to convince yourself that being busy was productive and you were making lots of progress.

By the mid 2000’s that started to change. Lots of open offices. Or at least multi-person offices. I’ve worked in both. Some team rooms were full rooms, with doors and windows and everything. Others were more ad-hoc, using whiteboards and couches and plants and room dividers to approximate separation. And there were general open-plan offices, with people loosely grouped by team, with the only separation being a slightly wider walkway between rows of desks to give some appearance of grouping.

One goal was to increase collaboration and interaction. Get folks who worked together to sit together and they’d talk more. Share more. Collaborate more. The other, usually unstated, but very real, was to reduce the space per person. At Microsoft the offices were at least 100 sq ft, often 150 - 200 for leads and people who often had small meetings in their office. Sharing offices and bullpens be 50 sq feet or less of “personal” space. 

It turns out that both the open plan and the individual office style are about the same. Whether physical (walls and doors) or virtual (noise cancelling headsets and social constructs), they both tend to isolate and reduce face to face interactions. There’s a little more talking, but we’re all aware of how common it is to Slack someone on the other side of a shared row, and while that’s effective for the communicators it’s isolated from the rest of the team.

Which gets us back to team rooms and what I miss most about being in an office. The team (or activity) space. The place set up to contain all of the people and information that is shared by a group of people working on something together. The ability to be loosely aware of a conversation and join in when it’s relevant, and when it’s not let it just seep into my unconscious awareness of things until I need to know.

The most productive, effective, and fun team I’ve been on was the team that delivered a shared viewing/editing platform for 2D, 3D, and streetside maps.  And it happened because we were in the same space. Somewhere between individual and mob programming. Discussing designs and implementations in real time. Changing things together. And right around the corner from our customers. So we had lots of chances to watch what they did and what their problems were. Opportunities to bring them into our space and try things together. Making changes in one area and having people working on related areas at least aware, if not involved in the decisions. Rapid iterations. Rapid releases. Rapid feedback.

There were lots of causes for that. The right physical space(s). The right motivations. The right incentives. The right tools and processes. The right people. In the same place at the same time working on the same thing.

I really miss that.

by Leon Rosenshein

Inversion

Goals are important. Knowing what you’re doing and why can help clarify things when you need to make a decision. Turning that around helps. Knowing what you’re not going to do is just as important.

Sometimes questions are like that too. Ask a question one way and it can be hard to answer. Invert the question and it can be a lot easier. Consider the following question:

Which one of the following does not have an integer cube root?

  1. 216
  2. 27
  3. 1331
  4. 700

The naive way is to calculate the cube roots and see. If you have a calculator that’s easy. Without, not so much. On the other hand, it’s relatively easy to calculate the cube of a number. If you change the question to which numbers are perfect cubes you can quickly come up with this table

1 -> 1
2 -> 8
3 -> 27
4 -> 64
5 -> 125
6 -> 216
7 -> 343
8 -> 512
9 -> 729
10 -> 1000
11 -> 1331

And see that 216, 27, and 1331 are perfect cubes, so 700 must not be. 

You can apply the same kind of question inversion to other things as well. Like debugging. When debugging the first question is usually “Why did that break?”. Often it’s helpful though to first go through the “How is this supposed to work?” cycle first. Especially if it’s an area new to you. 

Maybe performance is your thing. In performance, you normally ask “How can we speed this up?”. But maybe what you really need to do is to keep things from slowing down. That’s a different question, and the answer might be very different.

Really, it’s about perspective. Having the right one at the right time. Because how you look at things will influence how you see them. And how you try to change them.