O tom, ako sa nestratiť vo vlastnom kóde alebo ako neprísť o priateľov keď čítajú vaše zdrojáky. Aj v dobe objektov, tried a interfaceov je veľmi ľahké navariť z kódu kvalitné špagety. Zopár praktických tipov ako tomu predchádzať.
Vývoju softwaru sa venuje profesne cez 10 rokov, pracoval na mnohých pozíciách vo firmách ako ui42 či Piano Media. Momentálne vedie malú softwarovú firmu so zameraním na webový vývoj. V Prešove organizuje stretnutie WebElement (podobné WEBtlak-u) a podieľa sa na coworkingu Eastcubator Prešov. Rád hľadá jednoduché odpovede na jednoduché otázky a tým zložitým sa radšej vyhýba :)
Veedera is an online marketplace that connects businesses seeking promotional videos with video creators. Buyers post video project descriptions and budgets for creators to submit proposals for. Creators can browse existing project requests or subscribe to new ones. If selected, they receive the project's budget to create the video. The platform aims to provide small businesses and startups access to affordable video marketing by tapping into a global community of video designers and artists.
Dostaneš výtlak mojích skúseností nadobudnutých za posledných 10 rokov v praxi. Od toho, ako sa naučiť design, po podpultovky, ako sú platy a ako naceňovať svoje projekty.
Tomáš momentálne pôsobí v Bratislave ako digitálny dizajnér v spoločnosti Azet.sk. Predtým pracoval ako kreatívec v reklamnej agentúre SCR a ako grafický dizajnér v množstve menších agentúr. Vyštudoval odbor marketingová komunikácia a reklama na UKF v Nitre. Medzi klientov pre ktorých sa mu najlepšie pracovalo patria Azet.sk, Novostavby.sk, Zlatý bažant, Expres, O2, Corgoň, Desperados a ďalší.
This document provides details on 19 shots for a film scene depicting an interrogation of a criminal confessing to murder. Shot 1 is an establishing mid shot of the criminal being interviewed in a blank room. Shots 2-5 cut to extreme close-ups of the victim's eyes, neck, lips, and overall image as the criminal describes killing the victim. Shot 6 shows the victim dead on the floor with a screeching sound effect. Shots 7-11 depict the criminal moving the victim's body and disposing of evidence. Shots 12-14 return to the interrogation room as the criminal describes further actions taken to cover up the crime. Shots 15-17 show the criminal lighting a fire with the victim's body
This document is a thesis submitted by Jules Arntz-Gray to Athabasca University in partial fulfillment of a Master's degree in Integrated Studies. It explores the role of global governance in ensuring decent working conditions for all workers in a globalized world. The thesis asks whether the transformation of norms and values is enough, or if some form of global regulator is required. It examines occupational health and safety in Ontario's mining sector, composed of advanced transnational companies, to test the concept of self-regulation. An analysis of regulatory compliance in Ontario's mining sector finds that self-regulation without independent external audit and enforcement is insufficient, calling into question its effectiveness in developing countries with weaker governance. The paper reviews literature on
Alexander the Great was born in Pella, Macedonia to King Philip II of Macedon and Olympias. He ascended to the Macedonian throne in 336 BC after his father was assassinated. In just 10 years, Alexander built one of the largest empires in the ancient world by conquering Persia and territories as far as modern-day India. However, his grand plans for further expansion were cut short by his death at age 33 in 323 BC, likely due to illness.
El documento presenta una explicación del modelo CAPM y WACC para calcular la rentabilidad esperada de un activo. Explica que el CAPM usa la tasa libre de riesgo, beta y prima de riesgo de mercado para determinar la rentabilidad esperada. Luego, el WACC calcula la tasa de descuento promedio ponderado usando los costos de deuda y capital propio de una empresa ponderados por su participación en la estructura de capital. Finalmente, presenta un ejemplo numérico para calcular el WACC.
Veedera is an online marketplace that connects businesses seeking promotional videos with video creators. Buyers post video project descriptions and budgets for creators to submit proposals for. Creators can browse existing project requests or subscribe to new ones. If selected, they receive the project's budget to create the video. The platform aims to provide small businesses and startups access to affordable video marketing by tapping into a global community of video designers and artists.
Dostaneš výtlak mojích skúseností nadobudnutých za posledných 10 rokov v praxi. Od toho, ako sa naučiť design, po podpultovky, ako sú platy a ako naceňovať svoje projekty.
Tomáš momentálne pôsobí v Bratislave ako digitálny dizajnér v spoločnosti Azet.sk. Predtým pracoval ako kreatívec v reklamnej agentúre SCR a ako grafický dizajnér v množstve menších agentúr. Vyštudoval odbor marketingová komunikácia a reklama na UKF v Nitre. Medzi klientov pre ktorých sa mu najlepšie pracovalo patria Azet.sk, Novostavby.sk, Zlatý bažant, Expres, O2, Corgoň, Desperados a ďalší.
This document provides details on 19 shots for a film scene depicting an interrogation of a criminal confessing to murder. Shot 1 is an establishing mid shot of the criminal being interviewed in a blank room. Shots 2-5 cut to extreme close-ups of the victim's eyes, neck, lips, and overall image as the criminal describes killing the victim. Shot 6 shows the victim dead on the floor with a screeching sound effect. Shots 7-11 depict the criminal moving the victim's body and disposing of evidence. Shots 12-14 return to the interrogation room as the criminal describes further actions taken to cover up the crime. Shots 15-17 show the criminal lighting a fire with the victim's body
This document is a thesis submitted by Jules Arntz-Gray to Athabasca University in partial fulfillment of a Master's degree in Integrated Studies. It explores the role of global governance in ensuring decent working conditions for all workers in a globalized world. The thesis asks whether the transformation of norms and values is enough, or if some form of global regulator is required. It examines occupational health and safety in Ontario's mining sector, composed of advanced transnational companies, to test the concept of self-regulation. An analysis of regulatory compliance in Ontario's mining sector finds that self-regulation without independent external audit and enforcement is insufficient, calling into question its effectiveness in developing countries with weaker governance. The paper reviews literature on
Alexander the Great was born in Pella, Macedonia to King Philip II of Macedon and Olympias. He ascended to the Macedonian throne in 336 BC after his father was assassinated. In just 10 years, Alexander built one of the largest empires in the ancient world by conquering Persia and territories as far as modern-day India. However, his grand plans for further expansion were cut short by his death at age 33 in 323 BC, likely due to illness.
El documento presenta una explicación del modelo CAPM y WACC para calcular la rentabilidad esperada de un activo. Explica que el CAPM usa la tasa libre de riesgo, beta y prima de riesgo de mercado para determinar la rentabilidad esperada. Luego, el WACC calcula la tasa de descuento promedio ponderado usando los costos de deuda y capital propio de una empresa ponderados por su participación en la estructura de capital. Finalmente, presenta un ejemplo numérico para calcular el WACC.
The document contains a series of phrases in quotation marks describing various situations, including "Sad", "Sorry", "Bad Accident", and "Police Hard at Work". It concludes by stating that sharing the document with friends could make them smile too, regardless of how many people it is sent to.
El documento trata sobre la ergonomía en el uso de computadoras. Explica que la ergonomía busca optimizar la interacción entre el humano, la máquina y el ambiente de trabajo para mejorar la salud y productividad. Luego describe cómo un monitor, teclado y mobiliario ergonómicos, al adaptarse mejor a la anatomía humana, pueden reducir el estrés y prevenir lesiones causadas por largas horas de trabajo frente a una computadora. También enfatiza la importancia de mantener una postura corporal correcta y alineada para preser
Hot Fuzz had a budget of £8 million and grossed over £48 million in the UK and $80 million in the US, making it very profitable. It was produced by British production companies and had an all-British cast and crew. The film is an action comedy spoof of British police films set in a small English village. It targets fans of comedy, action, and previous films by its director and cast. Through references to other films and genres, exaggerated British settings and police elements, it parodies the police genre while appealing to British audiences.
Students are required to complete a short film or film extract as part of a group project. Each group member must take on a specific role such as director, editor, or sound operator. The director will focus on shot placement and performance, the editor on editing and post-production. Groups must consider narrative structure, genre conventions, and the ordering of shots.
The project involves three stages: pre-production including planning and storyboarding, production including shooting, and post-production including editing and sound. Effective planning is essential as the project can be time consuming. Basic shooting and editing rules are provided to ensure consistency and clarity in the final product.
This document introduces radians as a unit for measuring angles and provides formulas for converting between radians and degrees. Some key points:
- A radian is defined as the angle subtended by an arc that is equal in length to the radius.
- There are 2π radians in a full circle and π radians in 180 degrees.
- Common conversions are that π radians equals 180 degrees, and 1 radian is approximately 57 degrees.
- Formulas are given for converting between radians and degrees by using the relationship that π radians equals 180 degrees.
Jeden prototyp za 1000 meetingov - Andrej Minárik | WEBtlak #8WEBtlak
Budeme sa pohybovať niekde na pomedzí front-endu, UX a freelancerského project managementu. Reč bude o webovom prototypovaní a prototypoch - od tých papierových až po tie nakódené vo Foundation for Sites a twigu. Ako ich tvorím a ako mi pomáhajú šetriť čas, prachy a neznenávidieť svojich klientov :)
This document introduces Domain-Driven Design (DDD). DDD is an approach to software development that connects implementation to an evolving model of the complex domain. It involves building a shared understanding of the domain with experts and designing the software around the domain model. Key aspects of DDD include developing a meaningful domain model, defining bounded contexts, using entities, value objects, aggregates, factories, repositories, services, and domain events to structure the software architecture. The document provides an overview of these building blocks and encourages iterative modeling in an agile fashion.
The document introduces Tomáš Gustiňák, a 27-year-old developer at TRIONYX technologies. It provides information about Tomáš' experience with procedural PHP, CodeIgniter, ZendFramework, and an introduction to Laravel, which is a PHP web framework that utilizes Symfony2 components and aims to be developer friendly. The document also includes diagrams of the Laravel lifecycle and architecture showing how HTTP requests and responses flow through the router, controller, middleware and into business logic, databases, mail services, APIs and back.
Poznáte nejaké HTTP hlavičky? Určite áno. A viete aj že niektoré tieto hlavičky zvyšujú bezpečnosť webu? Nie? V tom prípade sa uvidíme, pretože sa budeme rozprávať o kadejakých hlavičkách, ktoré spravia web bezpečnejší.
Tomáš je informatik, fotograf, športovec ale vo svojej podstate bezpečnostný paranoik, ktorý nemá prelepenú webkameru na notebooku.
Ako na užívateľské testovanie - Katarína Zalánová | WEBtlak #4WEBtlak
Dozvieš sa, ako využiť užívateľské testovanie pri dizajnovaní produktu, čo z neho vieš vyčítať, s kým a kedy vôbec testovať. Uvidíš príklady z praxe a tipy, ako testovanie zvládnuť aj bez UX labu, na pankáča.
2fresh:
http://2fresh.sk/
WEBtlak:
http://www.facebook.com/webtlak/
http://webtlak.sk/
Dizajn orientovaný na človeka - Jozef Benko | WEBtlak #4WEBtlak
Dizajn orientovaný na človeka (Human-centered design) je spôsob, ako sa dostať bližšie k ľuďom, ktorí používajú vaše produkty a služby. Umožňuje transformovať dáta v uskutočniteľné myšlienky a pomáha vidieť neočakávané príležitosti. Prednáška o tom, ako môže dizajnér prestať kresliť z briefu a začať riešiť skutočné problémy.
Jozef je dizajnér a strategický konzultant s viac ako dekádou skúseností v digitálnych a interaktívnych médiach. Pomáha firmám a neziskovým organizáciam tvoriť lepšie produkty a služby, predovšetkým pomocou dizajnu orientovaného na človeka. Svoj prvý web vytvoril keď mal štrnásť a odvtedy stihol pracovať na projektoch od neziskoviek a malých startupov až po veľké biznisy ako FOX Broadcasting, Rogers Media, Telekom, či ZUNO.
2Fresh:
http://2fresh.sk/
WEBtlak:
http://www.facebook.com/webtlak/
http://webtlak.sk/
Poďme sa porozprávať prečo sú najväčší poskytovatelia webových služieb tak úspešný, aké technológie používajú, čo sú to tie mikroservisy a ako do toho všetkého zapadá nový OpenShift 3.
Jakub je vývojár OpenShift platformy, open-source nadšenec, ktorý okrem programovania v rozličných jayzkoch ako Go, Ruby, JavaScript nemá problém ani s grafikou a designom.
Single sign-on - Michal Vagač
—
Témou prednášky bude stručné priblíženie základných princípov technológie jednotného prihlasovania do viacerých (nezávislých) aplikácií. Časť prednášky sa bude venovať SAML štandardu.
Michal pracuje ako vysokoškolský učiteľ na Univerzite Mateja Bela, no určite ho nemôžeme považovať za teoretika.
The document contains a series of phrases in quotation marks describing various situations, including "Sad", "Sorry", "Bad Accident", and "Police Hard at Work". It concludes by stating that sharing the document with friends could make them smile too, regardless of how many people it is sent to.
El documento trata sobre la ergonomía en el uso de computadoras. Explica que la ergonomía busca optimizar la interacción entre el humano, la máquina y el ambiente de trabajo para mejorar la salud y productividad. Luego describe cómo un monitor, teclado y mobiliario ergonómicos, al adaptarse mejor a la anatomía humana, pueden reducir el estrés y prevenir lesiones causadas por largas horas de trabajo frente a una computadora. También enfatiza la importancia de mantener una postura corporal correcta y alineada para preser
Hot Fuzz had a budget of £8 million and grossed over £48 million in the UK and $80 million in the US, making it very profitable. It was produced by British production companies and had an all-British cast and crew. The film is an action comedy spoof of British police films set in a small English village. It targets fans of comedy, action, and previous films by its director and cast. Through references to other films and genres, exaggerated British settings and police elements, it parodies the police genre while appealing to British audiences.
Students are required to complete a short film or film extract as part of a group project. Each group member must take on a specific role such as director, editor, or sound operator. The director will focus on shot placement and performance, the editor on editing and post-production. Groups must consider narrative structure, genre conventions, and the ordering of shots.
The project involves three stages: pre-production including planning and storyboarding, production including shooting, and post-production including editing and sound. Effective planning is essential as the project can be time consuming. Basic shooting and editing rules are provided to ensure consistency and clarity in the final product.
This document introduces radians as a unit for measuring angles and provides formulas for converting between radians and degrees. Some key points:
- A radian is defined as the angle subtended by an arc that is equal in length to the radius.
- There are 2π radians in a full circle and π radians in 180 degrees.
- Common conversions are that π radians equals 180 degrees, and 1 radian is approximately 57 degrees.
- Formulas are given for converting between radians and degrees by using the relationship that π radians equals 180 degrees.
Jeden prototyp za 1000 meetingov - Andrej Minárik | WEBtlak #8WEBtlak
Budeme sa pohybovať niekde na pomedzí front-endu, UX a freelancerského project managementu. Reč bude o webovom prototypovaní a prototypoch - od tých papierových až po tie nakódené vo Foundation for Sites a twigu. Ako ich tvorím a ako mi pomáhajú šetriť čas, prachy a neznenávidieť svojich klientov :)
This document introduces Domain-Driven Design (DDD). DDD is an approach to software development that connects implementation to an evolving model of the complex domain. It involves building a shared understanding of the domain with experts and designing the software around the domain model. Key aspects of DDD include developing a meaningful domain model, defining bounded contexts, using entities, value objects, aggregates, factories, repositories, services, and domain events to structure the software architecture. The document provides an overview of these building blocks and encourages iterative modeling in an agile fashion.
The document introduces Tomáš Gustiňák, a 27-year-old developer at TRIONYX technologies. It provides information about Tomáš' experience with procedural PHP, CodeIgniter, ZendFramework, and an introduction to Laravel, which is a PHP web framework that utilizes Symfony2 components and aims to be developer friendly. The document also includes diagrams of the Laravel lifecycle and architecture showing how HTTP requests and responses flow through the router, controller, middleware and into business logic, databases, mail services, APIs and back.
Poznáte nejaké HTTP hlavičky? Určite áno. A viete aj že niektoré tieto hlavičky zvyšujú bezpečnosť webu? Nie? V tom prípade sa uvidíme, pretože sa budeme rozprávať o kadejakých hlavičkách, ktoré spravia web bezpečnejší.
Tomáš je informatik, fotograf, športovec ale vo svojej podstate bezpečnostný paranoik, ktorý nemá prelepenú webkameru na notebooku.
Ako na užívateľské testovanie - Katarína Zalánová | WEBtlak #4WEBtlak
Dozvieš sa, ako využiť užívateľské testovanie pri dizajnovaní produktu, čo z neho vieš vyčítať, s kým a kedy vôbec testovať. Uvidíš príklady z praxe a tipy, ako testovanie zvládnuť aj bez UX labu, na pankáča.
2fresh:
http://2fresh.sk/
WEBtlak:
http://www.facebook.com/webtlak/
http://webtlak.sk/
Dizajn orientovaný na človeka - Jozef Benko | WEBtlak #4WEBtlak
Dizajn orientovaný na človeka (Human-centered design) je spôsob, ako sa dostať bližšie k ľuďom, ktorí používajú vaše produkty a služby. Umožňuje transformovať dáta v uskutočniteľné myšlienky a pomáha vidieť neočakávané príležitosti. Prednáška o tom, ako môže dizajnér prestať kresliť z briefu a začať riešiť skutočné problémy.
Jozef je dizajnér a strategický konzultant s viac ako dekádou skúseností v digitálnych a interaktívnych médiach. Pomáha firmám a neziskovým organizáciam tvoriť lepšie produkty a služby, predovšetkým pomocou dizajnu orientovaného na človeka. Svoj prvý web vytvoril keď mal štrnásť a odvtedy stihol pracovať na projektoch od neziskoviek a malých startupov až po veľké biznisy ako FOX Broadcasting, Rogers Media, Telekom, či ZUNO.
2Fresh:
http://2fresh.sk/
WEBtlak:
http://www.facebook.com/webtlak/
http://webtlak.sk/
Poďme sa porozprávať prečo sú najväčší poskytovatelia webových služieb tak úspešný, aké technológie používajú, čo sú to tie mikroservisy a ako do toho všetkého zapadá nový OpenShift 3.
Jakub je vývojár OpenShift platformy, open-source nadšenec, ktorý okrem programovania v rozličných jayzkoch ako Go, Ruby, JavaScript nemá problém ani s grafikou a designom.
Single sign-on - Michal Vagač
—
Témou prednášky bude stručné priblíženie základných princípov technológie jednotného prihlasovania do viacerých (nezávislých) aplikácií. Časť prednášky sa bude venovať SAML štandardu.
Michal pracuje ako vysokoškolský učiteľ na Univerzite Mateja Bela, no určite ho nemôžeme považovať za teoretika.
7. Čo je to čistý kód?
Rovnaká
● rýchlosť vývoja
● kvalita
● bugovosť (nebugovosť)
● spokojnosť zadávateľa
● radosť programátora
Ako pri na začiatku vývoja
11. I don't know how
Prečo ne - písať čistý kód
● veď to funguje
● ale ja to predsa viem prečítať
● toto je kratšie / menej kódu
● ale toto je rýchlejšie
● nestíham !!!
● vštci sú LAMERI len ja som KÓDER
13. Čo je náš cieľ
● ZNÍŽIŤ WTF FAKTOR
● pochopiť zmysel kód
● orientovať sa v toku behu programu
● zmysluplne debugovať
● neodkladne zaznamenať a lokalizovať chybu
● riadiť error handling dev / production
● obmedziť ukladaniu nekonzistentných dát
● jednoduché pridávanie funkcionality
18. Naming convention
● nevytvárať tajné dohovory, ktoré nie je
možné vyčítať z kódu.
● maďarská notácia
○ sName, bAdmin, dPrice, cCustomer
● Capital pre objekty, atď ...
○ $User, $name, $user ???
● magic functions
○ $this->__call(), $this->__get()
not The Da Vinci Code
19. Princíp najmenšieho
prekvapenia
Názvy tried, funkcií a premenných
○ majú niesť význam toho, čo vykonávajú
○ nevykonávať to čo nenesú v názve
public function getName()
{
$this->deleteParent();
return $this->name;
}
22. DRO (Don't repeat others)
● pýtať sa
● komunikovať s kolegami
● checknúť zdrojáky!
● nebyť lenivý
● nepísať novú funkciu / classu ak sa dá stará
prispôsobiť
25. /** Komentáre **/
Komentár duplikuje názov funkcie
/**
* Add item decorator
*/
public function addItemDecorator(EshopDecoratorAbstract $decorator)
Komentár duplikuje názov volanej funkcie
// order is paid
if ($order->isPaid())
26. /** Komentáre **/
● Zakomentovaný kód
○ Vymazať – stále ostane v repozitároch
○ (svn, mercurial, git ... )
● Vtipné, injektívne odkazy kolegom
○ Vymazať ! – povedať pri káve, zavolať, poslať mail ...
//no need to save the object - it has not been changed
//DBOF::saveObjectFactory();
27. Funkcie
● funkcia má vykonávať len jednu vec
● mala by byť malá
● granulovať logické celky
● v jednej funkcii iba jedna podmienka
28. Funkcie - granulácia
public function newEventAction()
{
$this->form = new My_Form_Event_New();
$this->form->addCSRFProtection();
$this->view->event_form = $this->_form;
if ($this->_request->isPost())
{
$data = $this->_getAllParams();
if($this->form->isValid($data))
{
$values = $this->form->getValues();
$event = new Event($values);
$event->save();
}
}
}
29. Funkcie - granulácia
public function newEventAction()
{
$this->prepareForm();
if ($this->_request->isPost())
{
$this->submitForm();
}
}
30. Funkcie - granulácia
private function prepareForm()
{
$this->form = new My_Form_Event_New();
$this->form->addCSRFProtection();
$this->view->event_form = $this->form;
}
private function submitForm()
{
$data = $this->_getAllParams();
if($this->form->isValid($data))
{
$values = $this->form->getValues();
$event = new Event($values);
$event->save();
}
}
31. Funkcie - argumenty
● minimalizovať počet argumentov
● najlepší počet argumentov = 0
○ granulovať funkciu na samostatnú triedu
● settery a ”void” funkcie by mali vracať
inštanciu rodičovského objektu
public function sendMessage($message, $subject, $users_ids, $item_id, $item_type_id = null,
$template_id = null)
{
// do something
}
32. Funkcie - argumenty
class Message
{
public function setMessage($message)
{
$this->message = $message;
return $this;
}
public function setSubject($subject)
{
$this->subject = $subject;
return $this;
}
public function setReceiversIds($users_ids)
{
$this->users_ids = $user_ids;
return $this;
}
public function send()
{
// send message
}
}
34. Funkcie
logické argumenty porušujú základný
predpoklad
public function makeAdmin($bool = true)
{
$this->role = 'admin';
if ($bool == false)
{
$this->role = 'user';
}
$this->save();
}
public function makeAdmin()
{
$this->role = "admin";
return $this->save();
}
public function removeAdmin()
{
$this->role = "user";
return $this->save();
}
35. Funkcie - vstup -výstup
● Funkcia môže vracať iba hodnoty jedného
typu
● Pokiaľ neide o FACTORY
public function getUsers($sql = false)
{
$select = $this->select();
$select->from('users');
if ($sql)
{
return $select; // vráti Zend_Db_Select
}
return $this->fetchAll($select); // vráti Zend_Db_Table_Rowset
36. throw ! Exceptions
● Nevracať false/null, pokiaľ je očakávaný
objekt
● Vyhodiť výnimku
public function getUser()
{
$user = Users_Table::getInstance()->find($this->user_id);
return $user;
}
$user = $event->getUser();
if ($user == false)
{
// BLA BLA BLA - Handle error
}
else
{
$user->sendInfoMail();
}
37. throw ! Exceptions
● Nevracať false/null, pokiaľ je očakávaný
objekt
● Vyhodiť výnimku
public function getUser()
{
$user = Users_Table::getInstance()->find($this->user_id);
if (empty($user))
{
throw new Users_Exception('No user exists');
}
return $user;
}
$user = $event->getUser();
$user->sendInfoMail();
38. Neriadené strely
čo ak sa stane nemožné
● každý switch musí mať default
● vyhodenie Exception v potrebnom okamihu
● magická funkcia ktorá akceptuje čokoľvek
○ riziko preklepu
39. Pravidlo jeného ”switch” - u
● Príkaz switch / case pretaviť do najlbšej časti systému
● Používať jedine na vytváranie polymorfných objektov vo
factory
● Inak vzniká riziko opakovania toho istého switch / case
rozhodovania v inej časti systému
● Predchádza sa tým logickému zdvojeniu kódu
40. Všetko toto VYMAZAŤ !!!
Mŕtvy kód = Dead man
● Funkcie (triedy, moduly ... ), ktoré nikto
nevolá
● Vetvy podmienok, ktoré nie sú nikdy
vykonané
● Vetvy switch / case ktoré nikdy nenastanú
● Catch príkazu try, ktorý nikdy nevykoná
throw exception
● Premenné ktoré nie sú nikde použité
41. Čitateľnosť kódu
Zapúzdriť podmienky do funkcií
if ($event->start_date < $now && count($event->getBookings) > 0)
{
$event->delete();
}
if ($event->canBeDeleted())
{
$event->delete();
}
44. Závislosť na prostredí
● kód nesmie byť natvrdo závislý na prostredí /
nastevení prostredia
● namiesto toho použiť konštanty
if (APPLICATION_ENVIRONMENT == 'production')
{
$url = 'www.example.com';
}
else
{
$url = dev.example.com';
}
$url = CONSTANT_URL;
45. Zanechajte táborisko čistejšie,
ako ste ho našli!
Skautské pravidlo
● V každom projekte je potrebné robiť kontinuálny refactoring
● Pri každom zásahu do kódu urobte predchádzajúci kód trochu čistejším
● zmena názvu premennej / funkcie
● granulácia funkcie na niekoľko menších
● odstránenie krátkeho ”if” - u …
46. veľká vďaka všetkým autorom
Bibliografia
● Čistý kód - Robert C. Martin
○ (Clean Code: A Handbook of Agile Software Craftsmanship)
● Co programátory ve škole neučí - Petr Paleta
● Z kodéra vývojářem - Mike Gunderloy
○ (Coder to Developer)
● Programátor pragmatik - Andrew Hunt, David Thomas
○ (The Pragmatic Programmer)
47. priestor na diskusiu, súboje, prestrelky :)
created by Martin Rázus 2012
Ďakujem za pozornosť