Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Co se PHP programátor může naučit od Javy?
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Filip Procházka
October 28, 2017
Technology
140
1
Share
Co se PHP programátor může naučit od Javy?
Filip Procházka
October 28, 2017
More Decks by Filip Procházka
See All by Filip Procházka
Evolving architecture
fprochazka
0
240
Value objects in PHP
fprochazka
1
220
Jak psát testy na REST API
fprochazka
0
110
V gitu se nic neztratí
fprochazka
0
400
4 roky remote
fprochazka
1
89
Před čím tě Nette ani Symfony neochrání
fprochazka
0
150
Nejlepší cache je žádná cache
fprochazka
0
130
Doctrine: co dělat, když entity nestačí
fprochazka
0
77
Nette framework - How to compile an extensible di container
fprochazka
0
280
Other Decks in Technology
See All in Technology
非同期・イベント駆動処理の分散トレーシングの繋げ方
ichikawaken
1
250
Physical AI on AWS リファレンスアーキテクチャ / Physical AI on AWS Reference Architecture
aws_shota
1
270
契約書からの情報抽出を行うLLMのスループットを、バッチ処理を用いて最大40%改善した話
sansantech
PRO
3
330
SSoT(Single Source of Truth)で「壊して再生」する設計
kawauso
2
410
TUNA Camp 2026 京都Stage ヒューリスティックアルゴリズム入門
terryu16
0
650
Even G2 クイックスタートガイド(日本語版)
vrshinobi1
0
180
来期の評価で変えようと思っていること 〜AI時代に変わること・変わらないこと〜
estie
0
130
最大のアウトプット術は問題を作ること
ryoaccount
0
250
出版記念イベントin大阪「書籍紹介&私がよく使うMCPサーバー3選と社内で安全に活用する方法」
kintotechdev
0
130
The essence of decision-making lies in primary data
kaminashi
0
210
20260326_AIDD事例紹介_ULSC.pdf
findy_eventslides
0
320
OPENLOGI Company Profile for engineer
hr01
1
62k
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
HDC tutorial
michielstock
1
590
Amusing Abliteration
ianozsvald
1
150
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
95
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.5k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
700
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
160
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.6k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.8k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
What's in a price? How to price your products and services
michaelherold
247
13k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Transcript
Co se PHP programátor může naučit od Javy? @ProchazkaFilip
Návrhové vzory jsou super • Decorator • Strategy • Visitor
• Builder • Factory • BuilderFactory ❤ • FactoryBuilderFactory ❤❤ • BuilderFactoryBuilderFactory ❤❤❤
None
“Patterns always have two parts: the how and the when.
Not just do you need to know how to implement them, you also have to know when to use them and when to leave them alone.” ~ Martin Fowler
• Premature abstraction • Premature optimalization • … • Nejprve
“nahrubo” • Dodržovat základní pravidla • Po pochopení refaktoring YAGNI
Don’t reinvent the wheel: Hotová řešení • Frameworky ◦ Spring
vs Nette vs Symfony • Knihovny ◦ Hibernate vs Doctrine • Články • Nástroje • ….
Don’t reinvent the wheel: Standardy • JSR 354: Money and
Currency API ◦ https://github.com/brick/money • JSR 310: Date and Time API ◦ https://github.com/brick/date-time
Compile-time • Kompilace je spása ◦ Chvilku trvá... ◦ Nenahrazuje
testy! • PHPStan https://xkcd.com/303/
(silné) Typy!
Silné typy: array • Std lib + Generika ◦ Map<LocalDate,
List<LocalTime>> ◦ LinkedList vs ArrayList ◦ HashMap vs TreeMap • PHPDoc ◦ Příklady v PHPStan testech /** @var Collection|Dolor[] */ private $dolors;
Silné typy: string • Musí být typehint string? • Nešlo
by to lépe?
Value objects • VO vs Entity • Hodnota vs identita
Value objects • PHP nemá Time ani Date, má Datetime
◦ Můžu si napsat vlastní ◦ Nebo můžu použít Brick! :) • EmailAddress • PhoneNumber • Url (Nette) • DateRange, TimeRange, NumberRange • PostalAddress ◦ Může a nemusí být VO
Value objects: vlastnosti • Rovnost ◦ == vs === vs
equals() • Validita • Immutabilita • VO != DTO
Shrnutí • Návrhové vzory jsou super • Don’t reinvent the
wheel • Silné typy • Value objects
@ProchazkaFilip