From b2d80610db6beda38573890ed169815e495bc663 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Sun, 24 May 2020 16:34:31 +0700 Subject: [usth/ICT2.7] Engineer software --- ...nditional Expression Solution - lang_en_vs3.srt | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 usth/ICT2.7/P4L5 Software Refactoring Subtitles/10 - Consolidate Conditional Expression Solution - lang_en_vs3.srt (limited to 'usth/ICT2.7/P4L5 Software Refactoring Subtitles/10 - Consolidate Conditional Expression Solution - lang_en_vs3.srt') diff --git a/usth/ICT2.7/P4L5 Software Refactoring Subtitles/10 - Consolidate Conditional Expression Solution - lang_en_vs3.srt b/usth/ICT2.7/P4L5 Software Refactoring Subtitles/10 - Consolidate Conditional Expression Solution - lang_en_vs3.srt new file mode 100644 index 0000000..89f2722 --- /dev/null +++ b/usth/ICT2.7/P4L5 Software Refactoring Subtitles/10 - Consolidate Conditional Expression Solution - lang_en_vs3.srt @@ -0,0 +1,55 @@ +1 +00:00:00,080 --> 00:00:03,230 +So the resulting code will be like this. As you can see here, + +2 +00:00:03,230 --> 00:00:06,602 +now I don't have the conditionals any longer, but I just have a call to + +3 +00:00:06,602 --> 00:00:09,938 +this notEligibleForDisability method. And this makes the code so + +4 +00:00:09,938 --> 00:00:14,092 +much clearer, because if I just need to understand how disabilityAmount works, + +5 +00:00:14,092 --> 00:00:17,945 +I can clearly see there is an initial check that is actually checking whether + +6 +00:00:17,945 --> 00:00:22,030 +an employee's eligible for disabilities or not. And if the check is false, so + +7 +00:00:22,030 --> 00:00:26,180 +if the employee's eligible, then I'll just perform the rest of the computation. + +8 +00:00:26,180 --> 00:00:27,710 +Otherwise I'll simply return zero. + +9 +00:00:27,710 --> 00:00:30,500 +So if I don't need to understand the details of this check, + +10 +00:00:30,500 --> 00:00:33,630 +I can simply look at this method and understand it all. And if I need to look at + +11 +00:00:33,630 --> 00:00:36,990 +the details I can just go, and look at the implementation of this method, + +12 +00:00:36,990 --> 00:00:39,600 +and I will get exactly the same information that I have here. But I'm sort of + +13 +00:00:39,600 --> 00:00:43,220 +separating the concerns, and making the code overall more understandable, and + +14 +00:00:43,220 --> 00:00:46,160 +therefore more maintainable, which is the main goal of refactoring. -- cgit 1.4.1