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
barisdemiroz
November 21, 2013
Programming
150
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
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
170
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
140
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.1k
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
770
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
3Dシーンの圧縮
fadis
1
770
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
110
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
130
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
CSC307 Lecture 17
javiergs
PRO
0
320
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
870
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
390
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
200
Paper Plane (Part 1)
katiecoart
PRO
0
9k
Speed Design
sergeychernyshev
33
1.8k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
150
How to make the Groovebox
asonas
2
2.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
180
The browser strikes back
jonoalderson
0
1.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
710
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