Skip to content

Commit

Permalink
Docs: The well-grounded java developer - Part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
currenjin committed Dec 21, 2024
1 parent 1bcb14b commit 0c0f9e3
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
1 change: 1 addition & 0 deletions _wiki/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ regenerate: true
* [[fixture-monkey-with-jpa]]
* [[spring-bean]]
* [[layered-architecture]]
* [[the-well-grounded-java-developer]]

---

Expand Down
110 changes: 110 additions & 0 deletions _wiki/the-well-grounded-java-developer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
layout : wiki
title : κΈ°λ³ΈκΈ°κ°€ νƒ„νƒ„ν•œ μžλ°” 개발자(The well-grounded java developer)
summary :
date : 2024-12-21 18:00:00 +0900
updated : 2024-12-21 18:00:00 +0900
tag : java
toc : true
public : true
parent : [[how-to]]
latex : true
---
* TOC
{:toc}

# κΈ°λ³ΈκΈ°κ°€ νƒ„νƒ„ν•œ μžλ°” 개발자(The well-grounded java developer)

## λͺ¨λ˜ μžλ°”

### 언어와 ν”Œλž«νΌ
- μžλ°” μ–Έμ–΄: 정적 νƒ€μž…μ˜ 객체지ν–₯ μ–Έμ–΄.
- μžλ°” ν”Œλž«νΌ: 클래슀 파일 ν˜•νƒœλ‘œ 제곡된 μ½”λ“œλ₯Ό λ§ν¬ν•˜κ³  μ‹€ν–‰ν•˜λŠ” JVM

μžλ°” μ‹œμŠ€ν…œμ˜ κ°œλ³„ 사양
- JLS(Java Language Specification)
- JVMSpec: ν˜„μž¬ JVM은 μ‹€ν–‰ν•˜λŠ” 데 μžˆμ–΄μ„œ 언어에 ꡬ애받지 μ•ŠλŠ”λ‹€.

λΆ„λ¦¬λœ 사양이 λͺ¨μ—¬ μžλ°” μ‹œμŠ€ν…œμ„ κ΅¬μ„±ν•˜λŠ” 원리
- `.java` -(javac)-> `.class` -(class loader)-> `λ³€ν™˜λœ .class` -(interpreter)-> `μ‹€ν–‰μ½”λ“œ` -(JIT Compiler)-> `기계어`
- μžλ°”λŠ” **컴파일 μ–Έμ–΄**μ΄λ©΄μ„œ **인터프리터 μ–Έμ–΄**이닀.

### 릴리즈 λ‘œλ“œλ§΅

![image](https://github.com/user-attachments/assets/6eaa7350-7a0b-40e3-8c78-223daa6e37a0)

- 6κ°œμ›”λ§ˆλ‹€ μ£Όμš” 릴리즈

### ν–₯μƒλœ νƒ€μž… μΆ”λ‘ 

- [LVTI Guide](https://openjdk.org/projects/amber/guides/lvti-style-guide)
- λ‹¨μˆœν•œ μ΄ˆκΈ°ν™”μ—μ„œ, 였λ₯Έμͺ½μ΄ μƒμ„±μž λ˜λŠ” 정적 νŒ©ν† λ¦¬ λ©”μ„œλ“œμ— λŒ€ν•œ 호좜인 경우
- λͺ…μ‹œμ  νƒ€μž…μ„ μ œκ±°ν•˜λ©΄ λ°˜λ³΅λ˜κ±°λ‚˜ μ€‘λ³΅λœ 정보가 μ‚­μ œλ˜λŠ” 경우
- λ³€μˆ˜ μ΄λ¦„λ§ŒμœΌλ‘œλ„ νƒ€μž…μ„ μ•Œ 수 μžˆλŠ” 경우
- 둜컬 λ³€μˆ˜μ˜ λ²”μœ„μ™€ μ‚¬μš©λ²•μ΄ 짧고 κ°„λ‹¨ν•œ 경우

type interface
```java
List<Integer> before = Collections.<Integer>emptyList();
List<Integer> after = Collections.emptyList();
```

diamond syntax
```java
Map<Integer, Map<String, String>> beforeUserLists = new HashMap<Integer, Map<String, String>>();
Map<Integer, Map<String, String>> afterUserLists = new HashMap<>();
```

lambda
```java
Function<String, Integer> lengthFn = s -> s.length();
```

LVTI, local variable type interface
- 둜컬 λ³€μˆ˜μ˜ μ„ μ–Έλ§Œμ„ κ²€μ‚¬ν•œλ‹€.
- μ œμ•½ 쑰건 ν•΄κ²° μ•Œκ³ λ¦¬μ¦˜μ„ μ μš©ν•œλ‹€.
```java
var names = new ArrayList<String>();
```

Bad case
```java
public class Var {
private static Var var = null;

public static Var var() {
return var;
}

public static void var(Var var) {
Var.var = var;
}
}
```

```java
void var_test() {
var var = Var.var();
if (var == null) {
Var.var(new Var());
}
}
```

Fail example
- μΆ”λ‘ μžκ°€ ν•΄κ²°ν•΄μ•Ό ν•˜λŠ” νƒ€μž… μ œμ•½ 쑰건 방정식을 **κ³Όμ†Œκ²°μ • 연립방정식**이라 ν•œλ‹€.
```java
var fn = s -> s.length();
var n = null;
```

Nondenotable type
```java
var duck = new Object() {
void quack() {
System.out.println("Quack!");
}
};

duck.quack();
```

0 comments on commit 0c0f9e3

Please sign in to comment.