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
Good Code
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
barisdemiroz
November 21, 2013
Programming
140
3
Share
Good Code
The presentation I made for software engineering course @{Bogazici University}
barisdemiroz
November 21, 2013
Other Decks in Programming
See All in Programming
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
230
Swift Concurrency Type System
inamiy
0
410
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
230
의존성 주입과 모듈화
fornewid
0
120
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
750
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
250
飯MCP
yusukebe
0
490
ドメインイベントでビジネスロジックを解きほぐす #phpcon_odawara
kajitack
2
120
夢の無限スパゲッティ製造機 -実装篇- #phpstudy
o0h
PRO
0
200
Java 21/25 Virtual Threads 소개
debop
0
340
瑠璃の宝石に学ぶ技術の声の聴き方 / 【劇場版】アニメから得た学びを発表会2026 #エンジニアニメ
mazrean
0
210
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
140
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
The Curse of the Amulet
leimatthew05
1
11k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
310
Speed Design
sergeychernyshev
33
1.6k
Designing for Timeless Needs
cassininazir
0
190
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
96
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
Building the Perfect Custom Keyboard
takai
2
720
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Six Lessons from altMBA
skipperchong
29
4.2k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
190
Transcript
Barış Evrim Demiröz software engineering @boun 21.11.2013
None
None
None
None
// increments i by one i++;
itemCount++;
None
None
• Function/Variable naming • Code style – Java conventions (Eclipse
CTRL+ALT+F) – Google conventions coming soon!
None
x = a*b;
salary = hoursWorked*rate;
None
*:execute perform do carry fulfill accomplish
None
None
None
None
None
if (items.size() < 30)
if (items.size() < MAX_ITEMS_ALLOWED)
None
line.split(",");
line.split(DELIMITER);
line.split(DELIMITER);
None
None
None
None
None
None
None
None
• Should be simple • Should be fast
private void testNoCookie( Cookie[] cookies ) { when( request.getCookies() ).thenReturn(
cookies ); CookieHandler handler = new CookieHandler( request ); assertFalse( handler.hasCookie() ); handler.createOrRenew( response ); assertTrue( handler.hasCookie() ); assertTrue( handler.getUUID().length() > 0 ); }
@Test public void testNoCookie1() { testNoCookie( null ); } @Test
public void testNoCookie2() { testNoCookie( new Cookie[] {} ); }
None
public void testAdd() { assertEquals(3, calculator.add(2, 1)); assertEquals(2, calculator.add(2, 0));
assertEquals(1, calculator.add(2, -1)); }
public class Calculator { public int add(int a, int b)
{ return a + b; } }
public class Calculator { private AdderFactory adderFactory; public Calculator(AdderFactor adderFactory)
{ this.adderFactory = adderFactory; } public int add(int a, int b) { Adder adder = adderFactory.createAdder(); ReturnValue returnValue = adder.compute(new Number(a), new Number(b)); return returnValue.convertToInteger(); } }
SO • others • blogs • twitter
None
None
None
None
1
None
None
double calculate(Context foo) { checkNotNull(foo); // rest of the computation…
}
None
None
List<Integer> numbers = asList(1, 2, 3, 4, 5, 6); numbers.forEach(System.out::println);
sumAll(numbers, n -> n % 2 == 0);
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
double calculate(int foo) { if (foo < 0) return 0;
// rest of the computation… }
You Ain’t Gonna Need It
None
None
None
None
None
None
public class LongDivision { private static final long MILLIS_PER_DAY =
24 * 60 * 60 * 1000; private static final long MICROS_PER_DAY = 24 * 60 * 60 * 1000 * 1000; public static void main(String[] args) { System.out.println(MICROS_PER_DAY / MILLIS_PER_DAY); } }
public class LongDivision { private static final long MILLIS_PER_DAY =
24 * 60 * 60 * 1000; private static final long MICROS_PER_DAY = 24 * 60 * 60 * 1000 * 1000; public static void main(String[] args) { System.out.println(MICROS_PER_DAY / MILLIS_PER_DAY); } }
public class LongDivision { private static final long MILLIS_PER_DAY =
24 * 60 * 60 * 1000; private static final long MICROS_PER_DAY = 24 * 60 * 60 * 1000 * 1000; public static void main(String[] args) { System.out.println(MICROS_PER_DAY / MILLIS_PER_DAY); } } overflows
public class LongDivision { private static final long MILLIS_PER_DAY =
24L * 60 * 60 * 1000; private static final long MICROS_PER_DAY = 24L * 60 * 60 * 1000 * 1000; public static void main(String[] args) { System.out.println(MICROS_PER_DAY / MILLIS_PER_DAY); } }
None
Don’t hold all the complexity in your mind
None
None
None
None