Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Good Code
Search
barisdemiroz
November 21, 2013
Programming
160
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Good Code
The presentation I made for software engineering course @{Bogazici University}
barisdemiroz
November 21, 2013
Other Decks in Programming
See All in Programming
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
120
APNsからLive Activityを開始する話
yumnumm
0
150
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
940
AIに “答え“を書かせるのを やめてみた
___akari11
0
110
Verilogで学ぶCPU自作入門
uyuki234
8
4k
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
5.6k
プロダクトコードからライブラリの境界を見つける
elmetal
PRO
0
110
カツオ、ご期待ください
suneo3476
0
160
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
190
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
200
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
Java 27新機能 / Java 27 new features
kishida
2
210
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
450
The Language of Interfaces
destraynor
162
27k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.1k
Building an army of robots
kneath
307
47k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
480
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
It's Worth the Effort
3n
188
29k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
300
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
860
WCS-LA-2024
lcolladotor
0
860
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