Offline dengan aplikasi Player FM !
12. A First Example - Part 2
Manage episode 219131174 series 2323264
Welcome to another episode of Evil Geniuses. Last time we teased you but we’re back and this time we’re actually going to deliver the goods, no more click bait. We are working with a video checkout store type software where our classes are a movie, a rental, and a customer.
We’ve given you insight into what our test look like and today we want to talk about the code that does tester testing. The theme of this discussion is you have to do two things. One, you have to introduce duplication in order to identify the right obstruction because you can’t always trust the obstruction that is present and then two, stop being obsessed with primitives. No more primitives. Keep listening, there’s, even more, coming up in the next episode!
Key Points From This Episode:
- The quality of your code and when it matters.
- Understanding a primitive obsession.
- Introducing temporary duplication to find sameness.
- Extra charge for rental versus base cost of rental.
- Returning the same type of object regardless of the output of your method.
- Eliminating the case statement.
- And much more!
Talking Points
- Work hard to be lazy
- Duplication leads to the removal of duplication
Commits
- rename element to rental
-
- Make the code tell a story
- extract base_cost_of_movie concept
-
- Add duplication
- remove duplicate base_cost_of_movie calls
-
- Remove duplication
- rename method to tell a more accurate story
-
- Make the code tell a story part 2
- extract the #extra_charge_for_rental method
-
- This refactoring showed there are two kinds of charges for a movie
- Exposed an error
- remove duplicate extra_charge_for_rental calls
-
- Remove Duplication part 2
Links Mentioned in Today’s Episode:
16 episode
Manage episode 219131174 series 2323264
Welcome to another episode of Evil Geniuses. Last time we teased you but we’re back and this time we’re actually going to deliver the goods, no more click bait. We are working with a video checkout store type software where our classes are a movie, a rental, and a customer.
We’ve given you insight into what our test look like and today we want to talk about the code that does tester testing. The theme of this discussion is you have to do two things. One, you have to introduce duplication in order to identify the right obstruction because you can’t always trust the obstruction that is present and then two, stop being obsessed with primitives. No more primitives. Keep listening, there’s, even more, coming up in the next episode!
Key Points From This Episode:
- The quality of your code and when it matters.
- Understanding a primitive obsession.
- Introducing temporary duplication to find sameness.
- Extra charge for rental versus base cost of rental.
- Returning the same type of object regardless of the output of your method.
- Eliminating the case statement.
- And much more!
Talking Points
- Work hard to be lazy
- Duplication leads to the removal of duplication
Commits
- rename element to rental
-
- Make the code tell a story
- extract base_cost_of_movie concept
-
- Add duplication
- remove duplicate base_cost_of_movie calls
-
- Remove duplication
- rename method to tell a more accurate story
-
- Make the code tell a story part 2
- extract the #extra_charge_for_rental method
-
- This refactoring showed there are two kinds of charges for a movie
- Exposed an error
- remove duplicate extra_charge_for_rental calls
-
- Remove Duplication part 2
Links Mentioned in Today’s Episode:
16 episode
Όλα τα επεισόδια
×Selamat datang di Player FM!
Player FM memindai web untuk mencari podcast berkualitas tinggi untuk Anda nikmati saat ini. Ini adalah aplikasi podcast terbaik dan bekerja untuk Android, iPhone, dan web. Daftar untuk menyinkronkan langganan di seluruh perangkat.