Ruby Community
TDD For Your Soul: Virtue and Software Engineering

Summarized using AI

TDD For Your Soul: Virtue and Software Engineering

Abraham Sangha • December 02, 2014 • San Diego, CA

In the presentation titled "TDD for Your Soul: Virtue and Software Engineering," Abraham Sangha explores the intersection of software engineering and personal character development through the lens of Test-Driven Development (TDD). While TDD is a methodology used for writing quality code, Sangha posits that this process can be applied to self-improvement and cultivating virtues that enhance both professional and personal life. He emphasizes four cardinal virtues: self-control, courage, justice, and wisdom.

Key points discussed include:

- Self-Control: Sangha reflects on the importance of self-control in software development, sharing his own struggles with maintaining composure while coding. He explains how TDD helps developers set clear goals and overcome obstacles by guiding intentional actions, which fosters self-discipline.

- Courage: The speaker highlights the necessity of courage in facing challenges in engineering, such as embracing pair programming, which involves real-time collaboration. He illustrates that being vulnerable and open to feedback during such interactions can lead to personal and professional growth.

- Justice: Justice, according to Sangha, translates into writing maintainable and fair code that respects the needs of future developers and users. He encourages developers to consider their obligations to the community by ensuring their code is accessible, changeable, and serves a broader purpose beyond immediate needs.

- Wisdom: Wisdom is achieved through reflection, imitation, and experience. Sangha urges engineers to allocate time for thoughtful contemplation and learning from others. He emphasizes that wisdom allows developers to recognize patterns and avoid past mistakes, which fosters ongoing improvement.

Sangha concludes with an important message about the value of introspection in one's journey toward growth. He encourages listeners to embrace their flaws without succumbing to shame, urging them to transform challenges into opportunities for character-building. He emphasizes that the quest for virtue not only improves coding skills but also enhances their lives as they become better human beings. Overall, the talk encourages participants to embark on a path of self-reflection and continuous improvement, ultimately aligning their professional practice with their personal values.

TDD For Your Soul: Virtue and Software Engineering
Abraham Sangha • December 02, 2014 • San Diego, CA

By, Abraham Sangha
Software engineering pushes us to our limits, not only of cognition, but, perhaps surprisingly, of character. Using the cardinal virtues as a framework, we can see that developers need courage to learn, temperance to prioritize goals, a sense of justice by which to discern, and wisdom to act. By being honest about where we lack virtue, and implementing steps to develop character, we can perform TDD on ourselves. This process can help us grow not only as coders, but as human beings.

Help us caption & translate this video!

http://amara.org/v/FrHH/

RubyConf 2014

00:00:18.240 Well, welcome to my talk! It's called "TDD for Your Soul," subtitled, as you can read, "Virtue and Software Engineering."
00:00:23.599 TDD, just for those of you who weren't sure what that meant, is an acronym for Test-Driven Development.
00:00:28.679 Sure, most of you know that already, but Test-Driven Development is an approach to writing software.
00:00:35.120 A lot of people find it beneficial; I like it myself. It helps in a lot of ways in your process.
00:00:42.360 What I'm doing in this talk is considering what it could mean to apply that process to ourselves as people.
00:00:49.440 Ultimately, we want to not just become better at coding or at engineering, but to be better human beings. That's where we're headed.
00:01:01.399 If you're in this room expecting something else, it's too late because the doors are locked, so you're stuck with me.
00:01:07.479 Hopefully, you can pick up something along the way, even if that’s the case.
00:01:14.600 Like I said, TDD is this process of Test-Driven Development, which is usually shorthand for saying something like 'red, green, refactor.'
00:01:22.240 So, 'red' means writing a test specifying some behavior, and because you haven't implemented the code to make that behavior happen, that test is going to fail.
00:01:30.439 That’s the 'red' piece—where the test is failing.
00:01:35.920 The next piece is getting that test to go green, meaning that you write the implementation needed to make that test pass.
00:01:44.159 The third piece, often forgotten, is refactoring.
00:01:49.680 Now that you have a test that locks in the desired behavior, you can feel free to refactor.
00:01:54.960 You can rename, modularize, or do whatever you need to improve your code, and that test should still pass.
00:02:05.640 So, you feel free to do that, and then you just repeat the process again, starting with 'red'—writing a new test.
00:02:12.560 That’s the process of TDD.
00:02:18.200 I started thinking about applying this process to ourselves because I don’t think you can really argue that science itself—
00:02:26.920 the process of discovery, learning, and inquiry—does not necessarily lead to virtue.
00:02:34.000 Technologists, you know, people who are on the cutting edge of engineering, are not necessarily good people.
00:02:39.879 They are not virtuous just because they know how to do certain things.
00:02:46.440 An excellent example to illustrate my point is Walter White from Breaking Bad.
00:02:51.560 I see you're familiar; it’s a popular show. You should watch it if you haven't.
00:02:57.879 The premise is that Walter White, a genius chemist, is initially a high school teacher.
00:03:03.000 However, he uses his abilities for ill by cooking meth.
00:03:09.200 How could one think of anything worse? He becomes a meth kingpin, using his brilliant mind and capacity for science and engineering.
00:03:14.959 He does not use it virtuously.
00:03:20.360 Just so you know where I stand, I am not someone who entered the software engineering field with all these ideals.
00:03:26.720 I got into software engineering to get paid. I just wanted to make money.
00:03:32.959 I aspired to have indulgent luxuries, such as a goblet filled with olives or dogs playing poker in my living room.
00:03:39.080 That's what I was aiming for—surrounded by bodyguards, just in case.
00:03:45.599 However, throughout my journey as an engineer, I started to realize that there's an opportunity for me to do more than just make money.
00:03:51.079 I recognized the chance to embrace a journey, to work on my vulnerabilities and flaws, and strive to become the best person I can be.
00:04:05.319 If you’re anything like me, you will resist a process like this because I did, and I still do, even as I try to undergo it.
00:04:11.439 To inject a little energy in here since we're all friends, I’m going to try something.
00:04:19.359 I know you’re usually half on your phone and half paying attention at tech conferences.
00:04:25.479 I want you to help me verbalize this natural tendency to resist thinking about our character, our virtue, and who we are as people.
00:04:40.320 When I found myself in this situation, I would say to myself, 'But Abraham, I just want to code!'
00:04:47.720 Let's try that together! But Abraham, I just want to code!
00:04:53.000 This phrase verbalizes what you're already thinking: you don’t want to deal with this stuff.
00:05:01.880 When I call on you, I want you to say that back to me.
00:05:07.560 One more time, together: But Abraham, I just want to code! Any animosity you have towards me, just channel into that phrase, and we’ll be good to go.
00:05:16.280 Let’s consider what virtues could mean for software engineering and for ourselves.
00:05:22.080 The four classical virtues we’re going to use as a framework are self-control, courage, justice, and wisdom.
00:05:27.560 Self-control, courage, justice, wisdom—that's what we're going to talk about.
00:05:32.960 But I know, deep down, you just want to code.
00:05:38.319 Let’s start with the first virtue, which is self-control.
00:05:44.280 What does self-control have to do with software engineering, you may ask?
00:05:50.880 When I started—learning Ruby, which is known for being friendly and accessible for learners—that's one of the things I love about Ruby.
00:05:58.479 Ruby is expressive, with good documentation and lots of resources.
00:06:04.240 I would sit in Starbucks, working through exercises and puzzles, trying to become an algorithmic thinker.
00:06:09.639 Often, I would hit a stumbling block, like trying to call a method on a nil object.
00:06:16.560 At first, this was disheartening. I would get upset and frustrated—
00:06:22.280 Starbucks was not the best place to struggle alone, by the way.
00:06:29.520 Being new can be lonely, and once you hit a stumbling block, it feels like you might as well take the rest of the day off.
00:06:36.160 My lack of self-control often manifested in those moments.
00:06:41.720 However, when I reflect on self-control, you might not experience the same impatience as I do, but it can be hard.
00:06:56.560 As developers and engineers, it’s difficult to talk about self-control.
00:07:00.560 We often work in environments that seem very indulgent to those outside of our world.
00:07:06.562 My dad worked in the sewers of Chicago; I don’t think he would understand these environments.
00:07:12.080 It’s an interesting discussion about self-control as developers.
00:07:19.320 Or perhaps you can relate to a scene from XKCD that reflects this idea.
00:07:26.000 As engineers, we often want to know the truth and what is right.
00:07:34.040 For many of us, this drive to know leads us to stay up late working on projects, often at the expense of dinner or sleep.
00:07:42.080 This highlights how our lack of self-control can manifest.
00:07:50.919 There’s a relevant scene from the sci-fi classic Dune.
00:07:57.679 I recommend it; look it up.
00:08:03.600 The protagonist, Paul, has superhuman awareness.
00:08:09.799 He describes grasping the present and experiencing the complexities of time.
00:08:17.000 He perceives the massive movement of time complicated by shifting currents.
00:08:24.960 This alarming awareness captures how overwhelming possibilities can feel—especially for someone who is new.
00:08:32.480 You might not know where to start. Test-Driven Development aids in this regard, forcing you to take a path.
00:08:42.680 David Stetl argues that it’s about determining your objectives before jumping into coding.
00:08:49.080 Writing a test—or a specification—forces intentionality and purposefulness in your actions.
00:08:57.079 It limits you in a good way, allowing you to exercise self-control.
00:09:08.880 I found that my resistance to TDD often stems from my struggle with self-control.
00:09:18.639 As you reflect on this, think about how self-control as a developer relates to other areas of your life.
00:09:26.440 My dad narrated a crucial lesson to me through action films: a man must know his limitations.
00:09:34.320 Self-control involves knowing yourself and which desires to follow or resist.
00:09:40.760 Instead of leading our desires, we often let them dominate us.
00:09:48.240 Reflecting on our self-control can illuminate limitations we possess, both as developers and individuals.
00:09:54.839 This reflection encourages growth in both areas.
00:10:03.839 But let's discuss the next virtue—courage.
00:10:09.839 What does courage have to do with engineering and software development?
00:10:16.159 There’s courage in simply being an engineer—being curious and facing problems instead of avoiding them.
00:10:23.120 Some of us get energized by tough situations, where the solution isn't clear yet.
00:10:31.959 I’ve skipped lunch, deep into a project, completely absorbed in the complexity.
00:10:38.000 That’s a rarer moment for me.
00:10:43.560 There’s a courage in tackling problems head-on.
00:10:50.480 Richard Feynman, a Nobel Prize winner in physics, stated that the real joy lies in discovering things.
00:10:58.079 It’s not about accolades but the thrill of discovery and the impact of his work.
00:11:04.240 Next, we should explore courage in the context of pair programming.
00:11:09.200 For those unaware, pair programming involves two developers working at one machine, sharing a keyboard.
00:11:15.760 This pairing often requires courage, yet many resist the idea.
00:11:20.760 How many of you pair program all day?
00:11:27.240 For the rest of you, when it comes up, it’s beneficial.
00:11:33.120 Pair programming is a great learning opportunity.
00:11:39.679 However, when confronted with it, I often try to find a way out.
00:11:47.399 The vulnerability in exposing your thought processes is daunting.
00:11:55.879 You may doubt whether your thinking is sound.
00:12:01.000 With a pull request, you can iron it out beforehand.
00:12:06.159 But in pair programming, it’s live, spontaneous.
00:12:12.160 That causes a lot to resist.
00:12:18.160 Let’s get real: in one of my early projects, I encountered a simple task—to find the mode of an array.
00:12:24.399 I took quite some time, around two hours, and felt proud of my solution.
00:12:31.440 But reflecting on it now, I realize I was proud of how unreadable it was.
00:12:37.760 I thought I knew what was going on, line by line.
00:12:43.120 Later, I saw another solution from a peer, Kevin, who approached it differently.
00:12:50.760 Instead of being inspired, I felt personally challenged.
00:12:57.520 But if I had embraced courage, I could have learned from that and improved.
00:13:05.600 Brené Brown says that courage starts with showing up and letting ourselves be seen.
00:13:12.240 Resisting pair programming or mentorship is missing an opportunity to grow.
00:13:19.000 Engineering is a chance to grow in courage, both as engineers and as people.
00:13:27.160 But let’s talk about another virtue—justice.
00:13:34.560 What does justice mean in coding?
00:13:42.120 Justice is often depicted with Lady Justice as someone blindfolded.
00:13:50.080 This symbolizes impartiality and the balance of scales.
00:13:56.800 Simply put, justice can be defined as giving to each person what they are owed.
00:14:02.680 Expanding that, it's about giving to each person, institution, or community what they are owed.
00:14:10.080 Justice requires a perception of order that informs our societal norms.
00:14:17.760 Michael Sandel from Harvard explains that discussing justice engages us in thinking about the best way to live.
00:14:24.720 While some overlaps exist, different conceptions will arise.
00:14:32.000 Nevertheless, we must write maintainable code—and that is just.
00:14:39.200 Just code is defined by at least two obligations: an obligation to time.
00:14:45.760 When I work on exercises with Ruby, I have no obligation to time when I am playing around.
00:14:52.680 But in a professional setting, the code you write must last and function over time.
00:14:58.760 Over time, requirements change: user expectations or technology advances.
00:15:05.319 That means just code must recognize that things will change.
00:15:12.320 Sandi Metz highlights that design is more about preserving changeability than achieving perfection.
00:15:21.839 This involves naming, organizing, and pulling things into abstractions when appropriate.
00:15:28.480 The reason we engage in this is that our code is dynamic and subject to change.
00:15:35.920 The second obligation is that the code is not just for you; it's for others.
00:15:42.480 Think about your obligations to future developers who will read your code.
00:15:50.960 It’s the most selfish way of thinking—you’ll have to reread your code after six months.
00:15:59.120 You have an obligation to the people coming after you.
00:16:06.080 Writing just code satisfies that obligation.
00:16:13.440 Avoiding unjust code is essential; we don’t want to be in that situation.
00:16:20.000 You’ll find that writing code that is changeable and accessible to others fulfills your obligations to your community.
00:16:28.440 Reflecting on this can help evaluate your life: am I navigating obligations to those around me?
00:16:38.560 This could be a time of growth for you in virtue.
00:16:44.960 The last virtue is wisdom.
00:16:51.360 What does wisdom have to do with coding?
00:16:57.919 Wisdom often comes from reflection.
00:17:03.360 Confucius said we can learn wisdom through three methods: reflection (the noblest), imitation (the easiest), and experience (the bitterest).
00:17:10.960 Reflection for engineers often involves writing, reading, and studying.
00:17:17.560 I hope those working as engineers carve out time for reflection.
00:17:23.320 How many of you make time for reflection? It’s crucial.
00:17:29.920 The second method, imitation, occurs often during pair programming or code reviews.
00:17:36.920 This is an effective way to gain wisdom.
00:17:42.679 The third is through personal experience, which comes with pain and suffering.
00:17:48.640 Many of us pride ourselves on learning through that experience.
00:17:56.440 Confucius illustrates that learning through experience is often the hardest.
00:18:05.840 Uncle Bob mentions design patterns as well-worn solutions to common problems, illustrating how wisdom functions.
00:18:13.920 This demonstrates wisdom: applying learned patterns to avoid past mistakes.
00:18:22.000 So ask yourself: how are you growing in wisdom?
00:18:30.080 What is your plan for growing wisdom, whether through reflection or imitation?
00:18:37.240 Over the years, we’ll gain experience, but we need to be intentional.
00:18:46.720 Who do we want to imitate? Who do we want to be in life?
00:18:52.960 Reflect on your relationships with those who inspire you.
00:19:00.560 These questions arise as we reflect on wisdom in engineering.
00:19:07.440 But Abraham, I just want to code.
00:19:14.600 I know; I understand.
00:19:22.960 Today, we reviewed the four classical virtues: self-control, courage, justice, and wisdom.
00:19:29.920 These can apply to us as engineers and as people.
00:19:36.760 This journey of virtue can be summed up by a few questions: who am I? Who ought I to become? How should I get there?
00:19:45.120 When you think about TDD in your life, test yourself—how can you improve?
00:19:54.120 For myself, I wanted to grow in courage—so I set a goal to ask more questions at work.
00:20:03.000 Initially, I failed at this, but with time, I began to pass by consistently engaging.
00:20:10.800 I surrounded myself with comfortable, knowledgeable peers, asking questions to learn.
00:20:16.840 That’s what I mean by evaluating your soul through TDD.
00:20:23.520 Be brutally honest about your flaws and how to address them.
00:20:30.560 Darth Vader makes me consider a lack of tests in our lives; it’s disturbing.
00:20:36.560 Many people balk at growing in virtue due to shame.
00:20:44.400 Shame contrasts with guilt—it’s an emotion of feeling bad about yourself.
00:20:51.080 This creates an internal narrative: 'You’re not good enough; you won’t succeed.'
00:20:58.360 Shame stops us from embarking on a journey of growth because we fear discomfort.
00:21:06.760 This narrative is pervasive and keeps us from seeking improvements.
00:21:13.839 Criticism can feel like an anchor weighing us down, hindering growth.
00:21:21.680 Yet with the right mindset, criticism can transform into a buoy that lifts us up.
00:21:28.960 Embracing growth opportunities can lead us on an adventure, refining our character.
00:21:35.760 The blues came from the struggle and oppression that generated music.
00:21:44.160 Ralph Ellison describes it as an impulse to keep painful experiences alive.
00:21:50.080 This embraces the painful details and transforms them into lyricism.
00:21:56.560 In making character from our vulnerabilities, we can transcend those experiences.
00:22:05.679 This encourages us not only to become better coders but ultimately better people.
00:22:12.960 I hope this conversation about virtues and TDD resonates with you.
00:22:20.320 You can distribute this journey in your way and reflect on these concepts.
00:22:26.399 If you have questions or critiques, I’d love to hear them.
00:22:32.760 My name is Abraham, and I work at Central in Chicago. We’re hiring, too!
00:22:38.640 I appreciate getting this opportunity to speak to you.
00:22:46.640 Now, I’ll open the floor for any questions you may have.
00:22:52.560 You all just want to code? That’s understandable.
00:22:56.840 Thank you for listening, and thanks for attending!
Explore all talks recorded at RubyConf 2014
+77