00:00:00.000
Hey.
00:00:22.740
Okay, so our last speaker is Abraham Sangha. He spoke last year or the year before.
00:00:30.579
Last year at Mountain West JavaScript, which was a sister conference to Mountain West Ruby, and he gave just as fantastic a talk.
00:00:38.379
So again, the question is, I really like to know where Abraham's head is at a year later.
00:00:44.379
I really like to leave something at the end of Mountain West. I love to leave something I can do, what Abraham said last year.
00:00:51.220
So I'm very, very pleased and grateful that Abraham agreed to come back and talk to us again.
00:00:58.830
I'm really looking forward to it, so thank you for coming.
00:01:15.310
Thanks for having me! My name is Abraham, as Mike mentioned. I'm talking about TDD for your soul.
00:01:21.170
If you're confused, I think that's appropriate. I'm going to explain exactly what I mean by that.
00:01:29.509
But you can tweet. I would love to hear your comments, critiques, whatever you have to say.
00:01:36.200
Let me know. As I would say to my friends, get at me. Just let me hear it.
00:01:42.439
So TDD for your soul means virtue through software development.
00:01:48.319
I'm assuming everyone here knows what TDD means, but just in case, let’s quickly review.
00:01:55.670
We can summarize it with three steps: red, green, and refactor.
00:02:01.970
Red is writing a test or a spec that fails. Green is writing the code to make that test or spec pass.
00:02:08.269
The third step is refactor. Refactor is changing the code to improve readability and elegance while maintaining its behavior.
00:02:14.870
That's the refactoring step, and then you start over again at step number one.
00:02:20.870
So that's TDD—test-driven development. Now, what's the "for your soul" piece?
00:02:28.579
I'm sorry, so how TDD helps me is when I'm at this stage in software development where the world is my oyster.
00:02:35.060
Every option in the universe is available to me, and I just don't know where to start.
00:02:40.160
Often, it helps for me to start with writing a spec.
00:02:47.269
I like how Davis put it in a blog post: it's about figuring out what you're trying to do before you run off half-cocked.
00:02:52.519
So there's some intentionality there. There's a purposeful step in writing a spec.
00:03:04.340
Now, I didn't explain the "for your soul" piece yet.
00:03:09.650
So what does TDD for your soul mean? Let me illustrate with an example from one of the greatest characters in modern TV, Walter White.
00:03:15.769
How many people know who this is? Okay, good, we're on the same page.
00:03:23.509
He can never be sure, you know. But so Walter White, he's a genius.
00:03:28.810
He uses his powers not for good, but for evil. He builds a meth empire.
00:03:35.120
I'm not giving away anything by letting you know that. Science is not a self-directing process.
00:03:41.600
It can be used for good or for evil. So as people involved in science and technology, we have the same opportunity.
00:03:48.970
We can use our powers for good or for evil, and what I propose is that we need a lot more good in this world.
00:03:54.199
If everyone in this room united under that vision, I think we could do a lot of good.
00:04:01.400
So that's the premise of my talk: TDD for your soul.
00:04:07.250
Now, let me just be clear. I didn't get into software development with these lofty thoughts in mind.
00:04:13.250
And if you work with me, you might say I don't even live up to them.
00:04:20.539
So glad I'm coming all the way out here to Salt Lake City to give this talk. I'm from Chicago.
00:04:28.610
I appreciate that. When I got into coding, I had much more base desires.
00:04:35.000
I had much less lofty goals. My goal was really simple: I got into coding to get paid.
00:04:40.880
You know what I mean. Someone else knows what I'm talking about.
00:04:45.970
I wanted to eat olives out of a goblet. That's where I was headed.
00:04:50.539
But what I found through the process of learning how to code, developing software, and working on a team was this:
00:04:56.030
the process of software development was not just a chance for me to grow my technical abilities.
00:05:04.340
It wasn't just an opportunity to feed my family. It was a chance for me to become the best Abraham that I could be.
00:05:10.640
So hopefully, at the end of this talk, you can see that same path, that same process, is available to you.
00:05:15.680
Now, in order to talk about what that means, I'll be using the four cardinal virtues.
00:05:23.169
For thousands of years, moral philosophers have discussed the cardinal virtues.
00:05:30.110
Everyone here looks pretty virtuous to me, but I saw some really shady people up in the top.
00:05:34.620
I don't know if you guys have been up there.
00:05:39.990
So for them, I'm going to explain what the four cardinal virtues are.
00:05:46.250
They are self-control, courage, justice, and wisdom—self-control, courage, justice, and wisdom.
00:05:55.370
The first one is courage. What does courage have to do with software development?
00:06:00.890
My lack of self-control came out quite a bit when I first started learning how to write code.
00:06:10.060
I would be staring at a screen, similar to this one, feeling defeated. I felt anger and frustration.
00:06:17.410
It was hard because I was often at Starbucks trying to learn how to code.
00:06:26.930
I don't know if anyone else has been in that situation, but it's difficult.
00:06:34.270
I didn't know how to read a stack trace. I didn't know it was actually giving me clues as to what was wrong.
00:06:40.990
It was very frustrating. My lack of self-control showed in these moments.
00:06:49.960
I want to see something starting to happen after this talk.
00:06:59.560
As developers, we need to think about how we can help each other with our lack of self-control.
00:07:05.590
We may use an example like the law of Demeter. The law of Demeter is summed up simply.
00:07:12.000
An object should only talk to itself or its neighbors.
00:07:18.310
In an object's method, it should talk to its parameters and that sort of thing.
00:07:25.400
But when you see code with a trail of dots, there’s a smell.
00:07:32.700
There’s something happening there where that there's overreach. We see data being accessed across multiple objects.
00:07:39.840
We know what we want, and we know how to access it. But reaching across three or four objects can cause issues.
00:07:47.180
So, the law of Demeter is a constraint we put on ourselves to write good code.
00:07:53.350
But it takes self-control to adhere to these constraints.
00:08:01.000
It’s hard to talk about self-control in our context.
00:08:07.330
This is the Platonic ideal of a workplace, and I don’t think I could explain to my dad.
00:08:13.240
Working the sewers in Chicago, what self-control means in coding.
00:08:17.000
You ever have moments where you’re struggling with self-control in programming?
00:08:23.590
As developers, we want to know what's right and true, and we need to tell everybody.
00:08:30.390
Self-control can be difficult, especially when we oscillate between despair and megalomania.
00:08:38.060
It's not a healthy way to live. How do we demonstrate self-control?
00:08:43.700
We have desires and impulses, and we need to control them. Are we controlling them or are they controlling us?
00:08:51.450
My dad taught me everything through action movies. He said a man’s gotta know his limitations.
00:09:01.179
Self-control is about knowing who you are and your limitations.
00:09:07.930
It’s about being honest about them and regulating them through good habits.
00:09:13.440
When we think about self-control in coding, we can think about what it means to live in a self-controlled way.
00:09:20.000
The next virtue is courage.
00:09:26.600
What does courage have to do with coding? Courage is the ability to overcome fear.
00:09:34.860
A lot of fears we have are centered around failure.
00:09:39.800
When thinking about coding, we often consider how to handle exceptions.
00:09:44.300
When writing a mixin, how do you handle exceptions?
00:09:51.950
If the action you're attempting doesn't happen, do you let anyone know?
00:09:59.610
Utilizing custom exceptions makes it easier to debug and find stack traces.
00:10:08.400
Transparency about your failures, or errors, is essential.
00:10:15.500
How can we look at courage from a broader perspective?
00:10:22.380
There's a lot of courage in engineering itself.
00:10:31.000
Facing challenges without the necessary context is often the case when developing.
00:10:38.580
We are sometimes given a story or a set of requirements without clues on how to dig in.
00:10:46.000
But that challenge is often what we look forward to, and that takes courage.
00:10:53.700
Richard Feynman said the excitement comes from making discoveries.
00:11:01.340
Similarly, pair programming requires vulnerability and courage.
00:11:06.610
It's exposing your thought process in real-time, which can be daunting.
00:11:13.540
Many developers struggle with this, especially if we feel confused or lost.
00:11:20.390
Sharing through pairing can lead to incredible learning opportunities.
00:11:32.000
But it still takes courage to jump in and show vulnerability.
00:11:40.030
This is one of the earliest pieces of code I wrote; it finds the mode of an array.
00:11:46.450
It's convoluted and horrible. Don't look at it too closely.
00:11:54.260
However, it worked at the time, and I was happy with it.
00:12:00.430
A more experienced friend sent me his solution, which was elegant and concise.
00:12:08.160
I thought, "Wow, what can I learn from this?" I learned a lot from his example.
00:12:14.110
Courage is about being open to learning and embracing the growth mindset.
00:12:20.600
Brené Brown said courage starts with showing up and allowing ourselves to be seen.
00:12:35.240
This brings up questions about our lives: are we living courageous lives?
00:12:45.810
Shame can prevent us from our goals. Are we letting fear control our lives?
00:12:53.870
Next, let's look at justice. What does justice have to do with writing code?
00:13:01.689
Justice is depicted as blind to symbolize an impartial process of weighing obligations.
00:13:09.090
Fulfilling one's obligations and giving to each what is owed is a simple definition of justice.
00:13:16.699
Justice in software development can mean recognizing unfulfilled obligations.
00:13:24.599
It’s about understanding our obligations to others when writing code.
00:13:34.570
The code that we write does not solely belong to us; it belongs to everyone.
00:13:43.460
Writing organized code and fulfilling obligations helps create better, maintainable code.
00:13:50.960
In this way, justice is about being flexible and adaptable in our coding to meet external demands.
00:13:58.840
Just as design is more about preserving changeability than achieving perfection.
00:14:07.999
This relates to justice because writing code that fulfills obligations is flexible.
00:14:15.240
Michael Sandel stated that thinking about justice compels us to consider how we should live.
00:14:20.390
Reflecting on our obligations can lead us to live more just lives.
00:14:27.610
Now, let's explore wisdom. What does wisdom have to do with coding?
00:14:35.360
Wisdom is about making good choices and navigating through complexities.
00:14:43.030
When Uncle Bob talks about design patterns, he highlights that they are proven solutions to common problems.
00:14:50.920
These patterns embody wisdom accumulated over years.
00:14:57.010
While coding, we learn from others’ experiences and wisdom by using established patterns.
00:15:04.000
Confucius shared three methods to learn wisdom: by reflection, imitation, and experience.
00:15:12.110
Reflection is the noblest path; imitation is the easiest, and experience is often the hardest.
00:15:20.080
Some developers gain wisdom by reflecting on problems they’re familiar with.
00:15:27.210
Others learn by imitation, while many find wisdom through hard experiences.
00:15:35.030
We all deal with inflexibility in code that we’ve written and come to regret.
00:15:41.800
We learn that some decisions need revising through painful lessons.
00:15:48.110
So, let's take wisdom and examine how it applies beyond coding to our lives.
00:15:55.660
Do we have time set aside to reflect and consider our own lives?
00:16:03.170
How many people have mentors or examples they wish to imitate?
00:16:10.890
Are you suffering through experiences to gain wisdom, or are you learning through others?
00:16:18.180
We've talked about the four cardinal virtues: self-control, courage, justice, and wisdom.
00:16:27.990
I like how Alasdair MacIntyre put it in his book, After Virtue.
00:16:35.270
We could define our self-improvement plans like TDD for our souls.
00:16:43.030
Ask yourself: Who am I? Who ought I to become? How do I get there?
00:16:50.660
For example, if I want to grow in self-control, I write a failing spec for it.
00:16:57.580
Let’s say my goal is to get up early, which means I need to go to bed early.
00:17:05.450
So, I set a concrete goal: I will close my laptop at 9 PM every night.
00:17:13.970
Then, I either pass or fail that test. I build up habits over time.
00:17:20.800
Once I can achieve this goal of closing my laptop at 9 PM, I pass that spec.
00:17:28.960
At that point, I can refactor that goal and consider how to maintain self-control.
00:17:34.150
TDD for your soul encourages writing tests against your life.
00:17:41.020
It’s about defining where you want to be and the virtues that can guide you.
00:17:47.810
As you establish goals that may initially fail, work towards becoming that virtuous person.
00:17:54.660
I could end it here and walk off stage, and everyone would applaud.
00:18:01.830
But I want to say a little bit more.
00:18:07.900
I think a lot of us might resist the process of TDD for your soul.”
00:18:15.740
This resistance often comes from shame—a sense of lacking worthiness.
00:18:23.230
We might question why we would write failing tests about our lives.
00:18:30.500
Why would we admit to a lack of courage or acknowledge our shortcomings?
00:18:38.800
Many may feel fine despite poor decisions, prompting resistance to changing.”
00:18:46.550
Shame can whisper that we’re not good enough.
00:18:53.020
However, those failures can lead us to a better place.
00:19:00.410
I want to share something important using a reference from the series Firefly.
00:19:07.520
Shepherd Book tells Mal, 'I don’t care what you believe; just believe it.'
00:19:12.280
In times of struggle, it’s vital to have something important to hold onto for improvement.
00:19:18.350
Similarly, my process of developing virtues stems from my beliefs.
00:19:26.550
For many Christians, this week evokes powerful reflections of overcoming shame with resurrection.
00:19:35.710
It forms the basis of how I combat shame and pursue virtue.
00:19:42.390
What is your basis for combating shame? How do you fight against it?
00:19:48.740
In Chicago, where I’m from, the blues serves as a metaphor for processing pain.
00:19:56.890
It captures the essence of keeping painful episodes alive while transcending them.
00:20:04.510
Similarly, our vulnerabilities don’t have to lead to shame that halts our growth.
00:20:09.960
Our failures can encourage us to create character and refine who we are.
00:20:17.420
The world needs individuals with self-control, courage, justice, and wisdom.
00:20:25.000
As we reach the end of my talk, I hope you see a clear path forward.
00:20:31.620
Together, we can become better programmers and better people.
00:20:38.360
So, let's work towards being the best versions of ourselves.
00:20:48.270
Thank you!
00:20:53.550
Yeah, that's a great question. Let me repeat it.
00:21:02.260
Basically, how do I incorporate the content of this talk at work?
00:21:08.000
I appreciate that. I think, to be honest, I’ve struggled with that a bit.
00:21:14.550
When I put it out there at work, it means I have to live up to it.
00:21:20.780
I want to do that, but I haven't given this talk at any workplace yet.
00:21:29.610
I think that I ought to, as you've given me something to think about.
00:21:37.850
Currently, my moments of reflection happen on the train to work.
00:21:42.970
I wear headphones to listen to lectures or music, and I’ve been journaling.
00:21:49.960
You have to carve out time for those moments.
00:21:56.950
The question was where do I find time for reflection?
00:22:02.810
The virtues are subjective, and we all define them in different ways.
00:22:09.900
How do I write these tests and get external validation?
00:22:16.040
That's a great question.
00:22:23.660
For me, I am part of a religious tradition, so I have guidance.
00:22:31.360
But for those who aren't part of such traditions, finding a shared meaning is crucial.
00:22:38.540
It is essential to have a community that helps define what wisdom or courage looks like.
00:22:47.220
I need the feedback from people who care about me; my wife is good at that.
00:22:54.940
Leading into the next part, what led me to this direction?
00:23:04.310
We live in a broken world, and I think about how we can be better.
00:23:10.900
Learning through analogy was natural for me while learning to code.
00:23:18.220
It started as a small lightning talk and grew from there.
00:23:24.450
I kept giving talks because people responded well to this concept.
00:23:30.800
The question was, what's my metric for measuring growth?
00:23:39.650
There's no simple answer; it depends on your context and who you are.
00:23:50.270
Growing virtue is a lifelong journey.
00:23:57.190
It will never be over until you die.
00:24:02.800
Thank you for your great questions.