Created
September 7, 2017 20:58
-
-
Save lukewertz/c45d1e0e23923caa617020a65dfd98dd to your computer and use it in GitHub Desktop.
Improper Abstraction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This construct occurs when things aren't properly abstracted | |
*/ | |
function huh($uid) { | |
$student = new Student($uid); | |
// The student is either in Alex or Chris' class. | |
if ($student->teacher == 'Alex') { | |
$studnet->NoTwoPenci(); | |
$student->FillInTheBlank(); | |
$student->ThirdPeriodLunch(); | |
} | |
else { | |
$student->BicPen(); | |
$student->MultipleChoice(); | |
$student->SecondPeriodLunch(); | |
} | |
return $student; | |
} | |
/** | |
* This construct indicates proper abstraction, reducing complexity. | |
*/ | |
function ohhhh($uid) { | |
$student = new Student($uid); | |
$student->WritingUtensil(); | |
$student->Test(); | |
$student->Eat(); | |
return $student; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment