DEV Community

Cover image for Are you feeling overwhelmed? Refactor your assumptions
Jean-Michel 🕵🏻‍♂️ Fayard
Jean-Michel 🕵🏻‍♂️ Fayard

Posted on • Updated on

Are you feeling overwhelmed? Refactor your assumptions

I've read a lot of what fellow developers share on this platform.
First I would say that I'm grateful. They have been super helpful.

What I have also noticed is this pattern:

Lots of developers are exactly as insane as I often am about all the things that they supposedly need to know. And that make them sweat and feel stressed.

This insanity comes from a good place: the desire to know always more. That's the mark of a good developer.

Permanent stress is making you sick

But it comes at a steep price: permanent stress is a poison.

Stress was invented by Nature to help you survive to dangerous situation. Stress is helpful, indeed life-saving, to escape predators and accidents on the highway. But then it has to be released or you will be sick.

Permanent stress in the modern world is a poison that you should not manage but refactor.

So let's try to refactor our assumptions.

You may learn one thing or two about Kotlin and Refactoring while doing so.

Internal dialog

If I had to guess what is your internal dialog when you stress like this, it would look something like this

fun main() {
    val developer = Developer(name = "You?")
    developer.feelsOverWhelmed()

    // Ok, but why?
    developer.hasSoMuchThingsHeHasToLearn()

    // 🤔 Are you sure?
}

fun Developer.feelsOverWhelmed() = true

fun Developer.hasSoMuchThingsHeHasToLearn() {
    val youWantToBeSuccessfull = true
    val youCanStopProcrastinating = true
    if (youWantToBeSuccessfull) {
        if (youCanStopProcrastinating) {
            println("""You should learn full stack programming, 
                    iPhone, Android, AWS, DataScience""")
        }
    }
}

data class Developer(val name: String)
Enter fullscreen mode Exit fullscreen mode

Ok, so you think you have to learn JavaScript, Front-End, Back-End, iPhone, Android, AWS, DataScience.

Wow. That's a lot.

That's too much.

But thank you for submitting your internal dialog for me to review.

Here are a few things that I notice.

It's not about you

It's not only about you, the function feelsOverWhelmed() is true for everybody.

JetBrains IntelliJ helpfully highlight this issue and proposes a quick fix.

overwhelmed-1

I apply the fix.

overwhelmed-2

Does feelsOverWhelmed() function now feels meaningful to you? 🤔

To find out, I try to apply the refactoring option: Inline function.

overwhelmed-4

Oh, did you notice what happened?

IntelliJ simply removed the part about feeling overwhelmed.

Rightly so. That you sometimes feel often overwhelmed tells me nothing about you, apart what I already knew:

You are a developer.

Everyone wants to be successful

You still have so much thing to learn, so let's move on.

overwhelmed-5

Ok, you wants to be successful.

Who doesn't?

That tells me exactly nothing about yourself.

IntelliJ highlight the issue nicely once again if you press Alt-Enter on your boolean expression.

overwhelmed-6

Ok then, I simplify the boolean expression.

Everyone procrastinates

Your code now looks like this:

overwhelmed-7

I press F2 which is the shortcut for the action Next highlighted error.

overwhelmed-8

Why does IntelliJ suggest to delete the expression?

Again, that you procrastinate tells me nothing about yourself except that you are a normal human being.

I mean some can certainly pretend they never procrastinate, which we tell us that they are not very good at self-awareness.

But you are better than that.

So yes, I delete that expression.

overwhelmed-9

"Success is good, procrastination is bad"

Again, I press F2 and Alt-Enter for the quick fix.

overwhelmed-10

The IDE is right.

All those hot takes that "Success is good and procrastination is bad"?

They mean nothing. We can let them go.

I remove those variables.

Again, there is nothing wrong with you

After removing the unused variables, I am left with..

overwhelmed-11

F2 and Alt-Enter. You are becoming good at this stuff!

As you can see, there is no reason for you in particular to be stressed about.

overwhelmed-12

I apply the fix.

overwhelmed-13

Heck, why do we even need this developer variable and Developer class?

They are not sparking joy so we let them go.

Baby steps

Ok, we are left with an empty meaningless function.

overwhelmed-15

We inline it as we did for feelsOverWhelmed():

overwhelmed-16

No Stress

So that's the final state of how I think you should refactor your internal dialog that was making you sweat.

overwhelmed-17

An algorithm to start eliminating permanent stress

  1. Become aware of your stress.
  2. Pause. Breathe.
  3. Realize that permanent stress is never necessary.
  4. write down what is stressing you.
  5. Later you will find a solution to eliminate the stressor.
  6. Hint: speaking to someone you trust usually works wonder.

Learning Kotlin and refactoring in IntelliJ

To practice refactoring your internal dialog in IntelliJ, start by downloading IntelliJ Community Edition here

https://www.jetbrains.com/idea/download

If you want to learn Kotlin, have a look at my article:

Yersterday, someone asked me if I have a newsletter he can subscribe to.

Not really, but if you insist, you can enter your email here:

https://jmfayard.substack.com/p/coming-soon

Caveat: I might never use it.

Oldest comments (3)

Collapse
 
fultonbrowne profile image
Fulton Browne

This is now one of my favorite dev post

Collapse
 
jmfayard profile image
Jean-Michel 🕵🏻‍♂️ Fayard

I guess that you are like me and feel often overwhelmed :)

Collapse
 
fultonbrowne profile image
Fulton Browne

I also love the kotlin analogy.