Skip to content

Instantly share code, notes, and snippets.

@lukewertz
Created September 7, 2017 20:58
Show Gist options
  • Save lukewertz/c45d1e0e23923caa617020a65dfd98dd to your computer and use it in GitHub Desktop.
Save lukewertz/c45d1e0e23923caa617020a65dfd98dd to your computer and use it in GitHub Desktop.
Improper Abstraction
<?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