Phil Karlton
There are only two hard things in Computer Science:
$d; // czas trwania w dniach
$elapsedTimeInDays;
$list; // lista kategorii
$categories;
$t; // czas modyfikacji (timestamp)
$modificationTimestamp;
function filterOrders()
{
$orders = [];
foreach($this->getAll() as $order) {
if($order->status == 4)
$orders[] = $order;
}
return $orders;
}
function getPaidOrders()
{
$paidOrders = [];
foreach($this->getAll() as $order) {
if($order->isPaid())
$paidOrders[] = $order;
}
return $paidOrders;
}
class ProductList {
public function numberOfProducts(){}
}
class ProductList {
public function size(){}
}
class CategoryDataObject {
}
class CategoryEntity {
}
// może być w odpowiednim namespace
class Category {
}
Są wyjątki ! (kontekst ma znaczenie)
class ImportProductsCommand {
public function execute() {
$this->initializeEntityManagers();
$this->truncateProductsTable();
$this->importProductsFromLegacyDatabase();
}
}
class ImportCommand {
public function execute() {
$this->initialize();
$this->truncate();
$this->import();
}
}
$appointmentList
$calendar
$companyPerson
$employee
$textCorrectionByEditor
$edit
class Product {
public function isNotEnabled();
}
class Product {
public function isEnabled();
}
if(!$user->isNotAdmin()) {}
if(!$product->isNotEnabled()) {}
class DtaRcd {
private $modDMY;
public function rcdInt();
}
class Account {
private $modificationDate;
public function getInternalId();
}
class UserRepository {
public function fetchAll();
public function retrieveActive();
public function getByOrganization();
public function findOneById();
}
class UserRepository {
public function findAll();
public function findActive();
public function findByOrganization();
public function findOneById();
}
$repository->find...();
$entity->get...();
$provider->fetch...();
$storage->retrieve...();
class Order {
private $street;
private $city;
private $postCode;
private $state;
}
class Order {
private $adrStreet;
private $adrCity;
private $adrPostCode;
private $adrState;
}
class Order {
private Address;
}
// mamy zamówienie
$order;
// w warstwie domenowej
// przyjęcie zamówienia może wyglądać tak:
$shop->placeOrder($order)
// w warstwie infrastruktury
// jego zapis może być taki:
$em->persist($order);
$foo
// nie przedstawia intencji
$data
// zbyt ogólna
$a
// za krótka
$productsEditedBySuperAdminUsers
// za długa
$mod
// niejednoznaczna
class InvoiceManager {}
// nieokreślona
$state
// w złym kontekście
$products_list
// inna konwencja
Write with the door closed, rewrite with the door open
I find the bigger the monitor, the better the concentration
When people tell you something’s wrong or doesn’t work for them, they are almost always right.
When they tell you exactly what they think is wrong and how to fix it, they are almost always wrong
// sprawdzenie czy pracownik jest w wieku emerytalnym
if(
($employee->gender=='F' && $employee->age > 60)
||
($employee->gender=='M' && $employee->age > 65)
)
if($employee->isInRetirementAge())
Słownik wyrazów bliskoznacznych - synonimy
(thesaurus)