Question

Refactor before making the change or refactor after making the change?

Discussion

I feel comfortable doing both. I encourage everyone to practise both. I do both. I see them both as objectively equal in value and therefore consider it a question of personal preference.

In order to add behavior, I usually have to generalize some part of the design: adding this behavior breaks some convenient simplifying assumption that the design used to make. Either I notice this assumption before I start writing code or I don’t. When I recognize this assumption up front, I can refactor before making the change; when I don’t, I discover the assumption as I make the change, then I start refactoring in the direction of breaking that assumption. I don’t believe that one approach “is better” than the other. I feel comfortable doing both, so then I don’t have to worry about whether I see the generalization before I start writing code.

It also depends on my goals for refactoring. When I was focusing on building general refactoring skill, I allowed myself to do more refactoring than needed, because I needed to learn. When I am refactoring in an unfamiliar kind of language (functional compared to object-oriented), I might refactor more speculatively in order to see more of the patterns. When I feel very comfortable refactoring, then I am happy to invest that wisdom in delivering more value sooner to the customer, because I feel confident that I will clean up enough before moving on. In an unfamiliar situation I often try harder to refactor before making the change, but then as I feel more comfortable, I refactor more after making the change.

It also depends on the bottlenecks near me in the system. If I am the bottleneck (or near it), then I pay special attention to pushing new behavior as early as possible, then refactoring, and then pushing the better-designed version later. In this situation, I aggressively reduce the cost of delay. And if I’m not the bottleneck, then it matters less, and instead I act more selfishly. Sometimes I just refactor more because I enjoy it more.

Question

Is it worth building a continuous build/integration/deployment pipeline before releasing an MVP?

Discussion

If we have a very small team building an MVP, then we might not benefit very much from a continuous build pipeline, because we already work closely together and coordinate with each other directly. Continuous integration might simply happen because we talk to each other. For that reason, I might recommend establishing that pipeline only if we clearly have spare capacity to invest in it. We almost always have spare capacity, but sometimes we don’t, and I wouldn’t want to waste much of our capacity on something that doesn’t directly help us receive marketing feedback about the product.

If we notice that releasing a version of our product has suddenly become a bottleneck (and not deciding the features nor challenging our understanding of those features), then we certainly need to automate that part of our work.

Question

We had a joke, that Estonians are always asking “Do you really need that?” after being asked for something. Doesn’t that assume that the asking side is stupid and doesn’t know what’s wanted?

Discussion

Not always, but sometimes! Most importantly, the person hearing “Do you really need that?” might interpret that question in the way that you describe. If we have not yet established strong trust, then we carry a strong risk of this difference in interpretation. As part of learning to work as a consultant, I had to learn to ask “Why?” and “Are you sure?” in ways that do not carry this negative meaning. I can share a couple of techniques.

Sebastian tells me about some feature that they need in the product. I say, “That sounds good! I need to understand this a little better so that we can talk about it in more detail. I’m curious. If you had that, then what would you do with it?” I sometimes refer to this as my “Magic Wand” technique: if Sebastian trusts me more, I wave a magic wand, make a funny sound, and say, “OK! Now you have it. What will you do with it?” When I ask this question, I explore the benefit or the unmet need that lies behind what Sebastian has asked for. I ask this because I might be able to meet that need or provide that benefit in a different way and do that sooner or for a lower cost or in a way that generates more value or in a way that accepts less risk. When I ask this question, Sebastian more likely sees me as trying to understand him, rather than merely challenging his decision. Later, as we build more trust, I will feel comfortable challenging his decisions more directly and more openly, and he will probably trust doubt my motives less than he would now.

I ask a few similar questions:

  • What would that give you? (Try emphasizing all the different words here. This question works like magic!)
  • What about that feels particularly important to you?
  • What bad thing goes away when you get that?

I find that when I express genuine interest in understanding Sebastian’s request, he trusts me more. I had to learn to feel genuine interest to understand Sebastian’s request. That required some practice.

Sometimes I need to resort to a trick. My favorite example comes from people who work at the help desk for an internet service provider. These workers encounter customers who do not understand much about the various boxes in their home: their computer, their monitor, their cable modem, their router. Worse, these workers encounter customers who believe that they know quite a lot about those boxes, which causes them to feel impatient when the help desk workers asks very elementary questions. At some point, the help desk worker suspects that a cable is not connected, but they don’t want to embarrass the customer by asking, “Did you plug in the cable?” The customer confidently assumes that they plugged in the cable. Instead, the help desk worker says, “In rare situations, we have problems with these cables, and sometimes we can detect those problems by reversing the cable. I know it sounds silly, but would you please disconnect the cable at both ends and connect it the other way around?” When the customer does this, of course, they discover that the cable was not connected at one end, but they don’t need to admit this to the help desk worker. Using this trick, the help desk worker communicates something important in a way that explicitly reduces the potential embarrassment of the customer. I didn’t invent this trick, but I could imagine inventing this trick if I felt enough genuine compassion for the other person and could empathize with their need to avoid embarrassment while at the same time solving the underlying problem. As usual in these situations, more compassion tends to help.

Question

How to raise my price if my boss/manager tells me, “there are no indispensable people”?

Discussion

If someone doesn’t need you, then they don’t need you. I don’t know how to raise my price in that situation. I can only raise my price when I can give them more value than the money they would pay me. In the situation that you describe, I might need to move to another department or quit my job before my boss/manager discovers that they indeed would have been happy to pay me more to bring me back. Even if they learned that, maybe they would not feel comfortable asking me to return. Because of all this, I would probably need to turn my attention elsewhere.

Someone else might need you and have more money to pay you. Maybe you need some develop some skill that increases the chances that someone will need you and happily pay you more. Maybe you already have this skill, but you don’t know how to advertise that fact very well. Maybe you are advertising it well, but you don’t understand your market well (the people who would buy from you, if they knew that you existed), so the people who know you won’t pay you and the people who would pay you don’t know you. If you addressed these issues one by one, then you might find it easier to raise your price.

Question

What do you think about code reviews?

Discussion

Many things. Most people do them poorly. Most people do them too late to use the feedback effectively. Most people don’t agree on why they are doing code reviews, so their code reviews often create more stress than benefits. I prefer to play the game, “What’s not to like about this code?” This game goes one level of abstraction higher than a code review, encouraging people to talk in more general terms about what they look for when they review code. After some time talking about these things more openly, code reviews typically become more valuable.

Question

What’s the best software development (programming) related book?

Discussion

I have no idea which one is “best”. :)

I really like Computer Science Distilled and Structure and Interpretation of Computer Programs. I also really liked Code Complete and Writing Solid Code.

What are you trying to achieve by finding the “best” book? Are you trying to find the next book that you should urgently read? If so, then I need to know much more about you before I could answer that. Feel free to tell me more about you at https://tell.jbrains.ca and maybe I could make a better recommendation to you.

Question

How to explain the value of refactoring to business?

Discussion

I have written about that here: “The Eternal Struggle Between Business and Programmers”.

Question

Where should I invest my newly-found spare capacity after I’ve learned to save 30 minutes in my programming work? Pair programming? Selfishly refactoring on my own?

Discussion

I don’t know you well enough to advise you on what you “should” do. If we spoke for 20 minutes I might be able to help you further. Fortunately, we might not need to do that at all.

It almost doesn’t matter. Follow your energy. If you intend to make the code better and you learn something, then every choice is a good choice. If you make the code better, then everyone wins. If you improve your own skill, then you could use that skill to teach others how to make the code better, and then everyone wins.

I can identify at least one big risk: as you improve the code, your ideas about “better” and “worse” might diverge from the other people who live in that code base. This divergence could create friction. You will eventually need to talk to those people and reach agreement with them about how to write the code “better”. In the process of doing this, you might need to teach them something, and they might not feel interested in learning. Congratulations! You have now become a consultant. Good luck.

Question

Can you share a few examples of how you apply the ‘be selfish’ idea in personal life?

Discussion

Yes, I’m happy to do that.

My wife and I left our families behind in the Toronto area in order to save significant amounts of money in our daily lives. We did this in part because I had identified a strong risk of health-threatening stress from my work. We reasoned that if I worked less, I would be able to manage that stress much better, and we decided that leading less-expensive lives would give me the clearest opportunities to work less. We moved away from Toronto, reduced our cost of living by about 70%, and this gave me the freedom that I needed to be able to recover from burnout and depression. (I have recovered significantly, but not completely. I might never recover completely.) If I hadn’t insisted selfishly on working less, then I can only imagine how stressful my life would feel, and I likely wouldn’t be able to help anyone with anything outside the demands of my day job. I would have very little left to give to anyone.

I compete in bowling, and as part of that, I volunteer as a coach, both to children and adults. I do not, however, volunteer to do the administrative tasks that amateur sports organizations typically need: organizing events, raising funds, running the organize from week to week, promoting the organization locally. I do not do these things for two key reasons: I travel for work and therefore I can’t do these things effectively throughout the entire bowling season and in some cases, I don’t connect personally enough with my local community in order to do these things effectively. For example, I don’t know how to promote amateur sports to parents of small children, because I can’t relate to them as parents (and I don’t particularly like small children). Accordingly, I limit my contributions to the ways that I can easily contribute, which typically involves donating money and organizing the occasional short-term private coaching program. It would probably help them if I formalized this coaching program, but I can’t commit to doing it on a predictable schedule for more than 2-3 months at at time. I never commit to more than I can be certain I will be able to do.

I intentionally don’t answer much of my email in “a timely manner”. Often when I answer email, I write the answer now, but schedule the reply to be sent a few days later. I do this in order to reduce the arrival of new email into my inbox, so that I have slack time and energy to reply to the truly urgent messages. I consciously and relentlessly protect my capacity to answer emails so that I have more capacity to handle truly urgent issues as they arise. Ironically, by acting less responsively, I make myself more responsive, not by managing my time better, but by not overusing my energy when I happen to feel more of it. For the same reasons, when I answer questions from the general public, I make no clear commitment about how soon I answer questions unless they pay me. I don’t do this to try to earn a little extra money, but I do it in order to avoid wasting precious energy on feeling guilt or shame for not answering them “quickly enough”. By drawing a clear line between a free level of service and a higher level of service that costs some money, I more clearly differentiate volunteering, which I do entirely on my own terms, and a job, which I do entirely as a way to exchange time and energy for money. I could probably volunteer more in the short term, but if I don’t differentiate volunteering from a job, then I might accidentally sign up for a job that doesn’t pay me “enough”. I know that if I have a job like that, then I won’t give it the attention it deserves, and that would hurt people who had reasonably expected more from me. By clarifying what is a job and what is volunteering, I do both things much more attentively, with more love, and in a way that better benefits everyone involved.

Question

I am constantly copy/pasting code from stackoverflow. Can I call myself a “developer”?

Discussion

Call yourself whatever makes you happy. Either way, I get paid the same.