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
Fallacies of Doom - JavaZone 18
Search
Mahmoud Abdelghany
September 12, 2018
Programming
0
370
Fallacies of Doom - JavaZone 18
https://2018.javazone.no/program/08e6d34f-b8e2-45d0-af04-83f6dc68c316
Mahmoud Abdelghany
September 12, 2018
Tweet
Share
More Decks by Mahmoud Abdelghany
See All by Mahmoud Abdelghany
Fallacies of Doom - RivieraDEV 19
blackbeard334
0
180
Fallacies of Doom - Devoxx BE 17
blackbeard334
0
210
Other Decks in Programming
See All in Programming
Flutter × Firebase Genkit で加速する生成 AI アプリ開発
coborinai
0
130
定理証明プラットフォーム lapisla.net
abap34
1
1.7k
ARA Ansible for the teams
kksat
0
120
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
260
Grafana Loki によるサーバログのコスト削減
mot_techtalk
1
110
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
1
420
『改訂新版 良いコード/悪いコードで学ぶ設計入門』活用方法−爆速でスキルアップする!効果的な学習アプローチ / effective-learning-of-good-code
minodriven
29
5.1k
動作確認やテストで漏れがちな観点3選
starfish719
6
990
Linux && Docker 研修/Linux && Docker training
forrep
23
4.4k
Writing documentation can be fun with plugin system
okuramasafumi
0
110
テストをしないQAエンジニアは何をしているか?
nealle
0
120
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
4.2k
Featured
See All Featured
Thoughts on Productivity
jonyablonski
69
4.4k
Docker and Python
trallard
44
3.2k
Typedesign – Prime Four
hannesfritz
40
2.5k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Mobile First: as difficult as doing things right
swwweet
223
9.3k
It's Worth the Effort
3n
184
28k
A Philosophy of Restraint
colly
203
16k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
Transcript
Fallacies of Doom Lessons learned from porting Doom 3 to
Java
@blackbeard0x14e @blackbeard0x14e Boring intro: history • id Software: Unusual company
creating ‘innovative’ games(Rover, Dave, Keen, Wolf3D, Doom, Quake) • Self taught era, efficient coding style(s) ◦ Nerd rage anecdote • Djoom3==fun • So why the boring awesome intro?
@blackbeard0x14e
@blackbeard0x14e wishlist “ C++ protects against accident, not against fraud.
” Bjarne Stroustrup
@blackbeard0x14e
@blackbeard0x14e @blackbeard0x14e Operator overloading cout << ”Total price: “ <<
price*quantity << endl; c->J1 * c->body1->acceleration + c->J2 * c->body2->acceleration + invStep * (c->c1 + c->c2); c.J1.oMultiply(c.body1.acceleration).oPlus(c.J2.oMultiply(c.body2.acceleration) ).oPlus((c.c1.oPlus(c.c2)).oMultiply(invStep)); [2] https://www.cs.virginia.edu/~evans/cs655/readings/steele.pdf
@blackbeard0x14e @blackbeard0x14e Operator overloading idMat3 a, b, c, z; z
= a + b * c; z = a.oPlus(b).oMultiply(c); z = b.oMultiply(c).oPlus(a);//technically correct z = a.oPlus(b.oMultiply(c));//compiler correct
@blackbeard0x14e
@blackbeard0x14e >>>
@blackbeard0x14e @blackbeard0x14e Unsigned primitives Runtime or compile-time error??
@blackbeard0x14e @blackbeard0x14e Unsigned primitives
@blackbeard0x14e @blackbeard0x14e Unsigned primitives Microbenchmark alert:
@blackbeard0x14e
@blackbeard0x14e @blackbeard0x14e Immutability; const vs final
@blackbeard0x14e @blackbeard0x14e Immutability; const vs final • final for variables
sucks • final for functions sucks less • final for classes rocks [1] ftp://ftp.idsoftware.com/idstuff/doom3/source/CodeStyleConventions.doc
@blackbeard0x14e @blackbeard0x14e sizeof( )
@blackbeard0x14e @blackbeard0x14e sizeof( )
@blackbeard0x14e @blackbeard0x14e Enum
@blackbeard0x14e @blackbeard0x14e Enum
@blackbeard0x14e @blackbeard0x14e Enum
@blackbeard0x14e @blackbeard0x14e Grandfather inheritance • Super.super.function • Why are equals/hashcode
inherited?!
@blackbeard0x14e
@blackbeard0x14e @blackbeard0x14e Pointers
@blackbeard0x14e @blackbeard0x14e Pointers
@blackbeard0x14e @blackbeard0x14e Pointers
@blackbeard0x14e @blackbeard0x14e Pointers
@blackbeard0x14e (thank God we don’t have this…)-list System.out.println( (byte)~(char)-(int)+(long)-1 );
@blackbeard0x14e @blackbeard0x14e Death by Macros [3] https://blogs.msdn.microsoft.com/oldnewthing/20050106-00/?p=36783 [4] https://youtu.be/4cCeUfzH-No?t=23m
@blackbeard0x14e
@blackbeard0x14e @blackbeard0x14e Death by Macros
@blackbeard0x14e @blackbeard0x14e Death by Macros
@blackbeard0x14e @blackbeard0x14e Death by Macros
@blackbeard0x14e
@blackbeard0x14e @blackbeard0x14e Hungarian Camels [5]https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/ [6] https://steve-yegge.blogspot.nl/2006/03/execution-in-kingdom-of-nouns.html
@blackbeard0x14e Hungarian Camels
@blackbeard0x14e @blackbeard0x14e Unholy union
@blackbeard0x14e @blackbeard0x14e Unholy union: SDL_events.h
@blackbeard0x14e Unholy union
@blackbeard0x14e @blackbeard0x14e Unholy union
@blackbeard0x14e nice to have -list “ Object-oriented design is the
roman numerals of Computing. ” Rob Pike
@blackbeard0x14e
@blackbeard0x14e @blackbeard0x14e Destructor • Deconstructors • Finalize(@deprecated) • Autocloseable++
@blackbeard0x14e Default arguments
@blackbeard0x14e @blackbeard0x14e string::insert, string::swap
@blackbeard0x14e @blackbeard0x14e Inlining
@blackbeard0x14e weird(tips...tricks...pitfalls) -list Integer a = 42; Integer b =
42; System.out.println(a == b); Integer c = 666; Integer d = 666; System.out.println(c == d); String e = “666”; String f = “666”; String g = new String(“666”); System.out.println(e == f); System.out.println(f == g);
@blackbeard0x14e @blackbeard0x14e The memory watcher
@blackbeard0x14e @blackbeard0x14e 5.1.2. Widening Primitive Conversion
@blackbeard0x14e @blackbeard0x14e Pop goes the callstack
@blackbeard0x14e @blackbeard0x14e Floating point operator precedence
@blackbeard0x14e @blackbeard0x14e Floating point operator precedence
@blackbeard0x14e
@blackbeard0x14e @blackbeard0x14e Floating point operator precedence
@blackbeard0x14e @blackbeard0x14e Floating point operator precedence
@blackbeard0x14e @blackbeard0x14e Conditional breakpoints
@blackbeard0x14e @blackbeard0x14e Conditional breakpoints •Sloooow(interpretive) Microbenchmark alert:
@blackbeard0x14e @blackbeard0x14e A backwards compatible story?
@blackbeard0x14e @blackbeard0x14e A backwards compatible story? •Why is backwards compatibility
the default mode of operation? •Why not make it optional with compile/runtime warnings/errors?
@blackbeard0x14e @blackbeard0x14e Sometimes the bug isn’t in your code...T_T
@blackbeard0x14e @blackbeard0x14e
@blackbeard0x14e Questions...while the Demo loads? https://github.com/blackbeard334/djoom3