728x90
๋ฐ˜์‘ํ˜•
  1. jUnit : assertArray / asertThrows
  2. checkStyle : ์ฝ”๋”ฉ ์Šคํƒ€์ผ ์ •๋Ÿ‰
  3. Doxygen : ์˜์กด์„ฑ ๋ถ„์„(๋‹ค์ด์–ด๊ทธ๋žจ)

 

# 1. JUnit ํ•œ๋‹จ๊ณ„ ๋” ๋‚˜์•„๊ฐ€๊ธฐ

 

์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ  ๊ทธ ๋ฉ”์„ธ์ง€๋ฅผ exception์— ์ €์žฅํ•ด์„œ ์šฐ๋ฆฌ๊ฐ€ ์›ํ•˜๋Š” ์—๋Ÿฌ ๋ฌธ์ž์™€ ์ผ์น˜ํ•˜๋Š”์ง€๊นŒ์ง€ ํ™•์ธํ•˜๊ธฐ!

@Test
	void testDivide() throws Exception {
//		assertEquals(0.5, calculator.divide(2.0, 4.0));
		assertThrows(Exception.class, () -> 
			calculator.divide(4, 0), "0 ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋ฐœ์ƒ"
		);
		// calculator.divide(4, 0)์‹คํ–‰ ์‹œ, Exception ์—ฌ๋ถ€๋งŒ ํ™•์ธ
	}	
	
	// ์—ฌ๋ถ€๋งŒ ํ™•์ธํ•˜๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ ๋ฌธ์ž๊ฐ€ ๋‚˜์˜ค๋Š”์ง€ ํ™•์ธ
	@Test
	public void testDevide_exception() throws Exception {
		Exception exception = assertThrows(Exception.class, () -> 
		calculator.divide(4, 0), "0 ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋ฐœ์ƒ"
		);
		
		assertEquals("Divide Error", exception.getMessage());
	}

 

์ •์  ๋ถ„์„ ์ฝ”๋“œ ๋Œ๋ฆฌ๊ธฐ  : SonarQube(java๋Š” ๋ฌด๋ฃŒ) - pmd, checkstyle

1. ๊ฐœ์ธ์ ์ธ ํด๋” ๋‚ด์—์„œ eclipse, Intellij์—์„œ ๋Œ๋ฆฌ๋ฉด SonarLint

2. git์— ํ†ต์ฒด๋กœ ์˜ฌ๋ ธ์„๋•Œ๋Š” SonarQube(์„œ๋ฒ„) ํšŒ์‚ฌ ์ „์ฒด ๋‚ด๋ถ€์˜ ์ฝ”๋“œ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Œ 

3. Jenkins CI/CD์—์„œ buildํ• ๋•Œ SonarQube ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Œ

 

 

JUnit์€ ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ๋„๊ตฌ์ด๊ณ  ์›น/์•ฑ์—์„œ๋Š” ๊ทธ๋ ‡๊ฒŒ ํ•„์ˆ˜์ ์ด์ง€๋Š” ์•Š๋‹ค!!  

 

 

 

# assertArray ์‚ฌ์šฉ!!

 

package com.calc;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.Arrays;

import org.junit.jupiter.api.Test;

class CalculatorTest_format {

	Calculator calculator = new Calculator();
	
	// assertEquals : ๊ฐœ๋ณ„ ์š”์†Œ ๊ฒ€์ฆ
	
	@Test
	void testParseInput_individualCheck() throws Exception {
		String[] result = calculator.parseInput("2 + 3");
		assertEquals("2", result[0]);
		assertEquals("+", result[1]);
		assertEquals("3", result[2]);
	}
	
	// assertEquals : List ๋กœ ๊ฒ€์ฆ
	@Test
	void testParseInput_listCheck() throws Exception {
		String[] result = calculator.parseInput("2 + 3");
		assertEquals(Arrays.asList("2", "+", "3"), Arrays.asList(result));
	}
	
	// assertEquals
	@Test
	void testParseInput_array() throws Exception {
		String[] result = calculator.parseInput("2 + 3");
		assertArrayEquals(new String[] {"2", "+", "3"}, result, "๋ฐฐ์—ด์ด ์˜ˆ์ƒ ๊ฐ’๊ณผ ๋‹ค๋ฆ…๋‹ˆ๋‹ค");
	}
	
	// null, empty ์ฒ˜๋ฆฌ ์—ฌ๋ถ€ ํ™•์ธ
	@Test
	void testParseInput_nullAndEmpty() throws Exception {
		Exception nullException = 
				assertThrows(Exception.class, () -> 
						calculator.parseInput(null));
		assertEquals("null์€ ์ž…๋ ฅ ๋ถˆ๊ฐ€", nullException.getMessage());
	}
}

 

 

# checkStyle ์ ์šฉํ•˜๊ธฐ

marketplace์—์„œ ๋‹ค์šด

 

checkstyle ์„ค์ •

 

๋…ธ๋ž‘์ด๋Š” ์ฃผ์˜~~ ๋นจ๊ฐ•๋งŒ ์•„๋‹ˆ๋ฉด ๋œ๋‹ค~~

 


# doxygen (์˜์กด๊ด€๊ณ„ ํŒŒ์•… ๋ถ„์„ํ•˜๊ณ  ์‹œ๊ฐํ™”ํ•˜์ง€๋งŒ ๊ฐ„๋žตํ•จ)

 

์˜์กด์„ฑ ๋ถ„์„

  • ๊ฐœ์š”
    • ํ•จ์ˆ˜ ๋ณ€์ˆ˜์˜ ํ˜ธ์ถœ๊ด€๊ณ„๋ฅผ ๋ถ„์„ํ•˜๋Š” ๋„๊ตฌ
    • ๋„๊ตฌ๊ฐ€ ์ถ”๊ตฌํ•˜๋Š” ๋ฐฉํ–ฅ์— ๋”ฐ๋ผ ํŒจํ‚ค์ง€ ํด๋ž˜์Šค(ํŒŒ์ผ) ํ•จ์ˆ˜ ๋‹จ์œ„๋กœ ํ‘œํ˜„
  • ๋ชฉ์ 
    • ์•„ํ‚คํ…์ฒ˜ ๊ตฌ์กฐ์—์„œ ์„œ๋ธŒ ์‹œ์Šคํ…œ ๊ฐ„์˜ ์˜์กด์ด  ์ ์ ˆํ•œ์ง€ ํ™•์ธ
      • ์„œ๋ธŒ ์‹œ์Šคํ…œ ๋ ˆ์ด์–ด์—์„œ ๊ฐ ๋ ˆ์ด์–ด ๊ฐ„ ํ˜ธ์ถœ๊ด€๊ณ„
      • ์„œ๋ธŒ ์‹œ์Šคํ…œ ๋ ˆ๋ฒจ์—์„œ ๊ฐ ๋ ˆ๋ฒจ ๊ฐ„ ํ˜ธ์ถœ ๊ด€๊ณ„
      • ์›ํ˜•์˜์กด์„ฑ(์ƒํ˜ธ ์ฐธ์กฐ)๊ด€๊ณ„
    • ๊ฐ์ฒด์ง€ํ–ฅ์— ํŠนํ™”๋˜์–ด, ์ถ”์ƒํ™”์™€ ๊ตฌ์ œ์ดค์˜ ์ •๋„๋ฅผ ํ™•์ธ 

https://www.doxygen.nl/download.html#google_vignette

 

Doxygen download

Download Doxygen Free and open source software

www.doxygen.nl

 

 

# graphvie(Doxygen์˜ ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ์ข‹๊ฒŒ ์‹œ๊ฐํ™” ํ•˜๋Š” ๋„๊ตฌ, ์‚ฐ์ถœ๋ฌผ ์ œ์ถœ์— ์šฉ์ดํ•จ)

https://graphviz.org/download/

 

Download

Source Code Source code packages for the latest stable and development versions of Graphviz are available, along with instructions for anonymous access to the sources using Git. Executable Packages Packages marked with an asterisk(*) are provided by outsid

graphviz.org

 

 

 

Scan recursively : ์˜ต์…˜ ๋‹ค ๋ถ„์„!! ๋ฌด์กฐ๊ฑด ๋ˆŒ๋Ÿฌ!!

 

๋ชจ๋“  ์—”ํ‹ฐํ‹ฐ ์ง€์› / Java ์ง€์›

 

๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฐ” / ๊ฒ€์ƒ‰ ์ถ”๊ฐ€

 

๊ทธ๋ž˜๋น„์ธ ๋ฅผ ๋‹ค์šด ๋ฐ›์€ ์ด์œ  / ์–ด๋–ป๊ฒŒ ํ‘œ์‹œํ• ์ง€๋ฅผ ๋‚˜ํƒ€๋ƒ„

 

 

728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

# ์•„ํ‚คํ…์ฒ˜(Architecture)

 

- ๊ฑด๋ฌผ์˜ ๋ผˆ๋Œ€๋ฟ ์•„๋‹ˆ๋ผ ํŠน์„ฑ์„ ๊ฒฐ์ •์ง“๋Š” ๊ธฐ๋ณธ ๊ตฌ์กฐ๋ฅผ ์ผ์ปซ๋Š” ๋ง(๋ชจ๋“  ๊ธฐ์ˆ  ๋ถ„์•ผ์— ์ ์šฉํ•  ์ˆ˜ ์žˆ๊ณ  ์ข…๋ฅ˜๋„ ๋‹ค์–‘ํ•จ)

- ๋Œ€ํ˜• ํ”„๋กœ์ ํŠธ๊ฐ€ ๋ณต์žก์„ฑ์˜ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•

  • ๊ฐœ๋ฐœํ•  ์†Œํ”„ํŠธ์›จ์–ด์˜ ์ „์ฒด ๊ตฌ์กฐ๋ฅผ ๊ฐ€์žฅ ๋จผ์ € ์ƒ๊ฐ
  • ์†Œํ”„ํŠธ์›จ์–ด์˜ ๊ตฌ์กฐ๋ฅผ์ด๋ฃจ๋Š”๊ฐ ๊ตฌ์„ฑ์š”์†Œ๋ฅผ ์ฐพ์Œ
  • ๊ฐ ๊ตฌ์„ฑ์š”์†Œ ๊ฐ„์˜ ๋ช…ํ™•ํ•œ ๊ด€๊ณ„๋ฅผ ์„ค์ •
  • ์ผ์ •ํ•œ ๊ทœ์น™์„ ๋”ฐ๋ฆ„    

- ์†Œํ”„ํŠธ์›จ์–ด ์•„ํ‚คํ…์ฒ˜ : ์ƒ์œ„ ์ˆ˜์ค€์—์„œ ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌ์„ฑ์š”์†Œ๋“ค ๊ฐ„์˜ ๊ด€๊ณ„๋กœ ๊ตฌ์„ฑ๋œ ์ „์ฒด์ ์ธ ๊ตฌ์กฐ๋ฅผ ์„ค๊ณ„ํ•˜๋Š”ํ™œ๋™...   

 

 

#  ์†Œํ”„ํŠธ์›จ์–ด ์•„ํ‚คํ…์ฒ˜์˜ ์—ญํ• 

  • ์—ฌ๋Ÿฌ ์ดํ•ด๊ด€๊ณ„์ž ๊ฐ„์˜ ๊ณตํ†ต์˜ ์˜์‚ฌ์†Œํ†ต ์ˆ˜๋‹จ(์–ด๋Š์ •๋„์˜ what๊ณผ how๊ฐ€ ๋‹ค ๋‹ด๊ฒจ์ ธ ์žˆ๋‹ค! ๊ณ ๊ฐ ์š”๊ตฌ ์‚ฌํ•ญ์— ๋งž๊ฒŒ ๊ฐ€๊ณ  ์žˆ๋Š”์ง€..)
  • ์‹œ์Šคํ…œํ’ˆ์งˆ ์†์„ฑ์˜ ์‚ฌ์šฉ๋˜๋Š” ์–ต์ œ ๊ธฐ์ค€  (์†Œํ”„ํŠธ์›จ์–ด ํ’ˆ์งˆ ์†์„ฑ 8๊ฐ€์ง€๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์•„ํ‚คํ…์ฒ˜๊ฐ€ ์–ด๋–ค ์ •๋„์˜ ์ˆ˜์ค€์ธ์ง€, ์œ ์ง€๋ณด์ˆ˜ & ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋„๋ก ๋งŒ๋“ค๋„๋ก ํ•จ..)
  • ๋ณ€๊ฒฝ์— ๋Œ€ํ•œ ์›์ธ ํŒŒ์•… ๋ฐ ์œ ์—ฐํ•œ ๋Œ€์ฒ˜๊ฐ€ ๊ฐ€๋Šฅ 
  • ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌ์„ฑ ์š”์†Œ ํ™•๋ณด ์ˆ˜๋‹จ 

# ์•„ํ‚คํ…์ฒ˜ ์„ค๊ณ„ ์‹œ ๊ณ ๋ ค ์‚ฌํ•ญ

  • ๋ชจ๋“  ์ดํ•ด๊ด€๊ณ„์ž ์‚ฌ์ด์˜ ์˜์‚ฌ์†Œํ†ต ๋„๊ตฌ๋กœ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์–ด์•ผ ํ•จ
  • ๊ตฌํ˜„์— ๋Œ€ํ•œ ์ œ์•ฝ ์‚ฌํ•ญ(๊ฐœ๋ฐœ ๋น„์šฉ, ๊ธฐ๊ฐ„, ์กฐ์ง์˜ ์—ญ๋Ÿ‰ ๋“ฑ)์„ ์ •์˜ํ•ด์•ผ ํ•จ
  • ๋ชจ๋“  ์ดํ•ด๊ด€๊ณ„์ž์˜ ํ’ˆ์งˆ์š”๊ตฌ์‚ฌํ•ญ์„ ๋ฐ˜์˜ํ•ด ์šฐ์„ ์ˆœ์œ„์— ๋”ฐ๋ผ ์‹œ์Šคํ…œ ํ’ˆ์งˆ ์†์„ฑ์„๊ฒฐ์ •ํ•ด์•ผ ํ•จ (์„ฑ๋Šฅ ์‚ฌ์šฉ์„ฑ, ๋ณด์•ˆ์„ฑ, ์•ˆ์ •์„ฑ, ๊ฒ€์ฆ ๊ฐ€๋Šฅ์„ฑ, ๋ณ€๊ฒฝ ์šฉ์ด์„ฑ ๋“ฑ)
  • ํŠน์ • ๋ฌธ์ œ ์˜์—ญ์— ์ ํ•ฉํ•œ ์†Œํ”„ํŠธ์›จ์–ด์˜ ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ํ‘œ์ค€ํ™”ํ•˜๊ณ  ํŒจํ„ดํ™”ํ•ด ์žฌ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค๊ณ„ํ•ด์•ผ ํ•จ

ISO/IEC 25010์˜ ํ’ˆ์งˆ ์†์„ฑ ์˜ˆ์‹œ

 

 

# ์•„ํ‚คํ…์ฒ˜ ํ’ˆ์งˆ ์†์„ฑ : ์‹œ์Šคํ…œ ํ’ˆ์งˆ ์†์„ฑ

  • ๊ฐ€์šฉ์„ฑ(Availability) : ์‹œ์Šคํ…œ์ด ์‹คํŒจ ์—†์ด ์šด์šฉ๋ ์ˆ˜ ์žˆ๋Š” ํ™•๋ฅ ๋กœ ์‹œ์Šคํ…œ์ด ์žฅ์•  ๋ฐœ์ƒ ์—†์ด ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋Š” ๋Šฅ๋ ฅ
  • ๋ณ€๊ฒฝ ์šฉ์ด์„ฑ(Modifiability): ์‚ฌ์šฉ์ž๊ฐ€ ์ƒˆ๋กœ์šด ์š”๊ตฌ์‚ฌํ•ญ์„ ์š”์ฒญํ–ˆ์„ ๋•Œ
  • ์„ฑ๋Šฅ(Performance) : ์‚ฌ์šฉ์ž ์š”์ฒญ๊ณผ ๊ฐ™์€ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ ์–ผ๋งˆ๋‚˜ ๋น ๋ฅด๊ณ  ํšจ์œจ์ ์œผ๋กœ ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ€๋ฅผ ๋งํ•จ
  • ๋ณด์•ˆ์„ฑ : ํ—ˆ์šฉ๋˜์ง€ ์•Š์€ ์ ‘๊ทผ์— ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ๋Š” ๋Šฅ๋ ฅ
  • ์‚ฌ์šฉ์„ฑ : ์‹œ์Šคํ…œ์„์‚ฌ์šฉํ•  ๋•Œ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ์ƒํ™ฉ์„ ๊ทน๋ณตํ•  ์ˆ˜ ์žˆ๋„๋ก ์ด๋ฅผ ๋ฐ˜์˜ํ•ด ์•„ํ‚คํ…์ฒ˜ ์„ค๊ณ„ ์ž‘์—…์„ ํ•ด์•ผ ํ•จ
  • ํ…Œ์ŠคํŠธ ์šฉ์ด์„ฑ  : ํ…Œ์ŠคํŠธ ๋น„์šฉ์„ ์ค„์ด๊ธฐ ์œ„ํ•ด์„œ๋Š” ์•œํ‚คํ…์ฒ˜ ์„ค๊ณ„๋ถ€ํ„ฐ ํ…Œ์ŠคํŠธ๋ฅผ ๊ณ ๋ คํ•ด์•ผ ํ•จ

 

# ์•„ํ‚คํ…์ฒ˜ ํ’ˆ์งˆ์†์„ฑ : ์•„ํ‚คํ…์ฒ˜ ํ’ˆ์งˆ์†์„ฑ

  • ๊ฐœ๋…์  ๋ฌด๊ฒฐ์„ฑ : ์‹œ์Šคํ…œ ์„ค๊ณ„๋Š” ์ „์ฒด ์‹œ์Šคํ…œ์„ ๋‚˜ํƒ€๋‚ด๋Š”์„ค๊ณ„์™€ ์„ธ๋ถ€ ๊ตฌ์„ฑ ์š”์†Œ ์„ค๊ณ„๋กœ ๋‚˜๋‰จ
  • ์ •ํ™•์„ฑ๊ณผ ์™„์ „์„ฑ : ์ •ํ™•์„ฑ๊ณผ ์™„์ „์„ฑ์€ ์‚ฌ์šฉ์ž๊ฐ€ ์š”๊ตฌํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ถฉ์กฑ์‹œํ‚ค๋Š” ์ •๋„๋ฅผ ๋งํ•˜๋ฉฐ ์˜ค๊ตฌ๋ถ„์„๋ช…์„ธ์™€ ์ผ์น˜ํ•˜๋Š” ์ •๋„๋ฅผ ๋‚˜ํƒ€๋ƒ„(์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์— ์žˆ๋Š” ๋‚ด์šฉ์„ ๋‹ค ํฌํ•จ ํ•ด์•ผํ•จ / ํ•„์š” ์—†๋Š” ๋‚ด์šฉ ๋„ฃ์„ ํ•„์š” ์—†์Œ)
  • ๊ฐœ๋ฐœ ์šฉ์ด์„ฑ(๊ตฌ์ถ• ๊ฐ€๋Šฅ์„ฑ) : ์ „์ฒด ์‹œ์Šคํ…œ์„ ์ ์ ˆํ•œ ๋ชจ๋“ˆ๋กœ ๋ถ„ํ• ํ•œ ํ›„ ์•Œ๋งž๊ฒŒ ๋ถ„๋ฐฐ ํ•ด ๊ฐœ๋ฐœํ•จ์œผ๋กœ์จ ์ •ํ•ด์ง„ ๊ธฐ๊ฐ„ ๋‚ด์— ๊ฐœ๋ฐœ์„ ์™„์„ฑํ•  ์ˆ˜ ์žˆ๊ณ  ๊ฐœ๋ฐœ ๊ณผ์ • ์ค‘์—๋„ ์‰ฝ๊ฒŒ ๋ณ€๊ฒฝ ํ•  ์ˆ˜ ์žˆ๋Š” ๋Šฅ๋ ฅ์„ ๋งํ•จ 

 

# ์•„ํ‚คํ…์ฒ˜์˜ 4 + 1 ๊ด€์ (View)

- ์ดํ•ด ๊ด€๊ณ„์ž ๋ณ„๋กœ ๊ด€์ ์ด ๋‹ค๋ฆ„(QA, ๊ธฐํš์ž, ๊ฐœ๋ฐœ์ž....)

- ์‹œ์Šคํ…œ์„ ์ด๋ฃจ๋Š” ์š”์†Œ์˜ ์ง‘ํ•ฉ๊ณผ ๊ทธ๋“ค์˜ ์—ฐ๊ด€ ๊ด€๊ผ๋ฅผ ์ถ”์ƒ์ ์œผ๋กœ ํ‘œํ˜„ํ•œ ๊ฒƒ!

 

 

# UI / UX

- UI(User Interface) : ์‚ฌ์šฉ์ž์™€ ์ปดํ“จํ„ฐ ์‚ฌ์ด์—์„œ ์˜์‚ฌ์†Œํ†ต์„ ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋งŒ๋“ค์–ด์ง„๋งค๊ฒŒ์ฒด(ํ™”๋ฉด๊ตฌ์„ฑ์„ ์–ด๋–ป๊ฒŒ ๋ฐฐ์น˜ํ• ์ง€)

- UX(User Experience) : ์‚ฌ์šฉ์ž๊ฐ€ ์–ด๋–ค ์‹œ์Šคํ…œ, ์ œํ’ˆ ์„œ๋น„์Šค๋ฅผ์ง/๊ฐ„์ ‘์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋ฉด์„œ ๋Š๋ผ๊ณ  ์ƒ๊ฐํ•˜๊ฒŒ ๋˜๋Š” ์ด์ฒด์ ์ธ ๊ฒฝํ—˜(์–ด๋–ค ์ด์œ ๋กœ ์†Œ๋น„์ž๊ฐ€ ๋– ๋‚˜๊ฐˆ๊นŒ.. ์ด๋Ÿฐ๋Š๋‚Œ)

 

 

# ์—ฐ๊ด€ ๊ด€๊ณ„ vs ์˜์กด๊ด€๊ณ„

 

- ์—ฐ๊ด€ ๊ด€๊ณ„(Association)

 

- ์†Œ์œ  ํ•œ๋‹ค์˜ ์˜๋ฏธ (has a)  -> ๋†’์€ ๊ฒฐํ•ฉ๋„

- ๊ฒฐํ•ฉ๋„๊ฐ€ ๋†’์•„์„œ ์ž˜ ์‚ฌ์šฉ ์•ˆํ•จ..

- 1:1, 1:N, N:M ๊ด€๊ณ„๊ฐ€ ๋งŽ๋‹ค...

- 0..* => 0..n๊ณผ ๊ฐ™์€ ์˜๋ฏธ

- ์ƒ์†๋„ ๊ฐ™์€ ๋ฉ”์„œ๋“œ๋ฅผ์‚ฌ์šฉํ•˜๋‹ˆ๊นŒ ์‹ค์„ ์œผ๋กœ(์—ฐ๊ด€ ๊ด€๊ณ„)ํ‘œ์‹œ

 

- ์˜์กด๊ด€๊ณ„(Dependency)

 

- ์‚ฌ์šฉ ํ•œ๋‹ค์˜ ์˜๋ฏธ (uses a) -> ๋‚ฎ์€ ๊ฒฐํ•ฉ๋„

- ํ˜ธ์ถœ(call)ํ•œ๋‹ค์˜ ๊ด€๊ณ„

 

 

# ํด๋ž˜์Šค ํƒ€์ž…

 

- ๊ฒฝ๊ณ„ ํด๋ž˜์Šค(Boundary Class)

- ์‹œ์Šคํ…œ ์™ธ๋ถ€์˜ ์•กํ„ฐ์™€ ์ƒํ˜ธ ์ž‘์šฉํ•˜๋Š” ํด๋ž˜์Šค

- ์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ œ์–ดํ•˜๋Š” ์—ญํ• 

- ์‹œ์Šคํ…œ์˜ ์ž…๋ ฅ๊ณผ ์ถœ๋ ฅ์„ ๋‹ด๋‹น 

- Controller์˜ ์—ญํ• !!

 

์ œ์–ด ํด๋ž˜์Šค(Control Class)

- ๊ฒฝ๊ณ„ ํด๋ž˜์Šค์™€ ์—”ํ‹ฐํ‹ฐ ํด๋ž˜์Šค ์‚ฌ์ด์— ์ค‘๊ฐ„ ์—ญํ• 

- ์‹œ์Šคํ…œ ๋‚ด๋ถ€์—์„œ ์ปจํŠธ๋กคํ•˜๋Š” ์—ญํ•  / ์‹œ์Šคํ…œ ๊ทธ ์ž์ฒด

- ์‹œ์Šคํ…œ์˜ ์‹ค์งˆ์ ์ธ๊ธฐ๋Šฅ 

- Service์˜ ์—ญํ• !!

 

- ์—”ํ‹ฐํ‹ฐ ํด๋ž˜์Šค(Entity Class)

- ์‹œ์Šคํ…œ์—์„œ ์œ ์ง€ ๋ฐ ์ถ”์ ํ•ด์•ผ ํ•  ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๋Š” ํด๋ž˜์Šค(DB์™€ ์—ฐ๊ฒฐ๋˜๋Š” ํด๋ž˜์Šค)

- ์‚ฌ์šฉ ์‚ฌ๋ก€์—์„œ ๋ฐ˜๋ณต๋˜์–ด ๋‚˜์˜ค๋Š” ์šฉ์–ด

- ๋ช…์‚ฌ ์ถ”์ถœ๋ฒ•์„ ํ†ตํ•ด์„œ ์ถ”์ถœํ•  ์ˆ˜ ์žˆ๋‹ค 

 

 


 

# ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌํ˜„

- ๊ฐœ๋ณ„ ์†Œํ”„ํŠธ์›จ์–ด ๋‹จ์œ„๋ฅผ ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ํ˜•ํƒœ๋กœ ๊ตฌํ˜„ํ•˜๊ณ  ์ด๋ฅผ ๋ฌธ์„œํ™”ํ•˜๋Š” ํ™œ๋™์œผ๋กœ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์ด๋ผ๊ณ ๋„ ํ•จ

 

 

# ํ”„๋กœ๊ทธ๋ž˜๋ฐ์˜ ์ดํ•ด

  • ์ฃผ์š” ์šฉ์–ด
    • ํ”„๋กœ๊ทธ๋žจ : ์ปดํ“จํ„ฐ๋กœ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์ž‘์„ฑํ•˜๋Š” ๋ช…๋ น์–ด๋“ค์˜ ๋ชจ์ž„
    • ํ”„๋กœ๊ทธ๋ž˜๋ฐ : ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜๋Š” ๊ณผ์ •
    • ํ”„๋กœ๊ทธ๋ž˜๋จธ : ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜๋Š” ์‚ฌ๋žŒ ๋˜๋Š” ์ž‘์—…
  • ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด : ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ์–ธ์–ด 

 

# ๊ณ ๊ธ‰ ์–ธ์–ด์™€ ์ €๊ธ‰ ์–ธ์–ด

 

- ์ €๊ธ‰ ์–ธ์–ด : ํ•˜๋“œ์›จ์–ด ์ง€ํ–ฅ์˜ ๊ธฐ๊ณ„ ์ค‘์‹ฌ ์–ธ์–ด ex) ๊ธฐ๊ณ„์–ด, ์–ด์…ˆ๋ธ”๋ฆฌ์–ด

- ๊ณ ๊ธ‰ ์–ธ์–ด : ์‚ฌ๋žŒ์ด ์ดํ•ดํ•˜๊ธฐ ์‰ฌ์šด ์ผ์ƒ ์–ธ์–ด์™€ ๊ธฐํ˜ธ๋ฅผ ์‚ฌ์šฉํ•œ ์ธ๊ฐ„ ์ค‘์‹ฌ์˜ ์–ธ์–ด ex) C, C++, ์ž๋ฐ”, ํŒŒ์ด์ฌ...

 

 

# ๋นŒ๋“œ(Build)

- ์†Œ์Šค์ฝ”๋“œ๋ฅผ ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ๋…๋ฆฝ์ ์ธ ์†Œํ”„ํŠธ์›จ์–ด๋กœ ๋งŒ๋“œ๋Š” ๊ณผ์ •(์ปดํŒŒ์ผ -> ๋งํฌ -> ํŒจํ‚ค์ง• -> ํ…Œ์ŠคํŠธ)

- ์ปดํŒŒ์ผ(Compile) : ์†Œ์Šค ํŒŒ์ผ์„ ์ปดํŒŒ์ผ๋Ÿฌ๋ฅผ ํ†ตํ•ด ๊ธฐ๊ณ„์–ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๊ณผ์ •

- ๋งํฌ(Link) : ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๊ฐœ๋ณ„์ ์ธ ์ปดํŒŒ์ผ ๊ฒฐ๊ณผ๋ฌผ(๋ชจ๋“ˆ, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋“ฑ)์„ ์—ฐ๊ฒฐํ•˜์—ฌ ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ํŒŒ์ผ์„ ๋งŒ๋“œ๋Š” ๊ณผ์ •

- ํŒจํ‚ค์ง• (Packaging) : ์ปดํŒŒ์ผ ๋ฐ ๋งํฌ๋œ ๊ฒฐ๊ณผ๋ฌผ์„ ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ํ˜•ํ…Œ๋กœ ๋ฌถ๋Š” ๊ณผ์ •(๋ฆฌ์†Œ์Šค ํŒŒ์ผ(์ด๋ฏธ์ง€, ์„ค์ • ํŒŒ์ผ ๋“ฑ)์„ ํฌํ•จํ•˜์—ฌ ๋ฐฐํฌ ๊ฐ€๋Šฅํ•œ ํ˜•์‹์œผ๋กœ ์••์ถ•)

- ํ…Œ์ŠคํŠธ : ๋นŒ๋“œ๋œ ๊ฒฐ๊ณผ๋ฌผ์ด ์˜๋„ํ•œ ๋Œ€๋กœ ์ž‘๋™ํ•˜๋Š”์ง€ ๊ฒ€์ฆํ•˜๋Š” ๊ณผ์ •(์ฃผ๋กœ ๊ธฐ๋Šฅ ํ…Œ์ŠคํŠธ๋ฅผ ์ˆ˜ํ–‰)

 

 

# ๋นŒ๋“œ ๋„๊ตฌ : Maven

- Java ๋นŒ๋“œ ๊ด€๋ฆฌ ๋„๊ตฌ

- ์‚ฌ์šฉ ๋ชฉ์ 

  1. ๋ชจ๋‘๊ฐ€ ๋™์ผํ•œ ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด์„œ(๊ฐ™์€ ํด๋” ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง€๊ธฐ ์œ„ํ•ด์„œ!!)
  2. ์ •ํ˜•ํ™”๋œ ์†Œ์Šค์ฝ”๋“œ ๊ตฌ์กฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ
  3. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์˜์กด์„ฑ์„ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด์„œ
  4. ๋‹ค๋ฅธ ๋„๊ตฌ์™€ ์‰ฝ๊ฒŒ ์—ฐ๋™ํ•˜๊ธฐ ์œ„ํ•ด์„œ

- ์ผ๋ฐ˜์ ์ธ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•

  1. ํŒ€์˜ AA(Application Architect)๊ฐ€ Maven ๊ตฌ์กฐ ์ƒ์„ฑ ๋ฐ ์˜์กด์„ฑ ๊ด€๋ฆฌ
  2. pom.xmlํŒŒ์ผ์— ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์˜์กด์„ฑ ๋ฐ ํ”Œ๋Ÿฌ๊ทธ์ธ ๊ด€๋ฆฌ(QA์˜ ๊ฒฝ์šฐ, ํ’ˆ์งˆ ๊ด€๋ จ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์ •)
  3. ๊ฐœ๋ฐœ ํŒ€์›์€ ์ •ํ•ด์ง„ ํŒจํ‚ค์ง€์—์„œ ์†Œ์Šค์ฝ”๋“œ ๊ฐœ๋ฐœ 

# ๋ผ์ดํ”„์‚ฌ์ดํด๊ณผ ๋‹จ๊ณ„

  1. ๋ผ์ดํ”„์‚ฌ์ดํด
    1. clean : ์ด์ „ ๋นŒ๋“œ์—์„œ ์ƒ์„ฑ๋œ ์‚ฐ์ถœ๋ฌผ์„ ์‚ญ์ œํ•˜๋Š” ๊ธฐ๋Šฅ
    2. default : ํ”„๋กœ์ ํŠธ ๋นŒ๋“œ/๋ฐฐํฌ์™€ ๊ด€๋ จ๋œ ๊ธฐ๋Šฅ
    3. site : ํ”„๋กœ์ ํŠธ์˜ ์‚ฌ์ดํŠธ ๋ฌธ์„œ ์ƒ์„ฑ๊ณผ ๊ด€๋ จ๋œ ๊ธฐ๋Šฅ
  2. default ์˜ ๋‹จ๊ณ„
    1. validate : ์ •์ƒ์ ์€ ํ”„๋กœ์ ํŠธ์ด๊ณ  ํ•„์š”ํ•œ ๋ชจ๋“  ์ •๋ณด๊ฐ€ ์ค€๋น„๋˜์—ˆ๋Š”์ง€ ํ™•์ธ
    2. compile : ํ”„๋กœ์ ํŠธ์˜ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ์ปดํŒŒ์ผ
    3. test : ์ปดํŒŒ์ผํ•œ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ๋‹จ์œ„ ํ…Œ์ŠคํŠธ ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์ด์šฉํ•ด ํ…Œ์ŠคํŠธ
    4. package : JAR์™€ ๊ฐ™์ด ์ง€์ •๋œ ํฌ๋งท์œผ๋กœ ํŒจํ‚ค์ง•
    5. verify : ํŒจํ‚ค์ง€๊ฐ€ ํ’ˆ์งˆ ์ˆ˜์ค€์„ ๋งŒ์กฑํ•˜๋Š”์ง€ ๊ฒ€์ฆ
    6. install : ํŒจํ‚ค์ง€๋ฅผ ๋กœ์ปฌ ์ €์žฅ์†Œ์— ์„ค์น˜
    7. deploy : ์ตœ์ข… ํŒจํ‚ค์ง€๋ฅผ ์›๊ฒฉ ์ €์žฅ์†Œ๋กœ ๋ณต์‚ฌ
  3. Maven ๋ช…๋ น
mvn clean package site pmd:pmd jdepend:generate

 

# Git ์†Œ๊ฐœ

- ๋ฒ„์ „ ๊ด€๋ฆฌ์˜ ๋Œ€ํ‘œ ๋„๊ตฌ

- ๋ชฉ์  : ๋ฒ„์ „ ๊ด€๋ฆฌ์™€ ํ˜‘์—… ์ปค๋ฎค๋‹ˆ์ผ€์ด์…˜

- ์ผ๋ฐ˜์ ์ธ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•

  1. ๋ณ„๋„์˜ ์ €์žฅ์†Œ ์šด์˜ ์„œ๋ฒ„ ์‚ฌ์šฉ
    1. Git: GitHub, BitBuket, GitLab, Giblit
    2. ํ†ตํ•ฉ ์ €์žฅ์†Œ : SCMManager
  2. ํด๋ผ์ด์–ธํŠธ๋Š” Core๋‚˜ ๋ณ„๋„์˜ ํ™•์žฅ ๋„๊ตฌ ์‚ฌ์šฉ
    1. Eclipse/Intelli J ๊ณ„์—ด / VS Code ํ”Œ๋Ÿฌ๊ทธ์ธ : ๊ธฐ๋ณธํฌํ•จ
    2. Tortoise ์‹œ๋ฆฌ์ฆˆ
    3. Sourcetree 

 

์‹ค์Šต

 

1. github์—์„œ ์ €์žฅ์†Œ ํ•˜๋‚˜ ์ƒ์„ฑ (junit4 ํ”„๋กœ์ ํŠธ fork)

2. github ์ €์žฅ์†Œ (์›๊ฒฉ) >> local(์ปดํ“จํ„ฐ)์— ๋ณต์ œ (git clone)

> ํŒŒ์ผ ํ•˜๋‚˜ ์ˆ˜์ •

> ์ˆ˜์ •๋œ ํŒŒ์ผ commit

> ๋กœ์ปฌ == ์›๊ฒฉ ๋™์ผํ•˜๊ฒŒ ์„ธํŒ…!

 

3. eclipse ํ”„๋กœ์ ํŠธ (maven)

 

 


 

# ํ’ˆ์งˆ(Quality) ์ •์˜

 

- ๋ฌผ๊ฑด์ด ์–ผ๋งˆ๋‚˜ ์ข‹์€์ง€, ๋‚˜์œ์ง€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ •๋„

- ํ’ˆ์งˆ์€ ๋ชจ๋“  ์ œํ’ˆ์—์„œ ๊ฐ€์žฅ ์ค‘์š”ํ•œ ์š”์†Œ์ด๋ฉฐ, ์†Œํ”„ํŠธ์›จ์–ด ์ œํ’ˆ๋„ ์˜ˆ์™ธ๋Š” ์•„๋‹˜

 

- ๋ช…์‹œ์ , ๋ฌต์‹œ์ ์š”๊ตฌ๋ฅผ ๋งŒ์กฑ์‹œํ‚ค๋Š” ์ œํ’ˆ ๋˜๋Š”์„œ๋น„์Šค์˜ ๋Šฅ๋ ฅ์— ๊ด€ํ•œ ํŠน์„ฑ

(๊ณ ๊ฐ์˜ ์š”๊ตฌ๋ฅผ ๋งŒ์กฑ์‹œํ‚ค๋Š” ๊ฒƒ / ํ’ˆ์งˆ์€ ์‚ฌ์šฉ ๋ชฉ์ ์— ์ผ์น˜๋˜๋Š” ์ •๋„ / ํ’ˆ์งˆ์€ ๊ณ ๊ฐ ์š”๊ตฌ์‚ฌํ•ญ์— ๋Œ€ํ•œ ์ ํ•ฉ๋„)

 

 

# ์†Œํ”„ํŠธ์›จ์–ด ํ’ˆ์งˆ์˜ ์ •์˜

  1.    IEEE
    1. ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ํ•„์š”ํ•œ ์†์„ฑ์„ ๋ณด์œ ํ•˜๊ณ  ์žˆ๋Š” ์ •๋„
    2. ์‚ฌ์šฉ์ž์˜ ๊ธฐ๋Œ€ ์ˆ˜์ค€์„ ๋งŒ์กฑํ•  ์ˆ˜ ์žˆ๋Š” ์ •๋„๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ์†Œํ”„ํŠธ์›จ์–ด์˜ ํŠน์„ฑ
  2. United States Department of Defense (DoD ๋ฏธ ๊ตญ๋ฐฉ๋ถ€)
    1. ๊ฐœ๋ฐœ๋œ ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ์‚ฌ์šฉ์ž์˜ ์š”๊ตฌ์‚ฌํ•ญ์„ ๋งŒ์กฑํ•  ์ˆ˜ ์žˆ๋Š” ๋Šฅ๋ ฅ
  3. Roger S.Pressman
    1. ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ๊ธฐ๋Šฅ ์„ฑ๋Šฅ ๋ฐ ๋งŒ์กฑ๋„์— ์žˆ์–ด์„œ ๋ช…์‹œ๋œ ์š”๊ตฌ์‚ฌํ•ญ ๋ฐ ๋‚ด์žฌ๋œ ์š”๊ตฌ์‚ฌํ•ญ์„ ์–ผ๋งˆ๋‚˜ ์ถฉ์กฑํ•˜๋Š” ๊ฐ€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š”์†Œํ”„ํŠธ์›จ์–ด ํŠน์„ฑ์˜ ์ด์ฒด

 

# ํ’ˆ์งˆ ๋†’์€ ์†Œํ”„ํŠธ์›จ์–ด๋ž€?

=> ์‚ฌ์šฉ์ž๊ฐ€ ์›ํ•˜๋Š” ์†Œํ”„ํŠธ์›จ์–ด + ์ •์ƒ ๋™์ž‘ํ•˜๋Š” ์†Œํ”„ํŠธ์›จ์–ด + ์™„์„ฑ๋„๊ฐ€ ๋†’์€ ์†Œํ”„ํŠธ์›จ์–ด

[๊ฐœ๋ฐœ์ž ๊ด€์ ]  ํ”„๋กœ๊ทธ๋žจ์— ๊ฒฐํ•จ์ด ์—†๊ณ  ์‚ฌ์šฉ์ž์˜ ์š”๊ตฌ๋ฅผ ์ •์˜ํ•œ ์š”๊ตฌ๋ถ„์„ ๋ช…์„ธ์„œ๋Œ€๋กœ ๋งŒ๋“  ์†Œํ”„ํŠธ์›จ์–ด

 

 

# ์†Œํ”„ํŠธ์›จ์–ด ํ’ˆ์งˆ(Software Quality)

  • ์ œํ’ˆ(Product) ํ’ˆ์งˆ
    • ์ œํ’ˆ ์ž์ฒด๊ฐ€ ๊ฐ€์ง€๋Š” ํ’ˆ์งˆ
    • ์™„์„ฑ๋œ ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ์šด์šฉ๋  ํ™˜๊ฒฝ์— ์˜ฌ๋ ค์ ธ ์ตœ์ข… ์‹œ์Šคํ…œ์ด ์™„์„ฑ๋˜์—ˆ์„ ๋•Œ, ์†Œ๋น„์ž๊ฐ€ ์š”๊ตฌํ•˜๋Š” ๋ฐ”์— ์–ผ๋งˆ๋‚˜ ๋ถ€ํ•ฉํ•˜๋Š”์ง€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ํ’ˆ์งˆ
  •  ํ”„๋กœ์„ธ์Šค(Process) ํ’ˆ์งˆ
    • ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ๊ฐœ๋ฐœํ•˜๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•œ๋ชจ๋“  ๊ฐœ๋ฐœ ํ™œ๋™์ด ๊ณ„ํš์„ ์ค€์ˆ˜ํ•˜์—ฌ ๊ฐœ๋ฐœํ•˜์˜€๋Š”๊ฐ€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ํ’ˆ์งˆ
    • ๊ทธ ํ™œ๋™์ด ํšจ๊ณผ์ ์ธ์ง€์— ๋Œ€ํ•ด ๊ฒ€ํ† (Review) ๋ฐ ๊ฐ์‚ฌ(Audit) ํ™œ๋™์„ ํ†ตํ•ด ํ™•์ธ

 

#   ์†Œํ”„ํŠธ์›จ์–ด ์ œํ’ˆ ํ’ˆ์งˆ ํŠน์ •

 

- ์†Œํ”„ํŠธ์›จ์–ด ์ œํ’ˆํ’ˆ์งˆ์ด ๊ฐ€์ ธ์•ผํ•˜๋Š” ์„ธ๋ถ€ ์†์„ฑ 

- ISO 25010(๊ณผ๊ฑฐ ISO 9126)์— ์†Œํ”„ํŠธ์›จ์–ด ํ’ˆ์งˆ ํŠน์„ฑ ์ •์˜

  • ๊ธฐ๋Šฅ์„ฑ : ์š”๊ตฌ๋˜๋Š” ๊ธฐ๋Šฅ์„ ๋งŒ์กฑ์‹œํ‚ค๋Š” ๋Šฅ๋ ฅ
  • ์‹ ๋ขฐ์„ฑ : ๊ทœ์ •๋œ ํ™˜๊ฒฝ์—์„œ ๊ฒฐํ•จ ์—†์ด ์˜๋„๋œ ๊ธฐ๋Šฅ ๋ฐ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๋Šฅ๋ ฅ
  • ์‚ฌ์šฉ์„ฑ : ์‚ฌ์šฉ์ž๊ฐ€ ์ดํ•ดํ•˜๊ณ  ๋ฐฐ์šฐ๊ธฐ ์‰ฌ์šด ์ •๋„
  • ํšจ์œจ์„ฑ : ์ ์ ˆํ•œ์ž์›์˜ ์‚ฌ์šฉ ๋ฐ ์ ์ •ํ•œ ๋ฐ˜์‘์‹œ๊ฐ„ ์ •๋„
  • ์œ ์ง€๋ณด์ˆ˜์„ฑ : ์†Œํ”„ํŠธ์›จ์–ด์˜ ์ˆ˜์ • ๋ฐ ๋ณ€๊ฒฝ์˜ ์šฉ์ด์„ฑ
  • ์ด์‹์„ฑ : ์ง€์›ํ•˜๋Š” ๋‹ค์–‘ํ•œ ํ™˜๊ฒฝ์—์„œ ์šด์˜๋  ์ˆ˜ ์žˆ๋Š” ๋Šฅ๋ ฅ
  • ์ƒํ˜ธ์šด์˜์„ฑ : ๋‹ค๋ฅธ ์‹œ์Šคํ…œ๊ณผ์˜ ์ƒํ˜ธ ์—ฐ๋™ ๋Šฅ๋ ฅ
  • ๋ณด์•ˆ์„ฑ : ์ •๋ณด ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณดํ˜ธํ•˜๋Š” ๋Šฅ๋ ฅ
  • + ์•ˆ์ „์„ฑ

  

# ์†Œํ”„ํŠธ์›จ์–ด ์ œํ’ˆ ํ’ˆ์งˆ ์ˆ˜์ค€ ์•Œ๊ธฐ : V & V

  • Verification (๊ฒ€์ฆ)
    • ์ œํ’ˆ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ƒ์„ฑ๋˜๊ณ  ์žˆ๋Š”๊ฐ€? (Are we building the product right?)
    • ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ์ •ํ™•ํ•œ ์š”๊ตฌ์‚ฌํ•ญ์— ๋ถ€ํ•จํ•˜์—ฌ ๊ตฌํ˜„๋˜์—ˆ์Œ์„ ๋ณด์žฅํ•˜๋Š”ํ™œ๋™
    • ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ์— ๋งž๊ฒŒ ์˜ฌ๋ฐ”๋ฅธ ๋ฐฉ๋ฒ•์œผ๋กœ ์ œํ’ˆ์„ ๋งŒ๋“ค๊ณ  ์žˆ์Œ์„ ๋ณด์žฅ
    • ์™„์„ฑ๋„๊ฐ€ ๋†’์€ + ์ •์ƒ ๋™์ž‘ํ•˜๋Š” ์ œํ’ˆ!!!
  • Validation (ํ™•์ธ)
    • ์˜ฌ๋ฐ”๋ฅธ ์ œํ’ˆ์„ ์ƒ์„ฑํ•˜๊ณ  ์žˆ๋Š”๊ฐ€? (Are we building the right product?)
    • ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ๊ณ ๊ฐ์ด ์˜๋„ํ•œ ์š”๊ตฌ์‚ฌํ•ญ์— ๋”ฐ๋ผ ๊ตฌํ˜„๋˜์—ˆ์Œ์„ ๋ณด์žฅํ•˜๋Š” ํ™œ๋™
    • ๊ณ ๊ฐ์ด ์˜๋„ํ•œ ํ™˜๊ฒฝ์ด๋‚˜ ์‚ฌ์šฉ ๋ชฉ์ ์— ๋งž๊ฒŒ ์˜ฌ๋ฐ”๋ฅธ์ œํ’ˆ์„ ๋งŒ๋“ค๊ณ  ์žˆ์Œ์„ ๋ณด์žฅ
    • ์‚ฌ์šฉ์ž๊ฐ€ ์›ํ•˜๋Š” ์ œํ’ˆ!!!

 

#   V๋ชจ๋ธ์—์„œ์˜ V & V

 

- ๊ฐœ๋ฐœ ์ƒ๋ช…์ฃผ๊ธฐ์˜ ๊ฐ ๋‹จ๊ณ„์™€ ๊ทธ์— ์ƒ์‘ํ•˜๋Š” ์†Œํ”„ํŠธ์›จ์–ด ํ…Œ์ŠคํŠธ ๋‹จ๊ณ„๋ฅผ ๋งคํ•‘ํ•œ ๋ชจ๋ธ : V ๋ชจ๋ธ

- ์†Œํ”„ํŠธ์›จ์–ด ๊ฐœ๋ฐœ ํ”„๋กœ์„ธ์Šค๋กœ ํญํฌ์ˆ˜ ๋ชจ๋ธ์˜ ํ™•์žฅ๋œ ํ˜•ํƒœ ์ค‘ ํ•˜๋‚˜๋กœ, ๊ฐœ๋ฐœ ์ƒ๋ช…์ฃผ๊ธฐ์˜ ๊ฐ ๋‹จ๊ณ„์™€ ๊ทธ์— ์ƒ์‘ํ•˜๋Š” ์†Œํ”„ํŠธ์›จ์–ด ์‹œํ—˜ ๊ฐ ๋‹จ๊ณ„์˜ ๊ด€๊ณ„๋ฅผ ๋‚˜ํƒ€๋ƒ„

์ธ์ˆ˜ ํ…Œ์ŠคํŒ… : Validation / ์‹œ์Šคํ…œ, ํ†ตํ•ฉ, ๋‹จ์œ„ : Verification

 

 

# ์†Œํ”„ํŠธ์›จ์–ด ํ…Œ์ŠคํŠธ

 

- ์ •์ƒ ์กฐ๊ฑด ๋ฐ ๋น„์ •์ƒ ์กฐ๊ทผ(์ฆ‰, ๊ฒฐํ•จ/๋ฒ„๊ทธ) ์‚ฌ์ด์˜ ์ฐจ์ด์ ์„ ๋ฐœ๊ฒฌํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ์†Œํ”„ํŠธ์›จ์–ด ํ•ญ๋ชฉ์„ ๋ถ„์„ํ•˜๊ณ , ๋ถ„์„๋œ ํ•ญ๋ชฉ์˜ ํŠน์„ฑ์„ ํ‰๊ฐ€ํ•˜๋Š” ํ”„๋กœ์„ธ์Šค

=> ๊ฒฐํ•จ์˜ ๋ฐœ๊ฒฌ์„ ๋ชฉ์ ์œผ๋กœ ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ๋ถ„์„ํ•˜๋Š” ํ™œ๋™

 

 

# Error, Defect, Failure ์šฉ์–ด ์ •์˜

  1. ์—๋Ÿฌ (Error) : ๊ฒฐํ•จ์˜ ์›์ธ์œผ๋กœ ์‚ฌ๋žŒ(SW ๊ฐœ๋ฐœ์ž, ๋ถ„์„๊ฐ€ ๋“ฑ)์— ์˜ํ•˜์—ฌ ์ƒ์„ฑ๋œ ์‹ค์ˆ˜๊ฐ€ ์ฃผ๋ฅผ ์ด๋ฃธ
  2. ๊ฒฐํ•ฉ(Defect, Fault), ๋ฒ„๊ทธ(Bug) : ์‹คํŒจ / ๊ณ ์žฅ ๋˜๋Š” ๋ฌธ์ œ์˜ ์›์ธ์œผ๋กœ ์ œํ’ˆ์— ํฌํ•จ๋œ ๊ฒฐ์ 
  3. ์‹คํŒจ / ๊ณ ์žฅ(Failure), ๋ฌธ์ œ(Problem) : ์ œํ’ˆ์˜ ๊ฒฐํ•จ(Defect)์ด ์žˆ๋Š” ๋ถ€๋ถ„์ด ์‹คํ–‰๋ ๋•Œ ๋ฐœ์ƒ๋˜๋Š” ํ˜„์ƒ
์˜ˆ์‹œ...

Input : Distance, Time
Output : Speed = Distance / Time

1. ์—๋Ÿฌ(Error)
Didn't think about the case of <time=0>

2. ๊ฒฐํ•จ(Defect, Fault) 
There is no code for handling when <time=0>

3. ์‹คํŒจ/๊ณ ์žฅ(Failure)
<Divide by Zero Exception> happened

 

 

#  ์†Œํ”„ํŠธ์›จ์–ด ํ…Œ์ŠคํŠธ ์ข…๋ฅ˜

  1. ์ •์ (Static)์ธ ๋ฐฉ๋ฒ•
    1. ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ์‹คํ–‰ํ•˜์ง€ ์•Š๊ณ  ๊ฒฐํ•จ์„ ๋ฐœ๊ฒฌ
    2. ์—ฌ๋Ÿฌ ์ฐธ๊ฐ€์ž๋“ค์ด ๋ชจ์—ฌ ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ๊ฒ€ํ† ํ•˜์—ฌ ๊ฒฐํ•จ์„ ์ฐพ์•„๋‚ด๊ฑฐ๋‚˜ ์ •์  ๊ฒ€์ฆ ๋„๊ตฌ ์ด์šฉ
    3. ์†Œํ”„ํŠธ์›จ์–ด ๊ฐœ๋ฐœ ์ค‘์— ์ƒ์„ฑ๋˜๋Š” ๋ชจ๋“  ์‚ฐ์ถœ๋ฌผ๋“ค์— ๋Œ€ํ•ด์„œ ์ ์šฉ ๊ฐ€๋Šฅ
    4. ํ”„๋กœ์ ํŠธ๊ฐ€ ์‹œ์ž‘ํ• ๋•Œ๋ถ€ํ„ฐ ๋๋‚ ๋•Œ๊นŒ์ง€ ์ˆ˜ํ–‰ ๊ฐ€๋Šฅ
    5. ๋Œ€ํ‘œ์ ์ธ ๋ฐฉ๋ฒ•
      1. ๋™๋ฃŒ ๊ฒ€ํ† (Peer Review)
        1. ์ธ์Šคํ…์…˜(Inspection)
        2. ์›Œํฌ์Šค๋ฃจ(Walk-through)
        3. ๋ฐ์Šคํฌ์ฒดํฌ(Desk Check)
      2. ๋„๊ตฌ๋ฅผ ์ด์šฉํ•œ ์ •์  ๋ถ„์„
        1. ๋ฃฐ ๊ธฐ๋ฐ˜ ์ •์ ๋ถ„์„(PMD, BugFind๋“ฑ)
        2. ์˜์กด์„ฑ ๋ถ„์„
        3. ์ฝ”๋“œ ๋ฉ”ํŠธ๋ฆญ ์ธก์ •  
  2. ๋™์ (Dynamic)์ธ ๋ฐฉ๋ฒ•(์ข์€ ์˜๋ฏธ์—์„œ์˜ ํ…Œ์ŠคํŠธ๋Š” ๋™์  ํ…Œ์ŠคํŠธ๋ผ๊ณ ๋„ ํ•จ)
    1. ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๊ฒฐํ•จ์„ ๋ฐœ๊ฒฌ
    2. ๋ฐœ๊ฒฌ๋œ ๊ฒฐํ•จ์€ ๋””๋ฒ„๊น… ํ™œ๋™์œผ๋กœ ํ™•์ธํ•˜์—ฌ ์ˆ˜์ •ํ•จ
    3. ์†Œ์Šค์ฝ”๋“œ ๋งŒ๋“ค์–ด์ง„ ์ดํ›„์— ์ˆ˜ํ–‰ํ•จ!
    4. ๋Œ€ํ‘œ์ ์ธ ๋ฐฉ๋ฒ•
      1. ํ…Œ์ŠคํŠธ
        1. ๋‹จ์œ„ ํ…Œ์ŠคํŠธ(Unit Test)
        2. ํ†ตํ•ฉ ํ…Œ์ŠคํŠธ(Integration Test)
        3. ์‹œ์Šคํ…œ ํ…Œ์ŠคํŠธ(System Test)
        4. ์ธ์Šค ํ…Œ์ŠคํŠธ(Acceptance Test)
      2. ํ…Œ์ŠคํŠธ
        1. ๋ธ”๋ž™๋ฐ•์Šค ํ…Œ์ŠคํŠธ(๋ช…์„ธ ๊ธฐ๋ฐ˜ ํ…Œ์ŠคํŠธ)
        2. ํ™”์ดํŠธ๋ฐ•์Šค ํ…Œ์ŠคํŠธ(๊ตฌ์กฐ ๊ธฐ๋ฐ˜ ํ…Œ์ŠคํŠธ)

 

# ์†Œํ”„ํŠธ์›จ์–ด ํ…Œ์ŠคํŠธ ํ”„๋กœ์„ธ์Šค

- ์†Œํ”„ํŠธ์›จ์–ด ํ…Œ์ŠคํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ์ ˆ์ฐจ/๋ฐฉ๋ฒ•, ๋„๊ตฌ/์žฅ๋น„, ์ธ๋ ฅ์˜ ํ†ตํ•ฉ

- ํ…Œ์ŠคํŠธ ์ ˆ์ฐจ : ํ…Œ์ŠคํŠธ ๊ณ„ํš -> ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์„ค๊ณ„ -> ํ…Œ์ŠคํŠธ ์‹คํ–‰ ๋ฐ ์ธก์ • -> ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๋ถ„์„ -> ์˜ค๋ฅ˜ ์ถ”์  ๋ฐ ์ถ”์ •

- ๊ตญ์ œ ํ‘œ์ค€ : ISO/IEC 29119 

- ํ…Œ์ŠคํŠธ ํ™œ๋™

  • ํ…Œ์ŠคํŠธ ๊ณ„ํš(Test Planning), ํ…Œ์ŠคํŠธ ๋ชจ๋‹ˆํ„ฐ๋ง ๋ฐ ์ œ์–ด(Test Monitoring and Control), ํ…Œ์ŠคํŠธ ๋ถ„์„(Test Analysis), ํ…Œ์ŠคํŠธ ๋””์ž์ธ, ํ…Œ์ŠคํŠธ ๊ตฌํ˜„, ํ…Œ์ŠคํŠธ ์‹คํ–‰, ํ…Œ์ŠคํŠธ ์™„๋ฃŒ... (๋‹ค ํ•˜์ง€๋Š” ์•Š์Œ)
  1. ํ…Œ์ŠคํŠธ ๊ณ„ํš
    1. ํ…Œ์ŠคํŠธ ๋ชฉํ‘œ๋ฅผ ์ •์˜ํ•˜๊ณ  ํ…Œ์ŠคํŠธ ๋Œ€์ƒ ๋ฐ ๋ฒ”์œ„๋ฅผ ๊ฒฐ์ •ํ•˜๋ฉฐ, ํ…Œ์ŠคํŠธ ๊ณ„ํš์„œ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ๊ฒ€ํ† 
    2. ํ…Œ์ŠคํŠธ ๊ณ„ํš์€ ์ดˆ๋ฐ˜์—๋งŒ ํ•˜๋Š๋ƒ?? ๋ชจ๋“  ํ…Œ์ŠคํŠธ ๊ณผ์ •์—์„œ ๊ณ„ํš์ด ํ•„์š”ํ•จ... 
    3. ์†Œํ”„ํŠธ์›จ์–ด ํ…Œ์ŠคํŠธ ๊ณ„ํš ๋‹จ๊ณ„
      1. ์ž…๋ ฅ : ํ”„๋กœ์ ํŠธ ๊ณ„ํš์„œ, ์š”๊ตฌ๋ถ„์„ ๋ช…์„ธ์„œ
      2. ์ฒ˜๋ฆฌ : ํ…Œ์ŠคํŠธ ๋ชฉํ‘œ ์ •์˜, ํ…Œ์ŠคํŠธ ๋Œ€์ƒ ๋ฐ ๋ฒ”์œ„ ๊ฒฐ์ •, ํ…Œ์ŠคํŠธ ๊ณ„ํš์„œ ์ž‘์„ฑ ๋ฐ ๊ฒ€ํ† 
      3. ๊ฒฐ๊ณผ : ํ…Œ์ŠคํŠธ ์š”๊ตฌ์‚ฌํ•ญ ์ •์˜์„œ, ํ…Œ์ŠคํŠธ ๊ณ„ํš์„œ
  2. ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์„ค๊ณ„
    1. ํ…Œ์ŠคํŠธ ์„ค๊ณ„ ๊ธฐ๋ฒ•์„ ์ •์˜ํ•˜๊ณ , ๋„์ถœ๋œ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค์— ์ž…๋ ฅ ๊ฐ’์œผ๋กœ ์‚ฌ์šฉ ํ•  ์›์‹œ ๋ฐ์ดํ„ฐ๋ฅผ ์ž‘์„ฑ
      1. ์†Œํ”„ํŠธ์›จ์–ด ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์„ค๊ณ„ ๋‹จ๊ณ„
        1. ์ž…๋ ฅ : ํ…Œ์ŠคํŠธ ๊ณ„ํš์„œ
        2. ์ฒ˜๋ฆฌ : ํ…Œ์ŠคํŠธ ์„ค๊ณ„ ๊ธฐ๋ฒ• ์ •์˜, ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ๋„์ถœ, ์›์‹œ ๋ฐ์ดํ„ฐ ๊ธฐ๋ฐ˜
        3. ๊ฒฐ๊ณผ : ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ๋ช…์„ธ์„œ, ํ…Œ์ŠคํŠธ ์„ค๊ณ„์„œ, ํ…Œ์ŠคํŠธ ์ ˆ์ฐจ์„œ
    2. ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค(Test Case)
      1. ํŠน์ •ํ•œ ์š”๊ตฌ์‚ฌํ•ญ์ด ์ œ๋Œ€๋กœ ๊ตฌํ˜„๋˜์—ˆ๋Š”์ง€ ๊ฒ€์ฆํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ํ…Œ์ŠคํŠธ ์กฐ๊ฑด, ์ž…๋ ฅ ๊ฐ’, ์˜ˆ์ƒ ์ถœ๋ ฅ ๊ฐ’, ์‹ค์ œ ์ˆ˜ํ–‰ํ•œ ๊ฒฐ๊ณผ๋ฅผ ๊ธฐ๋กํ•˜๋Š”๊ฒƒ
    3.  ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ž‘์„ฑ ์‹œ์ 
      1. ํ…Œ์ŠคํŠธ ๋ฒ ์ด์‹œ์Šค(๊ทผ๊ฑฐ ๋ฌธ์„œ)๋ฅผ ์ž‘์„ฑํ• ๋•Œ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ž‘์„ฑ
      2. ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ž‘์„ฑ์„ ํ†ตํ•ด ํ…Œ์ŠคํŠธ ๋ฒ ์ด์‹œ์Šค์˜ ํ’ˆ์งˆ์„ ๊ฐœ์„ 

 

3. ํ…Œ์ŠคํŠธ ์‹คํ–‰ ๋ฐ ์ธก์ •

- ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ์„ ๊ตฌ์ถ•ํ•˜๊ณ  ๋„์ถœ๋œ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ด์šฉํ•ด ํ…Œ์ŠคํŠธ๋ฅผ ์‹ค์‹œํ•˜๊ณ  ํ…Œ์ŠคํŠธ ์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ๋ฌธ์„œํ™”

- ์‹คํŒจํ•˜๋Š”๋ชจ๋“  ํ•ญ๋ชฉ์— ๋Œ€ํ•ด์„œ ๊ฒฐํ•จ๊ด€๋ฆฌ๋ฅผ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•œ๋‹ค

 

4.  ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๋ถ„์„

- ํ…Œ์ŠคํŠธ๊ฐ€ ๋๋‚˜๋ฉด ๊ณ„ํš ๋Œ€๋น„ ๊ฒฐ๊ณผ๋ฅผ ๋น„๊ต ๋ถ„์„ํ•˜๊ณ  ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ์— ๋Œ€ํ•œ ๋ณด๊ณ ์„œ๋ฅผ ์ž‘์„ฑ

- ์ž…๋ ฅ : ํ…Œ์ŠคํŠธ ๊ณ„ํš ๋‹จ๊ณ„์˜ ๋ชฉํ‘œ ๊ฐ’, ํ…Œ์ŠคํŠธ ํ™œ๋™์„ํ†ตํ•ด ์–ป์€ ๊ฒฐ๊ณผ ๊ฐ’

- ์ฒ˜๋ฆฌ : ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๋ถ„์„, ๋ณด๊ณ ์„œ ์ž‘์„ฑ

- ๊ฒฐ๊ณผ : ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ณ„ ๊ฒฐ๊ณผ ๋ถ„์„์„œ, ์†Œํ”„ํŠธ์›จ์–ด ์ƒํƒœ ๋ณด๊ณ ์„œ, ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๋ณด๊ณ ์„œ

 

 5. ์˜ค๋ฅ˜ ์ถ”์  ๋ฐ ์ˆ˜์ •

 - ํ…Œ์ŠคํŠธ๊ฐ€ ๋๋‚˜๋ฉด ๊ณ„ํš ๋Œ€๋น„ ๊ฒฐ๊ณผ๋ฅผ ๋น„๊ต ๋ถ„์„ํ•˜๊ณ  ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ์— ๋Œ€ํ•œ ๋ณด๊ณ ์„œ๋ฅผ ์ž‘์„ฑ

- ์ž…๋ ฅ : ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๋ณด๊ณ ์„œ, ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ณ„ ๊ฒฐ๊ณผ ๋ถ„์„์„œ

- ์ฒ˜๋ฆฌ : ์˜ค๋ฅ˜ ์ˆ˜์ • ๊ณ„ํš, ์˜ค๋ฅ˜ ์ˆ˜์ •, ์ˆ˜์ •๋œ ๋‚ด์šฉ ๊ฒ€ํ† 

- ๊ฒฐ๊ณผ : ์ˆ˜์ • ๊ฒฐ๊ณผ ๋ณด๊ณ ์„œ 

 

 

# ํ…Œ์ŠคํŠธ ์›๋ฆฌ

  • ํ…Œ์ŠคํŠธ๋Š” ๊ฒฐํ•จ์ด ์กด์žฌํ•จ์„ ๋ฐํžˆ๋Š” ํ™œ๋™
  • ์™„๋ฒฝํ•œ ํ…Œ์ŠคํŠธ๋Š” ๋ถˆ๊ฐ€๋Šฅ(์ „์ˆ˜ ํ…Œ์ŠคํŠธ ๋ถˆ๊ฐ€๋Šฅ)
  • ํ…Œ์ŠคํŠธ๋Š” ๊ฐœ๋ฐœ ์ดˆ๊ธฐ์— ์‹œ์ž‘
  • ๊ฒฐํ•จ ์ง‘์ค‘
  • ์‚ด์ถฉ์ œ ํŒจ๋Ÿฌ๋…์Šค
  • ํ…Œ์ŠคํŠธ๋Š” ์ •ํ™ฉ(Context)์— ์˜์กด์ 
  • ์˜ค๋ฅ˜ ๋ถ€์žฌ์˜ ๊ถค๋ณ€  

 

# ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์ข‹์€ ์†Œ์Šค์ฝ”๋“œ ์ž‘์„ฑ ๋ฐฉ๋ฒ•

  • ๋ฉ”์„œ๋“œ๋Š” ์ ์ •ํ•œ  ํฌ๊ธฐ๋กœ ์ž‘์„ฑ
    • LOC 80 ๋ผ์ธ ์ดํ•˜
  • ๋ฉ”์„œ๋“œ๋ฅผ ๋„ˆ๋ฌด ๋ณต์žกํ•˜์ง€ ์•Š๊ฒŒ ์ž‘์„ฑ
    • ์ˆœํ™˜ ๋ณต์žก๋„ 10์ดํ•˜ / ์ธ์ง€ ๋ณต์žก๋„ 2-3 ๊ถŒ์žฅ
    • if(A)๋Š” 9๊ฐœ๊นŒ์ง€. (์ด ์กฐ๊ฑด๋ฌธ์€ CNN1)
  • ์ฝ”๋“œ ์ˆ˜์ •ํ•  ๋•Œ ๋ฉ”์„œ๋“œ๋ฅผ ์ƒˆ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค๋ฉด, ์ƒˆ๋กœ ๋งŒ๋“ค๊ณ  Call ํ•ด์ฃผ์„ธ์š”
    • ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋Š” ๋ฉ”์„œ๋“œ๋ฅผ ๋Œ€์ƒ์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค
  • ๋‹จ์ผ ์ฑ…์ž„ ์›์น™์„ ์ง€์ผœ์ฃผ์„ธ์š”
    • ๋ฉ”์„œ๋“œ๋Š” ํ•˜๋‚˜์˜ ๊ธฐ๋Šฅ๋งŒ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค
  • ๋ฉ”์„œ๋“œ์˜ ์˜์กด์„ ๋‚ฎ์ถฐ์ฃผ์„ธ์š”
    • ์˜์กด์ด ์žˆ๋Š” ๋ถ€๋ถ„๊ณผ ์—†๋Š” ๋ถ€๋ถ„์œผ๋กœ ๋ฉ”์„œ๋“œ๋ฅผ ๋‚˜๋ˆ„๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.
  • Public, Protected ๋ฉ”์„œ๋“œ๋Š” ๋ฆฌํ„ด ํƒ€์ž…์„ ๋ช…์‹œํ•ด์ฃผ์„ธ์š”
    • ๊ฐ ์ ‘๊ทผ ์ง€์ •์ž์˜ ๋ชฉ์ ์— ๋งž๊ฒŒ ์‚ฌ์šฉํ•ด์ฃผ์„ธ์š”
    • Private๋„ ๋ฆฌํ„ด ํƒ€์ž…์„ ๋ช…์‹œํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค

 

 

# ๊ฒฐํ•จ ๋ฐœ์ƒ ์›์ธ

  • Communication : 10๋ช…์˜ ์‚ฌ๋žŒ์ด ์žˆ์œผ๋ฉด 45๊ฐœ์˜ Path๊ฐ€ ์ƒ๊น€
  • Short Term memory : ์‚ฌ๋žŒ์ด ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๋ฒ”์œ„(7digit) / ์—ฌ๋Ÿฌ ๊ฐ€์ง€ Interruption์ด ๋ฐœ์ƒ
  • Cognitive Dissonance : ์ž์‹ ์˜ ์‚ฐ์ถœ๋ฌผ์—์„œ ๊ฒฐํ•จ์„ ์ฐพ๊ธฐ๊ฐ€ ํž˜๋“ฆ
  • Complexity of work : ์„ค๊ณ„๋ฌธ์„œ์˜ ๋ณต์žก์„ฑ์œผ๋กœ Code ์ž‘์„ฑ์ด ์–ด๋ ค์šด ๊ฒฝ์šฐ ๋ฐœ์ƒ
  • ์•„๋ฌด๋ฆฌ ๋Šฅ์ˆ™ํ•œ ํ”„๋กœ๊ทธ๋ž˜๋จธ๋ผ๋„ ํ‰๊ท ์ ์œผ๋กœ 35 Defs/KLoc๊ฐ€ ๋ฐœ์ƒํ•จ...

 

# ์ •์  ํ…Œ์ŠคํŠธ ๋‹จ๊ณ„์—์„œ ์‹๋ณ„ ๊ฐ€๋Šฅํ•œ ๊ฒฐํ•จ

  • ์š”๊ตฌ์‚ฌํ•ญ ๊ฒฐํ•จ : ๋ถˆ์ผ์น˜, ๋ชจํ˜ธ์„ฑ, ๋ชจ์ˆœ, ๋ˆ„๋ฝ, ๋ถ€์ ํ™ฉ์„ฑ, ์ค‘๋ณต ๋“ฑ
  • ์ž˜๋ชป๋œ ์ธํ„ฐํŽ˜์ด์Šค ๋ช…์„ธ : ๋งค๊ฐœ๋ณ€์ˆ˜์˜ ๊ฐœ์ˆ˜, ์œ ํ˜•, ์ˆœ์„œ ๋ถˆ์ผ์น˜ ๋“ฑ
  • ์„ค๊ณ„ ๊ฒฐํ•จ : ๋น„ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๊ตฌ์กฐ, ๋ชจ๋“ˆํ™” ๋ถˆ๋Ÿ‰ ๋“ฑ
  • ํŠน์ •์œ ํ˜•์˜ ๋ณด์•ˆ ์ทจ์•ฝ์„ฑ : ๋ฒ„ํผ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋“ฑ
  • ํŠน์ • ์œ ํ˜•์˜ ์ฝ”๋”ฉ ๊ฒฐํ•จ : ์ •์˜๋˜์ง€ ์•Š๋Š” ๊ฐ’์„ ๊ฐ€์ง„ ๋ณ€์ˆ˜ ๋ฐ˜ํ™˜ ...๋“ฑ
  • ํ…Œ์ŠคํŠธ ๋ฒ ์ด์‹œ์Šค ์ปค๋ฒ„๋ฆฌ์ง€์˜ ์ฐจ์ด ๋˜๋Š” ๋ถ€์ •ํ™•์„ฑ : ์ธ์ˆ˜ ์กฐ๊ฑด ํ•˜๋‚˜์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ๋ˆ„๋ฝ ๋“ฑ
  • ํ‘œ์ค€ ์œ„๋ฐ˜์‚ฌํ•ญ : ์ฝ”๋”ฉ ํ‘œ์ค€ ๋ช…๋ช…๊ทœ์น™์„ ์ค€์ˆ˜ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ๋“ฑ 

 

# ์ •์  ๋ถ„์„(Static Analysis)

  • ์‹ค์ œ ์‹คํ–‰ ์—†์ด ์ปดํ“จํ„ฐ ์†Œํ”„ํŠธ์›จ์–ด, ํŠนํžˆ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ๋ถ„์„ํ•˜๋Š” ๊ฒƒ
    • ์‚ฌ์šฉ ๋ชฉ์ 
      • ์†Œ์Šค์ฝ”๋“œ์˜ ์ž ์žฌ์ ์ธ ํ’ˆ์งˆ ๋ฌธ์ œ(๋‚ฎ์€ ํ’ˆ์งˆ ๋ฐœ๊ฒฌ)
        • ๋„คํŠธ์›Œํฌ ์ง€์› ๋ˆ„์ˆ˜, ๋†’์€ ๋ณต์žก๋„, ์ถ”์ฒœํ•˜์ง€ ์•Š๋Š” ํŒจํ„ด๋“ฑ
        • ๋„คํŠธ์›Œํฌ ์ง€์› ๋ˆ„์ˆ˜  ex) ๋„คํŠธ์›Œํฌ ์†Œ์ผ“์˜ open()๋Š” ์žˆ์œผ๋‚˜, ๋ช…์‹œ์ ์ธ close()๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ...
      • ๊ฒฐํ•จ์˜ ์กฐ๊ธฐ ๋ฐœ๊ฒฌ : ๋ฉ”๋ชจ๋ฆฌ ๋ฆญ, ๋ฒ„ํผ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋“ฑ
      • ์†Œ์Šค์ฝ”๋“œ ํ‘œ์ค€ ์ค€์ˆ˜ ํ™•์ธ : ์ฝ”๋”ฉ ์ปจ๋ฒค์…˜(๋ช…๋ช… ๊ทœ์น™), ๋ณด์•ˆ
      • ์„ค๊ณ„ ์ƒ์˜ ๋‚ฎ์€ ํ’ˆ์งˆ, ํ‘œ์ค€ ์œ„๋ฐ˜ ํ™•์ธ 
    • ๋„๊ตฌ๋ฅผ ์ด์šฉํ•œ ์ •์  ๋ถ„์„
      • ๋ฃฐ ๊ธฐ๋ฐ˜ ์ •์ ๋ถ„์„(PMD, BugFind ๋“ฑ)
      • ์˜์กด์„ฑ ๋ถ„์„
      • ์ฝ”๋“œ ๋ฉ”ํŠธ๋ฆญ ์ธก์ •
      • ์‹œ๋งจํ‹ฑ ๋ถ„์„(์‹คํ–‰ ์˜ค๋ฅ˜ ๋ถ„์„) 
      • ์ •ํ˜• ๊ฒ€์ฆ

 

# ์†Œํ”„ํŠธ์›จ์–ด ์ฝ”๋”ฉ ํ‘œ์ค€(ํ‘œ์ค€ ์ฝ”๋”ฉ ๊ทœ์น™)

- ์ฝ”๋”ฉ ๊ทœ์น™(Coding Conventions)์€ ํŠน์ •ํ”„๋กœ๊ทธ๋žจ ์–ธ์–ด์— ๋Œ€ํ•œ ๊ฐ€์ด๋“œ๋ผ์ธ ๋ชจ์Œ(ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์Šคํƒ€์ผ๊ณผ ๊ด€ํ–‰์„ ๊ถŒ๊ณ ) => Coding Standard

 

 

# PMD Rule Set

 

- ์—ฌ๋Ÿฌ ์–ธ์–ด๋ฅผ ์ง€์›ํ•˜๋Š” ์˜คํ”ˆ์†Œ์Šค ์ •์ ์ฝ”๋“œ ๋ถ„์„ ๋„๊ตฌ(๋ฃฐ ์…‹ ๊ฐœ์ˆ˜ ์ด 512๊ฐœ)

- ์ง€์› ์–ธ์–ด : Java, JavaScript, Python, C++, HTML, PLSQL, Apex, Swift, Kotlin, Scala, PHP ๋“ฑ..

https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html 

 

javadoc

One use page for each package (package-use.html) and a separate use page for each class and interface (class-use/classname.html). The use page describes what packages, classes, methods, constructors and fields use any part of the specified class, interface

docs.oracle.com

 

 

# Eclipse์— pmd ์„ค์น˜

[help] -> [marketplace]์—์„œ pmd๋กœ๊ณ  ์žˆ๋Š”๊ฑธ๋กœ ์„ค์น˜ํ•˜๊ธฐ!

 

pmd ๊ฒ€์‚ฌ

 

pmd ๊ฒ€์‚ฌ ํ™•์ธ๊ธฐ๋ก ๋‚จ๊ธฐ๊ธฐ

 

 

pmd ์ˆ˜์ • ์ฝ”๋“œ ์ถ”์ฒœ(์ถ”์ฒœ ์ฝ”๋“œ๋ฅผ ๊ตณ์ด ์“ธ ํ•„์š” x

 

 

# ์ œํ’ˆ ํ’ˆ์งˆ ๋ฉ”ํŠธ๋ฆญ

  • ๊ทœ๋ชจ ๊ด€๋ จ
    • ๋ผ์ธ ์ˆ˜(LOC : Line of Code)
    • ์ฃผ์„ ์ œ์™ธ ๋ผ์ธ ์ˆ˜(NLOC : Non-Comment Lines of Code)
    • ์ฃผ์„ ๋น„์œจ : 20% ์ด์ƒ
    • ํ•จ์ˆ˜/ํŒŒ์ผ/ํŒจํ‚ค์ง€ ๋ณ„ ๋ผ์ธ์ˆ˜ (๋ฏธ๊ตญ๋ฐฉ๋ถ€ : 80 / NASA : 60 / ํญ์Šค๋ฐ”๊ฒ : 50)
  • ๋ณต์žก๋„ ๊ด€๋ จ
    • ์ˆœํ™˜ ๋ณต์žก๋„(Cyclomatic Complexity) : ํ•จ์ˆ˜์˜ ์ œ์–ด ํ๋ฆ„์ด ์–ผ๋งˆ๋‚˜ ๋ณต์žกํ•œ์ง€ ์ธก์ •. ๋ถ„๊ธฐ๋ฌธ + 1
    • ์ธ์ง€ ๋ณต์žก๋„(Cognitive Complexity) : ํ•จ์ˆ˜๊ฐ€ ์–ผ๋งˆ๋‚˜ ์ค‘์ฒฉ๋ฌธ์ด ๋งŽ์€์ง€ ์ธก์ •, Nesting Depth๋ผ๊ณ ๋„ ํ‘œํ˜„

 


 

# ๋™๋ฃŒ๊ฒ€ํ† 

 

  • ๋™๋ฃŒ์—๊ฒŒ ์›์‹œ ์ฝ”๋“œ๋‚˜ ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ์‚ฐ์ถœ๋ฌผ์— ๋Œ€ํ•œ ๊ฒ€ํ† ๋ฅผ ์˜๋ขฐํ•˜์—ฌ ์˜ค๋ฅ˜๋ฅผ ์ฐพ๋Š” ๋ฐฉ๋ฒ•
    • ์ •ํ•ด์ง„ ํ˜•์‹๋„ ์—†๊ณ  ๋ณ„๋„์˜ ๊ฒฉ์‹์„ ์ฐจ๋ฆฐ ํšŒ์˜๋ฅผ ์ˆ˜ํ–‰ํ•  ํ•„์š”๊ฐ€ ์—†์–ด ๋น„๊ณต์‹ ๊ฒ€ํ† ์— ์†ํ•จ
    • ๋™์  ํ…Œ์ŠคํŠธ์—์„œ ๋ฐœ๊ฒฌํ•˜๊ธฐ ์–ด๋ ค์šด ์‚ฐ์ถœ๋ฌผ์—์„œ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ๋ˆ„๋ฝ๊ณผ ๊ฐ™์€ ๊ฒฐํ•จ์„ ์กฐ๊ธฐ์— ๋ฐœ๊ฒฌํ•  ์ˆ˜ ์žˆ๋Š” ์ด์ 
    • CMMI์—์„œ๋Š” ๊ฒฐํ•จ์„ ๋ฐœ๊ฒฌํ•˜๊ธฐ ์œ„ํ•ด ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋™๋ฃŒ๊ฐ€ ๊ฒ€ํ†ตํ•˜๋Š” ํ™œ๋™์ด๋ผ๊ณ  ์ •์˜ํ•จ.. 
  • ์ฒดํฌ๋ฆฌ์ŠคํŠธ๋ฅผ ํ†ตํ•ด ๊ฒ€ํ† ๋ฅผ ์ง„ํ–‰ํ•ด์•ผ ํ•จ
    • ์‚ฌ์ „ ์ค€๋น„ : ๊ณต์ง€, ๊ฒ€ํ† ์ž ์ง€์ •, ๋ฐฐํฌ, ์ค€๋น„
    • ๊ฒ€ํ†  ํšŒ์˜ : ๋ฌธ์ œ์ ํ•ด๊ฒฐ, ๋ณด๊ณ ์„œ ์ž‘์„ฑ
    • ํ›„์† ์กฐ์น˜ : ์‹œ์ •์กฐ์น˜, ์กฐ์น˜ ๋ณด๊ณ   

 

#  ํšจ์œจ์ ์ธ ์ฒดํฌ๋ฆฌ์ŠคํŠธ๋ฅผ ์ž‘์„ฑ ๋ฐฉ๋ฒ•

  • ์ฒดํฌ๋ฆฌ์ŠคํŠธ๋Š” ๊ฒฐํ•จ ๋ถ„์„์— ๊ธฐ์ดˆํ•ด์„œ ์ •๊ธฐ์ ์œผ๋กœ ๊ฐฑ์‹ ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค
  • ์ฒดํฌ๋ฆฌ์ŠคํŠธ๋Š” ํ•œ ํŽ˜์ด์ง€๋ณด๋‹ค ๊ธธ์ง€ ์•Š์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค
  • ์ฒดํฌ๋ฆฌ์ŠคํŠธ ์•„์ดํ…œ์€ ๋ช…๋ น๋ฌธ์œผ๋กœ ์žฌ ํ‘œํ˜„๋  ์ˆ˜ ์žˆ๋Š” ์งˆ๋ฌธ์˜ ํ˜•ํƒœ๋กœ ํ‘œํ˜„ํ•ฉ๋‹ˆ๋‹ค 
    • ๋ฉ”์†Œ๋“œ ๋ฆฌํ„ด ๊ฐ’์€ ์ ์ ˆํ•˜๊ฒŒ ๋ช…์‹œํ•˜์˜€๋Š”๊ฐ€?
  • ์ฒดํฌ๋ฆฌ์ŠคํŠธ ์•„์ดํ…œ์€ ๋„ˆ๋ฌด ์ผ๋ฐ˜์ ์ด์ง€ ์•Š์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค
    • ์™„์ „ํ•˜๊ณ  ์ผ๊ด€์„ฑ ์žˆ๊ณ  ๋ช…๋ฐฑํ•œ๊ฐ€? (๋ชจํ˜ธํ•˜๊ฒŒ ์ž‘์„ฑํ•˜์ง€ ์•Š์•„์•ผ ํ•จ)

 

# ์†Œ์Šค์ฝฌ๋“œ ๋™๋ฃŒ๊ฒ€ํ†  ์ฃผ์˜ ์‚ฌํ•ญ

  • Review fewer than 200 ~ 400 lines of code at a time 
    • ํ•œ๋ฒˆ์— 200 ~ 400 ๋ผ์ธ ์ด๋‚ด์˜ ๋‹จ์œ„๋กœ ๊ฒ€ํ† 
  • Aim for an inspection rate of less than 300 ~ 500 LOC/hour
    • 1์‹œ๊ฐ„์— 300 ~ 500 ๋ผ์ธ ๋ณด๋‹ค ์ ๊ฒŒ ๋ณธ๋‹ค๋Š” ๋Š๋‚Œ์œผ๋กœ ๊ฒ€ํ†  / ๋„ˆ๋ฌด ๋นจ๋ฆฌ ๊ฒ€ํ† ํ•˜๋Š” ๊ฒƒ์€ ์•ˆ ์ข‹์Œ
  • Authors should annotate source code before the review begins
    • ๊ฒ€ํ† ๋ฅผ ์š”์ฒญํ•˜๋Š” ๊ฐœ๋ฐœ์ž๋Š” ๋‹ค๋ฅธ ์‚ฌ๋žŒ์—๊ฒŒ ์–ด๋–ค ๋‚ด์šฉ์ธ์ง€ ์„ค๋ช…์„ ํ•ด์ฃผ๋Š” ๊ฒƒ์ด ์ข‹์Œ
  • Establish quantifiable goals for code review and capture metrics so you can imporve tour processes
    • ๋ชฉ์ ์˜์‹์„ ๊ฐ–๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์—๋Ÿฌ์œจ์„ ํ˜„์žฌ๋ณด๋‹ค 50% ์ค„์ด๊ฒ ๋‹ค๋Š” ๋“ฑ์˜ ๋ช…ํ™•ํ•œ ์ˆ˜์น˜๋ฅผ ์„ค์ •ํ•˜๋ฉด ์ด๋ฅผ ์œ„ํ•ด ๋…ธ๋ ฅํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
  • Managers must foster a good code review culture in which finding defects is viewed positively
    • ๊ด€๋ฆฌ์ž๋“ค์€ ๊ฒ€ํ† ํ™œ๋™์ด ์ž˜ ๋˜๊ณ  ์žˆ๋Š”์ง€ ๊ด€์ฐฐํ•˜๊ณ , ์ด๋ฅผ ์žฅ๋ คํ•˜๋Š” ์กฐ์ง๋ฌธํ™”๋ฅผ ๋งŒ๋“ค์–ด ์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค
  • ๋™๋ฃŒ ๊ฒ€ํ† ๋ฅผ ํ•˜์ง€ ์•Š๋Š”๋‹ค๊ณ  ํ•˜๋”๋ผ๋„ ๋‚จ์ด ๋ณธ๋‹ค๊ณ  ์ƒ๊ฐํ•˜๊ณ  ์ž‘์„ฑํ•˜๊ธฐ!
  • Beware the "Big Brother" effect
    • ๋™๋ฃŒ๊ฐ€ ์ž์‹ ์˜ ์ฝ”๋“œ์— ์˜ค๋ฅ˜๋ฅผ ๋งŽ์ด ๋ฐœ๊ฒฌํ•œ๋‹ค๊ณ  ํ•ด์„œ ๋„ˆ๋ฌด ๊ธฐ์ฃฝ์ง€ ๋งˆ์„ธ์š”. ํ’ˆ์งˆ์„์œ„ํ•œ ํ•˜๋‚˜์˜ ๊ณผ์ •์ด ๋ฟ์ด์ง€ ๋ˆ„๊ตฌ๋ฅผ ๋ชจ์š•ํ•˜๊ฑฐ๋‚˜ ๋น„ํ•˜ํ•˜๋Š” ์ž๋ฆฌ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค   

 

# ์ธ์Šคํ…์…˜์˜ ์ฃผ์š” ํŠน์ง•

  • ์ „๋ฌธ๊ฐ€๊ฒ€ํ† ์ด๋ฉฐ ๊ณต์‹์  ํ‰๊ฐ€
    • ์‹œ์ž‘๊ณผ ์ข…๋ฃŒ ์กฐ๊ฑด์„ ๊ฐ–๋Š” ์ฒดํฌ๋ฆฌ์ŠคํŠธ์™€ ๊ทœ์น™์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์ •์‹ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์กด์žฌ
    • ๊ฒ€ํ† ํ•  ์‚ฐ์ถœ๋ฌผ์˜ ์ž‘์„ฑ์ž๊ฐ€ ์•„๋‹Œ ํ›ˆ๋ จ๋œ ์ง„ํ–‰์ž์— ์˜ํ•œ ์ง„ํ–‰
    • ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌ์„ฑ ์š”์†Œ ํ˜น์€ ์‚ฐ์ถœ๋ฌผ๋“ค์˜ ์ •ํ™•์„ฑ ํ‰๊ฐ€
  • ๊ฒฐํ•จ ๋ฐœ๊ฒฌ์ด ์ฃผ์š” ๋ชฉ์ 
    • ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ๋ช…์„ธ๋ฅผ ๋งŒ์กฑํ•˜๋Š”์ง€ ๊ฒ€์ฆ
    • ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ๋ช…์‹œ๋œ ํ’ˆ์งˆ ์†์„ฑ์„ ๋งŒ์กฑํ•˜๋Š”์ง€ ๊ฒ€์ฆ
    • ์†Œํ”„ํŠธ์›จ์–ด๊ฐ€ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ทœ๊ฒฉ, ํ‘œ์ค€, ๊ฐ€์ด๋“œ๋ผ์ธ, ๊ณ„ํš ๋ฐ ํ”„๋กœ์‹œ์ €์™€ ์ผ์น˜ํ•˜๋Š”์ง€ ๊ฒ€์ฆ
    • ํ‘œ์ค€์ด๋‚˜ ๊ทœ๊ฒฉ๊ณผ ์ƒ์ดํ•œ ๋ถ€๋ถ„ ์‹๋ณ„

 

# ํšŒ๊ท€ ํ…Œ์ŠคํŠธ(Regression Test)

  • ์ •์ƒ ๋™์ž‘ํ•˜๋˜ ๊ธฐ๋Šฅ์ด SW ์ˆ˜์ • ํ›„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ํšŒ๊ท€ ๊ฒฐํ•จ์˜ ์œ ๋ฌด๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์ด์ „ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ๋‹ค์‹œ ์‹คํ–‰ํ•˜๋ฉฐ ํ™•์ธํ•˜๋Š” ํ…Œ์ŠคํŠธ 
    • SW ์ˆ˜์ •์œผ๋กœ ์ธํ•œ ๋ถ€์ •์ ์ธ ์˜ํ–ฅ ์œ ๋ฌด๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•œ ํ…Œ์ŠคํŠธ
  • ํšŒ๊ท€ ๊ฒฐํ•จ์„ ๋ฐœ์ƒ์‹œํ‚ค๋Š” SW ์ˆ˜์ •์˜ ์ข…๋ฅ˜
    • ์ƒˆ๋กœ์šด ๊ฒฐํ•จ์˜ ์กฐ์น˜
    • ๋ฆฌํŒฉํ† ๋ง
    • ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์˜ ์ถ”๊ฐ€/๋ณ€๊ฒฝ
  • ์›น์€ ํ•„์ˆ˜๋Š” ์•„๋‹ˆ์ง€๋งŒ ๊ฒฐํ•จ์˜ ํ™•์ธ์ด ์ค‘์š”ํ•œ ์ž„๋ฒ ๋””๋“œ(์ฐจ๋Ÿ‰)์˜ ๊ฒฝ์šฐ๋Š” ํ•„์ˆ˜์ ์ž„.. 

 

# SW ๋™์  ํ…Œ์ŠคํŒ…์˜ 4๋‹จ๊ณ„

  1. ๋‹จ์œ„(Unit) ํ…Œ์ŠคํŒ…
  2. ํ†ตํ•ฉ(Integration) ํ…Œ์ŠคํŒ…
  3. ์‹œ์Šคํ…œ(System) ํ…Œ์ŠคํŒ…
  4. ์ธ์ˆ˜(Acceptance) ํ…Œ์ŠคํŒ…

 

# ๋‹จ์œ„ ํ…Œ์ŠคํŒ…(Unit Testiong) / ์ปดํฌ๋„ŒํŠธ ํ…Œ์ŠคํŒ…(Component Testing)

  • ์„ค๊ณ„๋œ ๋ชจ๋“ˆ์ด ์ •ํ™•ํžˆ ๊ตฌํ˜„๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜๊ณ , ๋ชจ๋“ˆ๊ณผ ๊ฐ™์€ ํ•˜๋‚˜์˜ ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌ์„ฑ์š”์†Œ๋‚˜ ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌ์„ฑ์š”์†Œ์˜ ์ง‘ํ•ฉ์ด ํ”„๋กœ๊ทธ๋žจ์˜ ์š”๊ตฌ์‚ฌํ•ญ์— ๋งž๋Š”์ง€ ํ™•์ธํ•˜๋Š” ํ…Œ์ŠคํŒ…
  • ๋ชฉ์  : ๋ชจ๋“ˆ์ด ์˜ฌ๋ฐ”๋กœ ์ฝ”๋”ฉ ๋˜์—ˆ๋Š”์ง€ ํ™•์ธ
  • ์ˆ˜ํ–‰์ฃผ์ฒด : ๊ฐœ๋ฐœ์ž
  • ํ…Œ์ŠคํŠธ ๋Œ€์ƒ : ๋ชจ๋“ˆ ์ˆ˜ํ–‰๊ฐ€๋Šฅ(๋ธ”๋ž™๋ฐ•์Šค), ์ฝ”๋“œ ๋‚ด๋ถ€ํ‘œํ˜„(ํ™”์ดํŠธ๋ฐ•์Šค), ๊ฒฝ๊ณ„์กฐ๊ฑด
  • ์™„๋ฃŒ์‹œ์  : ๊ฐœ๋ฐœ์ž๊ฐ€ ๋” ์ด์ƒ์˜ ์˜ค๋ฅ˜๊ฐ€ ์—†๋‹ค๊ณ  ํŒ๋‹จ๋  ๋•Œ

 

# ๋‹จ์œ„ ํ…Œ์ŠคํŠธ ๊ฒฐํ•จ ์›์ธ ํ•œ์ •

- ๋‹จ์œ„ ํ…Œ์ŠคํŠธ์—์„œ ๊ฒฐํ•จ์ด ๋ฐœ์ƒํ•œ๋‹ค๋ฉด, ๊ทธ ์›์ธ์€ ํ…Œ์ŠคํŠธ ๋Œ€์ƒ ๋ชจ๋“ˆ์— ํ•œ์ •ํ•ด์•ผ ํ•จ

# ํ†ตํ•ฉ ํ…Œ์ŠคํŒ…(Integration Testing)

- ์‹œ์Šคํ…œ์˜ ์„ค๊ณ„์™€ ์š”๊ตฌ์‚ฌํ•ญ์— ๋ถ€ํ•ฉํ•˜๋Š”์ง€ ๋ณด์ด๊ธฐ ์œ„ํ•ด ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌ์„ฑ์š”์†Œ, ํ•˜๋“œ์›จ์–ด ๊ตฌ์„ฑ์š”์†Œ ๋“ฑ์ด ์ ์ฐจ ํ†ตํ•ฉ๋˜์–ด ์ „์ฒด ์‹œ์Šคํ…œ์œผ๋กœ ํ†ตํ•ฉ๋  ๋•Œ๊นŒ์ง€ ์ด๋ฃจ์–ด์ง€๋Š” ์ ˆ์ฐจ์ ์ธ ํ…Œ์ŠคํŒ…

 

# ์†Œํ”„ํŠธ์›จ์–ด ํ†ตํ•ฉ ์ „๋žต๊ณผ ์—ฐ๊ณ„

  • SW ํ†ตํ•ฉ ์ „๋žต
    • ๋น…๋ฑ…(Big Bang) ๊ธฐ๋ฒ•
      • ๋ชจ๋“ˆ์„ ํ•œ๊บผ๋ฒˆ์— ํ†ตํ•ฉํ•˜์—ฌ ํ…Œ์ŠคํŒ…์„ ํ•˜๋Š” ๋ฐฉ๋ฒ•
      • ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์˜€์„ ๊ฒฝ์šฐ ์–ด๋Š ๋ถ€๋ถ„์—์„œ ์˜ค๋ฅ˜๊ฐ€ ๋‚ฌ๋Š”์ง€ ์ฐพ๊ธฐ๊ฐ€ ํž˜๋“ฆ 
    • ํ•˜ํ–ฅ์‹(Top-Down) ๊ธฐ๋ฒ•
      • ๊ฐ€์žฅ ์ƒ์œ„ ๋ชจ๋“ˆ๋ถ€ํ„ฐ ํ•˜์œ„ ๋ชจ๋“ˆ๋กœ ์ ์ง„์ ์œผ๋กœ ํ†ตํ•ฉํ•˜๋Š” ๋ฐฉ๋ฒ•
      • ์ƒ์œ„ ๋ชจ๋“ˆ ํ…Œ์ŠคํŒ… ์‹œ, ํ•˜์œ„ ๋ชจ๋“ˆ์— ๋Œ€ํ•œ ์Šคํ…œ์ด ํ•„์š”
    • ์ƒํ–ฅ์‹(Bottom-Up) ๊ธฐ๋ฒ•
      • ํ•˜์œ„ ๋ชจ๋“ˆ๋ถ€ํ„ฐ ํ…Œ์ŠคํŒ…ํ•˜๊ณ  ์ƒ์œ„ ๋ชจ๋“ˆ๋กœ ์ ์ง„์ ์œผ๋กœ ํ†ตํ•ฉํ•˜๋Š” ๋ฐฉ๋ฒ•
      • ํ•˜์œ„ ๋ชจ๋“ˆ ํ…Œ์ŠคํŒ…
    • ์ง€์†์  ํ†ตํ•ฉ ๋ฐฉ๋ฒ•(Continuous Integration)
      • SW ํ†ตํ•ฉ ์˜ค๋ฅ˜๋ฅผ ๊ฐœ๋ฐœ์ดˆ๊ธฐ๋ถ€ํ„ฐ ์˜ˆ๋ฐฉํ•˜๋Š” ๊ฒƒ 

 

# ์‹œ์Šคํ…œ ํ…Œ์ŠคํŒ…(System Testing)

  • ๋ชจ๋“ˆ์ด ๋ชจ๋‘ ํ†ตํ•ฉ๋œ ํ›„, ์‚ฌ์šฉ์ž์˜ ์š”๊ตฌ์‚ฌํ•ญ์ด ๋งŒ์กฑ๋˜์—ˆ๋Š”์ง€ ๊ฒ€์‚ฌํ•˜๋Š” ํ…Œ์ŠคํŒ…
  • ๊ณ ๊ฐ์—๊ฒŒ ์‹œ์Šคํ…œ์„ ์ „๋‹ฌํ•˜๊ธฐ ์ „, ์‹œ์Šคํ…œ์„ ๊ฐœ๋ฐœํ•œ ์กฐ์ง์ด ์ฃผ์ฒด๊ฐ€ ๋˜๋Š” ๋งˆ์ง€๋ง‰ ํ…Œ์ŠคํŒ…
  • ํ…Œ์ŠคํŒ… ๋Œ€์ƒ
    • ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ๋ฅผ ๊ธฐ์ดˆ๋กœ ํ•˜์—ฌ ์‚ฌ์šฉ์ž์˜ ๊ธฐ๋Šฅ ์š”๊ตฌ์‚ฌํ•ญ
    • ๋ณด์•ˆ, ์„ฑ๋Šฅ, ์‹ ๋ขฐ์„ฑ, UX ๋“ฑ์˜ ๋น„ ๊ธฐ๋Šฅ ์š”๊ตฌ์‚ฌํ•ญ
    • ๊ธฐ๋Šฅ ์•ˆ์ „ ์š”๊ตฌ์‚ฌํ•ญ

# ์ธ์ˆ˜ ํ…Œ์ŠคํŒ…(Acceptance Testing)

  • ์‹œ์Šคํ…œ์ด ์‚ฌ์šฉ์ž์—๊ฒŒ ์ธ์ˆ˜๋˜๊ธฐ ์ „, ์‚ฌ์šฉ์ž์— ์˜ํ•ด ์‹ค์‹œ๋˜๋Š” ํ…Œ์ŠคํŒ…
  • ์‹ค์ œ ์‚ฌ์šฉ์ž๊ฐ€ ์šด์˜ํ•˜๋Š” ํ™˜๊ฒฝ์—์„œ ์‹ค์‹œ
  • ์ธ์ˆ˜ ํ…Œ์ŠคํŒ…์„ ํ†ต๊ณผํ•ด์•ผ๋งŒ ์‹œ์Šคํ…œ์ด ์ •์ƒ์ ์œผ๋กœ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ธ์ˆ˜๋˜๊ณ  ํ”„๋กœ์ ํŠธ๋Š” ์ข…๋ฃŒ๋จ

 

# ๋™์  SW ํ…Œ์ŠคํŠธ ์„ค๊ณ„ ๊ธฐ๋ฒ•์˜ ์ข…๋ฅ˜ (+ ๊ฒฝํ—˜ ๊ธฐ๋ฐ˜ Test)

  • ๋ช…์„ธ ๊ธฐ๋ฐ˜ ํ…Œ์ŠคํŠธ(Black-Box)
    • ์†Œ์Šค ์ฝ”๋“œ ์ž์ฒด์˜ ๋กœ์ง(Logic)์€ ์ œ์™ธํ•˜๊ณ , ์ถœ๋ ฅ ๊ฐ’์—๋งŒ ์ดˆ์ ์„ ๋‘๊ณ  ํ…Œ์ŠคํŒ… ํ•˜๋Š” ๋ฐฉ๋ฒ•
    • ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ(SRS)๋‚˜ ์„ค๊ณ„์„œ๋กœ๋ถ€ํ„ฐ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ถ”์ถœ
      • ๋ธ”๋ž™๋ฐ•์Šค ํ…Œ์ŠคํŠธ
      • ๋ชจ๋“ˆ์˜ ์™ธ๋ถ€(์ž…๋ ฅ, ์ถœ๋ ฅ)
  • ๊ตฌ์กฐ ๊ธฐ๋ฐ˜ ํ…Œ์ŠคํŠธ(White-Box)
    • ์†Œ์Šค ์ฝ”๋“œ ๋‚ด์˜ ๋ชจ๋“  ๋…๋ฆฝ์ ์ธ ๊ฒฝ๋กœ๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ ๋ด„์œผ๋กœ์จ ์ž ์žฌ์ ์ธ ์˜ค๋ฅ˜๋ฅผ ์ฐพ์•„๋‚ด๋Š” ๋ฐฉ๋ฒ•
    • ๋‚ด๋ถ€๊ตฌ์กฐ(์†Œ์Šค ์ฝ”๋“œ, ์•Œ๊ณ ๋ฆฌ์ฆ˜)๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ถ”์ถœ -> ์ฃผ๋กœ ๋‹จ์œ„ํ…Œ์ŠคํŠธ์—์„œ ์“ฐ์ž„
      • ํ™”์ดํŠธ ๋ฐ•์Šค ํ…Œ์ŠคํŠธ
      • ๋ชจ๋“ˆ์˜ ๋‚ด๋ถ€(๋กœ์ง)

 

#  ๋ธ”๋ž™๋ฐ•์Šค(Black Box) ํ…Œ์ŠคํŒ… ๊ฐœ์š”

- ์†Œ์Šค ์ฝ”๋“œ ์ž์ฒด์˜ ๋กœ์ง์€ ์ œ์™ธํ•˜๊ณ , ์ถœ๋ ฅ ๊ฐ’์—๋งŒ ์ดˆ์ ์„ ๋‘๊ณ  ํ…Œ์ŠคํŒ… ํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ๋‚˜ ์„ค๊ณ„์„œ๋กœ๋ถ€ํ„ฐ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ถ”์ถœ

  • ํ…Œ์ŠคํŒ… ์ข…๋ฅ˜
    • ๊ตฌ๋ฌธ ํ…Œ์ŠคํŒ…(Syntax Testing) : ์ž…๋ ฅ ๊ฐ’์„ ์ ํ•ฉ๊ณผ ๋ถ€์ ํ•ฉ ์กฐ๊ฑด์œผ๋กœ ๋ถ„๋ฅ˜ํ•œ ๋’ค, ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ž‘์„ฑํ•˜์—ฌ ์˜ˆ์ƒ๋˜๋Š” ๊ฒฐ๊ณผ๋ฅผ ํ…Œ์ŠคํŒ…
    • ํŽ˜์–ด์™€์ด์ฆˆ(Pairwise) : ํ…Œ์ŠคํŠธ๋ฅผ ํ•˜๋Š”๋ฐ ํ•„์š”ํ•œ ๊ฐ ์ž…๋ ฅ ๊ฐ’๋“ค์ด ๋‹ค๋ฅธ ์ž…๋ ฅ๊ฐ’๊ณผ ์ตœ์†Œํ•œ ํ•œ๋ฒˆ์”ฉ ์กฐํ•ฉ์„ ์ด๋ฃจ๊ฒŒ ํ•˜์—ฌ ํ…Œ์ŠคํŠธ ํ•˜๋Š” ๋ฐฉ๋ฒ• / ํŽ˜์–ด : ์ž…๋ ฅ๊ฐ’์˜ ๊ฐ ์Œ์˜ ๊ฐœ๋ณ„ ์กฐํ•ฉ
    • ๋™๋“ฑ ๋ถ„ํ• (Equivalence Partitioning) : ์ž…๋ ฅ ๊ฐ’์˜ ๋ฒ”์œ„๊ฐ€ ์ •ํ•ด์ ธ ์žˆ์„ ๊ฒฝ์šฐ, ๊ฐ ๋ฒ”์œ„์˜ ๋Œ€ํ‘ฏ๊ฐ’์œผ๋กœ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ž‘์„ฑํ•˜์—ฌ ์˜ˆ์ƒ๋˜๋Š” ๊ฒฐ๊ณผ๋ฅผ ํ…Œ์ŠคํŒ…
    • ๊ฒฝ๊ณ„ ๊ฐ’ ๋ถ„์„(Boundary Value Analysis) : ์ž…๋ ฅ ๊ฐ’์˜ ์ฃผ์š” ์˜ค๋ฅ˜ ๋Œ€์ƒ์ธ ๊ฒฝ๊ณ„ ๊ฐ’์„ ์ž…๋ ฅ ๊ฐ’์œผ๋กœ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ž‘์„ฑํ•˜์—ฌ ์˜ˆ์ƒ๋˜๋Š” ๊ฒฐ๊ณผ๋ฅผ ํ…Œ์ŠคํŒ… 
    • ์˜์‚ฌ๊ฒฐ์ • ํ…Œ์ด๋ธ”(Devision Table) : ์ž…/์ถœ๋ ฅ๊ฐ’์ด True, False๋กœ ๊ฒฐ์ •๋  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ, ์ž…/์ถœ๋ ฅ๊ฐ’์˜ ๋ชจ๋“  ๋…ผ๋ฆฌ์  ๊ฒฝ์šฐ์˜ ์ˆ˜๋ฅผ ํ™•์ธํ•ด๋ณผ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•

 

# ํŽ˜์–ด์™€์ด์ฆˆ ๋„๊ตฌ ์‹ค์Šต

 

https://github.com/microsoft/pict/releases/tag/v3.7.4

 

Release Version 3.7.4 · microsoft/pict

What's Changed Adding building using CMake by @bhardwajs in #81 Enable -pedantic on *nix by @bhardwajs in #82 Enable warnings as error and W4 on MSVC by @bhardwajs in #83 Enable warnings as error ...

github.com

 

- ํŽ˜์–ด์™€์ด์ฆˆ๋Š” cmd ์ฐฝ์—์„œ ์‹คํ–‰!!(๋ฐ์ดํ„ฐ๊ฐ€ ๋ฝ‘์•„์ ธ ๋‚˜์˜จ๋‹ค)

- ์ผ๋‹จ ์ผ€์ด์Šค์˜ ๊ฒฝ์šฐ๋ฅผ txt ํŒŒ์ผ์— ์ ์–ด์คŒ

 

? ๋‚˜์˜ค๋Š”๊ฑฐ๋Š” ์ธ์ฝ”๋”ฉ UTF-8 -> ANSI๋กœ ๋ฐ”๊พธ๋ฉด ํ•ด๊ฒฐ๋œ๋‹ค!!

 

 

pict ํŒŒ์ผ๋ช… > ๋งŒ๋“ค๊ณ  ์‹ถ์€ ํŒŒ์ผ๋ช….xls  => ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์—‘์…€๋กœ ๊ฐ€์ ธ๊ฐ€์คŒ!!

 


 

 

# ํ™”์ดํŠธ๋ฐ•์Šค(White Box) ํ…Œ์ŠคํŒ… ๊ฐœ์š”

  •  ์†Œ์Šค ์ฝ”๋“œ ๋‚ด ๋ชจ๋“  ๋…๋ฆฝ์ ์ธ ๊ฒฝ๋กœ๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ ๋ด„์œผ๋กœ์จ ๊ฒฐํ•จ์„ ์ฐพ์•„๋‚ด๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ํ”„๋กœ๊ทธ๋žจ ์†Œ์Šค ์ฝ”๋“œ๋กœ๋ถ€ํ„ฐ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ถ”์ถœ

 

 

# ํ…Œ์ŠคํŠธ ์ปค๋ฒ„๋ฆฌ์ง€(Coverage)

  • ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ˆ˜ํ–‰ ์‹œ ํ…ŸํŠธ ๋Œ€์ƒ์„ ๋ช‡ %๋‚˜ ์‹คํ–‰ํ–ˆ๋Š”์ง€ ์•Œ๋ ค์ฃผ๋Š” ์ง€ํ‘œ
  • ์š”๊ตฌ์‚ฌํ•ญ์ปค๋ฒ„๋ฆฌ์ง€
    • ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๊ฐ€ ์š”๊ตฌ์‚ฌํ•ญ์„ ์–ผ๋งˆ๋งŒํผ ์‹คํ–‰ํ–ˆ๋Š”์ง€ ์ธก์ •
      • ex) ์ „์ฒด 30๊ฐœ ์š”๊ตฌ์‚ฌํ•ญ ์ค‘, 50% ์š”๊ตฌ์‚ฌํ•ญ์„ํ…Œ์ŠคํŠธ ์ˆ˜ํ–‰
    • ๋ธ”๋ž™๋ฐ•์Šค ํ…Œ์ŠคํŠธ ๊ธฐ๋ฒ•์— ์ฃผ๋กœ ์‚ฌ์šฉ
  • ์†Œ์Šค์ฝ”๋“œ ์ปค๋ฒ„๋ฆฌ์ง€
    • ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๊ฐ€ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ์–ผ๋งˆ๋งŒํผ ์‹คํ–‰ํ–ˆ๋Š”์ง€ ์ธก์ •
      • ์˜ˆ1) ๋ฌธ์žฅ ์ปค๋ฒ„๋ฆฌ์ง€ : ์†Œ์Šค์ฝ”๋“œ ์ „์ฒด ๋ฌธ์žฅ์˜ 40% ๋ฌธ์žฅ์„ ํ…Œ์ŠคํŠธ ์ˆ˜ํ–‰
      • ์˜ˆ2) ๊ฒฐ์ • ์ปค๋ฒ„๋ฆฌ์ง€ : ์†Œ์Šค์ฝ”๋“œ ์ „์ฒด if ๋ฌธ์˜ 60%์˜ ์ฐธ/๊ฑฐ์ง“(๊ฒฐ์ •)์„ ํ…Œ์ŠคํŠธ ์ˆ˜ํ–‰
    • ํ™”์ดํŠธ๋ฐ•์Šค ํ…Œ์ŠคํŠธ ๊ธฐ๋ฒ•์— ์ฃผ๋กœ ์‚ฌ์šฉ

 

#   ํ™”์ดํŠธ๋ฐ•์Šค ํ…Œ์ŠคํŒ… ์ข…๋ฅ˜

  • ๊ฒฝ๋กœ ์ปค๋ฒ„๋ฆฌ์ง€(Basis Path Coverage)
    • ํ”„๋กœ๊ทธ๋žจ ์ œ์–ด๊ตฌ์กฐ๋ฅผ Flow Graph๋กœ ํ‘œํ˜„ํ•˜๊ณ , ์ˆœํ™˜ ๋ณต์žก๋„(Cyclomatic Complexity)๋ฅผ ํ†ตํ•ด ๋…๋ฆฝ์ ์ธ ๊ฒฝ๋กœ์˜ ์ˆ˜๋ฅผ ์ฐพ์•„ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋กœ ์„ ์ •ํ•˜์—ฌ ์ˆ˜ํ–‰ํ•˜๋Š” ํ…Œ์ŠคํŒ…
    • ๊ฒฝ๋กœ ์ปค๋ฒ„๋ฆฌ์ง€ ์ˆ˜ํ–‰ ํ”„๋กœ์„ธ์Šค
      • 1. Flow Graph ์ž‘์„ฑ
      • 2, ์ˆœํ™˜ ๋ณต์žก๋„ ๊ณ„์‚ฐ
      • 3. ๋…๋ฆฝ ๊ฒฝ๋กœ ์ •์˜
      • 4. ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ž‘์„ฑ
    • ์ž…๋ ฅ์—์„œ ์ถœ๋ ฅ์— ์ด๋ฅด๊ธฐ๊นŒ์ง€์˜ ํ”„๋กœ๊ทธ๋žจ ๋‚ด๋ถ€๊ตฌ์กฐ๋ฅผ ํ”Œ๋กœ์šฐ ๊ทธ๋ž˜ํ”„๋กœ ํ‘œํ˜„
  • ํ•จ์ˆ˜ ์ปค๋ฒ„๋ฆฌ์ง€(Function Coverage)
    • ํ”„๋กœ๊ทธ๋žจ์„ ๊ตฌ์„ฑํ•˜๋Š” ํ•จ์ˆ˜๋“ค์˜ ํ…Œ์ŠคํŒ… ์ •๋„๋ฅผ ๋‚˜ํƒ€๋‚ด๋ฉฐ ๊ฐ€์žฅ ๋‚ฎ์€ ์ˆ˜์ค€์˜ ์ปค๋ฒ„๋ฆฌ์ง€์ด๋ฏ€๋กœ  ๋‹จ์œ„ ํ…Œ์ŠคํŒ…์„ ํ†ตํ•ด 100% ๋‹ฌ์„ฑ์ด ํ•„์š”ํ•จ
    • ์›น์—์„œ๋Š” ๊ฑฐ์˜ ์“ธ ์ผ์ด ์—†์Œ.. ํ•จ์ˆ˜๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š”๊ฑฐ์ง€ ๊ทธ ์•ˆ์˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ๋ณด์ง€๋Š” ์•Š๊ธฐ ๋•Œ๋ฌธ์—
    • ์ž„๋ฒ ๋””๋“œ์—์„œ ๋ชจ๋“  ๋ชจ๋“ˆ์„ ๋‹ค ํ˜ธ์ถœํ–ˆ๋Š”์ง€, ํ†ตํ•ฉํ–ˆ๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด์„œ ์‚ฌ์šฉํ•จ 
  • ๋ฌธ์žฅ ์ปค๋ฒ„๋ฆฌ์ง€(Line Coverage)
    • ํ”„๋กœ๊ทธ๋žจ์„ ๊ตฌ์„ฑํ•˜๋Š” ๋ฌธ์žฅ๋“ค์ด ์ตœ์†Œํ•œ ํ•œ๋ฒˆ์€ ์‹คํ–‰๋  ์ˆ˜ ์žˆ๋Š” ์ž…๋ ฅ ๊ฐ’์„ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋กœ ์„ ์ •ํ•˜์—ฌ ์ˆ˜ํ–‰ํ•˜๋Š” ํ…Œ์Šค 
    • ๋ฌธ์žฅ ์ปค๋ฒ„๋ฆฌ์ง€์˜ ๋‹จ์ 
      • ์†Œ์Šค์ฝ”๋“œ์˜ ๋กœ์ง(Logic)์— ์˜ํ–ฅ์„ ๋ฏธ์น˜๋Š” ์กฐ๊ฑด๋ฌธ์„ ํ…Œ์ŠคํŠธํ•˜์ง€ ๋ชปํ•จ
      • ์กฐ๊ฑด๋ฌธ ์ž์ฒด์˜ ๊ฒฐ์ •(Decision์ด True/False ์ธ ๊ฒฝ์šฐ -> ๊ฒฐ์ •(Decision) ์ปค๋ฒ„๋ฆฌ์ง€ ์ ์šฉ
      • ์กฐ๊ฑด๋ฌธ์˜ ๊ฐ ์กฐ๊ฑด(Condition)์ด True/False ์ธ ๊ฒฝ์šฐ -> ์กฐ๊ฑด(Condition) ์ปค๋ฒ„๋ฆฌ์ง€ ์ ์šฉ
  • ๋ถ„๊ธฐ ์ปค๋ฒ„๋ฆฌ์ง€(Branch Coverage)
    • ๋ถ„๊ธฐ๋ฌธ ์ „์ฒด๊ฐ€ ์ฐธ ํ•œ ๋ฒˆ, ๊ฑฐ์ง“ ํ•œ ๋ฒˆ์„ ๊ฐ–๋„๋ก ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์„ ์ •ํ•˜์—ฌ ์ˆ˜ํ–‰ํ•˜๋Š” ํ…Œ์ŠคํŒ… ๋ฐฉ๋ฒ•์œผ๋กœ ๊ฒฐ์ •(Decision) ์ปค๋ฒ„๋ฆฌ์ง€๋ผ๊ณ ๋„ ํ•จ 

 

# Junit ์†Œ๊ฐœ์™€ ๊ธฐ๋ณธ ํ…Œ์ŠคํŠธ ๊ตฌ์กฐ

 

  • ์—๋ฆญ ๊ฐ๋งˆ์™€ ์ผ„ํŠธ๋ฐฑ์ด ํƒ„์ƒ์‹œ์ผœ ํ˜„์žฌ ์ „ ์„ธ๊ณ„์ ์œผ๋กœ ๋„๋ฆฌ ์‚ฌ์šฉ๋˜๋Š” Java ๋‹จ์œ„ ํ…Œ์ŠคํŠธ ํ”„๋ ˆ์ž„์›Œํฌ
  • ๊ธฐ๋ณธ ํ…Œ์ŠคํŠธ๊ตฌ์กฐ : assertEquals() ์‚ฌ์šฉ ์˜ˆ์ œ
    • assertEquals(Expected, Actual) : Expected(Object)์™€ Actual(Object)์˜ ๊ฐ์ฒด ํƒ€์ž… ๋ฐ ๊ฐ’์ด ๋™์ผํ•œ์ง€ ํ™•์ธํ•˜์—ฌ ๊ฐ™์œผ๋ฉด ํ…Œ์ŠคํŠธ๊ฐ€ ์„ฑ๊ณตํ•จ

 

# ๋‹จ์œ„ํ…Œ์ŠคํŠธ(๋ฉ”์„œ๋“œ ๋‹จ์œ„) ์ˆ˜ํ–‰ ๋ฐฉ๋ฒ• ์š”์•ฝ

  • ํ…Œ์ŠคํŠธ ๋‹จ์œ„
    • public ๋ฉ”์„œ๋“œ, API ๋ฉ”์„œ๋“œ ๋“ฑ๋ฉ”์„œ๋“œ ๋‹จ์œ„
    • ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ตฌํ˜„ํ•œ ๋ฉ”์„œ๋“œ์—์„œ ์‹œ์ž‘
  •   ํ…Œ์ŠคํŠธ ๋ฐฉ๋ฒ•
    • JUnit์„ ํ™œ์šฉํ•œ ํ…Œ์ŠคํŠธ ๋ฉ”์„œ๋“œ๋ฅผ ์ž‘์„ฑํ•˜์—ฌ ํŠน์ • ๋ฉ”์„œ๋“œ์˜ ๊ธฐ๋Šฅ์ด ์ •์ƒ ๋™์ž‘ํ•จ์„ ํ™•์ธ
  • ํ…Œ์ŠคํŠธ ์ ˆ์ฐจ
    • ๊ธฐ๋Šฅ ๊ตฌํ˜„ -> ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์ƒ์„ฑ -< ๋‹จ์œ„ํ…Œ์ŠคํŠธ ์ˆ˜์ • -> ์ปค๋ฒ„๋ฆฌ์ง€ ์ธก์ • -> ๋ฆฌํฌํŠธ ์ถœ๋ ฅ
    • ๊ธฐ๋Šฅ ๊ตฌํ˜„๊ณผ ํ…Œ์ŠคํŠธ๋ฅผ ๋ณ‘ํ–‰ํ•˜๋ฉฐ ์ ์ง„์  ๊ฐœ๋ฐœ ์ˆ˜ํ–‰
    • ํ•„์š”์‹œ ์ปค๋ฒ„๋ฆฌ์ง€ ์ธก์ • ํ›„ ํ…Œ์ŠคํŠธ๊ฐ€ ๋ฏธํกํ•œ ์ฝ”๋“œ์— ๋Œ€ํ•ด์„œ๋Š” ํ…Œ์ŠคํŠธ ๋ณด์™„ ๊ฐ€๋Šฅ

 

# JUnit5 ์‹ค์Šต

 

JUnit์ด ์—†๋‹ค๋ฉด ์ถ”๊ฐ€๋จผ์ € ํ•ด์ฃผ๊ธฐ

 

์•Œ์•„์„œ ๋งŒ๋“ค์–ด์คŒ!

package com.calc;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

class CalculatorTest {
	
	Calculator calculator = new Calculator();

	@Test
	void testAdd() {
//		assertEquals(๊ธฐ๋Œ€๊ฒฐ๊ณผ, add());
		assertEquals(6, calculator.add(4, 2));
//		System.out.println(assertEquals(6, calculator.add(4, 2)));
	}
	
	@Test
	void testMinus() {
		assertEquals(2, calculator.minus(4, 2));
	}

	@Test
	void testMulti() {
		assertEquals(8, calculator.multi(4, 2));
	}

	@Test
	void testDivide() throws Exception {
		assertEquals(2, calculator.divide(4, 2));
		assertThrows(Exception.class, () -> 
			calculator.divide(4, 0), "Divide Error"
		);
	}
	
	@Test
    void testCalculate() throws Exception {
        assertEquals(6, calculator.calculate("+", 4, 2)); 
        assertEquals(2, calculator.calculate("-", 4, 2));
        assertEquals(8, calculator.calculate("*", 4, 2)); 
        assertEquals(2, calculator.calculate("/", 4, 2)); 
//        assertEquals(0.5, calculator.calculate("/", 2, 4)); 
    }
	
	// ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋Š” ๋…๋ฆฝ์ ์ธ ๊ธฐ๋Šฅ์„ ํ•˜๋„๋ก ๋ชจ๋“ˆ์„ ๊ฐœ๋ฐœํ•ด์•ผํ•˜๋Š”๋ฐ.. ํ•˜๋‚˜์˜ ๋ชฉ์ ์„ ๊ฐ€์ง€๋Š”๊ฒŒ ์ข‹์•„์„œ ์ •์ƒ์ ์œผ๋กœ ์ˆ˜ํ–‰๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๋ฅผ ๋นผ์ฃผ๋Š” ๊ฒƒ์„ ๋”์šฑ ์ถ”์ฒœ!
    @Test
    void testUnsupportedOperator() {
        assertThrows(Exception.class, () -> 
            calculator.calculate("%", 4, 2), "Unsupported Operator"
        );
    }
	
	/**
	@Test
	void testParseInput() {
		fail("Not yet implemented");
	}

	@Test
	void testMain() {
		fail("Not yet implemented");
	}
	**/
}

 

 

์ •์ƒ์ด๋ฉด ์ดˆ๋ก์œผ๋กœ ๋‚˜์˜ต๋‹ˆ๋‹น!!

 

์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ํŒŒ์ผ๋กœ ๋ฐ›์„์ˆ˜๋„ ์žˆ๋‹ค!

 

# ํ…Œ์ŠคํŠธ ์‹คํ–‰ ๊ฑธ์ฐจ

 

# ๊ฒฐํ•จ ๊ด€๋ฆฌ ๊ธฐ๋ฒ•

  • ๊ฒฐํ•จ ๊ฐ์†Œ(Reduction) : ์ฃผ์ž…๋œ ๊ฒฐํ•จ์„ ๊ฐ€๋Šฅํ•œ ๋งŽ์ด ๋ฐœ๊ฒฌํ•˜๊ณ  ์ œ๊ฑฐํ•จ
  • ๊ฒฐํ•ฉ ๋ด‰์‡„(Containment) : ๊ฒฐํ•จ์ด ๋ฐœ๊ฒฌ๋˜์ง€ ์•Š๊ณ  ๊ทธ ๊ฒฐํ•จ์œผ๋กœ ์ธํ•ด ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒจ๋„ ๊ทธ๊ฒƒ์ด ์‹คํŒจ๋กœ ์ด์–ด์ง€์ง€ ์•Š๊ฒŒ ํ•จ
  • ๊ฒฐํ•จ ์˜ˆ๋ฐฉ(Prevention) : ๊ฒฐํ•จ์„ ์˜ˆ์ธกํ•˜๊ณ  ๊ทธ ์›์ธ์„ ํŒŒ์•…ํ•˜์—ฌ ๋ฐฉ์ง€ ๋ฐ ํ•ด๊ฒฐํ•จ
  • ๊ฒฐํ•จ ์˜ˆ๋ฐฉ ํ™œ๋™์ด ์ œ๋Œ€๋กœ ์ด๋ฃจ์–ด ์ง„๋‹ค๋ฉด? => ๊ฒฐํ•จ ๊ฐ์†Œ์™€ ๋ด‰์‡„์— ๋“ค์ด๋Š” ๋…ธ๋ ฅ๊ณผ ๋น„์šฉ ๊ฐ์†Œ ๊ฐ€๋Šฅ

 

# ์†Œํ”„ํŠธ์›จ์–ด ๊ฒฐํ•จ์˜ ํŠน์ง•

  • ์†Œํ”„ํŠธ์›จ์–ด ๊ฐœ๋ฐœ์€ ์ธ๋ ฅ ์ ˆ์•ฝ์  ์ž‘์—…์œผ๋กœ ์†Œํ”„ํŠธ์›จ์–ด ๊ฒฐํ•จ์˜ ๋Œ€๋ถ€๋ถ„์€๊ฐœ๋ฐœ์ž์˜ ํœด๋จผ ์—๋Ÿฌ๋กœ ์ธํ•ด ๋ฐœ์ƒ
    • ๊ตฌํ˜„ ๋‹จ๊ณ„์˜ ๊ฒฐํ•จ๋„ ํœด๋จผ ์—๋Ÿฌ๋กœ ์ธํ•ด ๋ฐœ์ƒ
    • ํœด๋จผ ์—๋Ÿฌ ์˜ˆ๋ฐฉ์„ ํ†ตํ•ด ๊ตฌํ˜„ ๋‹จ๊ณ„ ๊ฒฐํ•จ์˜ ์ž”์กด์„ ๋ฐฉ์ง€ํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ
    • ๊ฒฐํ•จ ๊ด€๋ฆฌ ๋‹จ๊ณ„์—์„œ ์ถฉ๋ถ„ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ•ด์•ผ ํ•จ!!

 

# ๊ฒฐํ•จ ์˜ˆ๋ฐฉ์„ ์œ„ํ•œ ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘

  • ๊ฒฐํ•จ ์œ ํ˜• 
    • ๊ฒฐํ•จ ๋ฐœ๊ฒฌ์ž ์ž…์žฅ์—์„œ ๊ฒฐํ•จ์˜ ๋ชจ์Šต : ํ…Œ์ŠคํŠธ ๋‹จ๊ณ„๋งˆ๋‹ค ๊ฒฐํ•จ ์œ ํ˜•์ด ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ์Œ
  • ๊ฒฐํ•จ ์›์ธ 
    • ๊ฒฐํ•จ ์ œ๊ฑฐ์ž(๊ฐœ๋ฐœ์ž) ์ž…์žฅ์—์„œ ๊ฒฐํ•จ ์›์ธ : ํ…Œ์ŠคํŠธ ๋‹จ๊ณ„ ๊ฒฐํ•จ ์œ ํ˜•์ด ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ์Œ
  • ๊ฒฐํ•จ ์œ ์ž… ๋‹จ๊ณ„ 
    • ๊ฒฐํ•จ์ด ํฌํ•จ๋œ ๋‹จ๊ณ„
  • ๊ฒฐํ•จ ๋ฐœ๊ฒฌ ๋‹จ๊ณ„ 
    • ํ…Œ์ŠคํŠธ/๋ฆฌ๋ทฐ ๋‹จ๊ณ„
  • ๊ธฐํƒ€ 
    • OS, ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ, ํ…Œ์ŠคํŠธ ID

 

# ๊ฒฐํ•จ์˜ ์ถ”์ 

  • ๊ฐœ๋ฐœ์ž๋Š” ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ๊ฐœ๋ฐœ ํ›„ ํ…Œ์Šคํ„ฐ์—๊ฒŒ ์ „๋‹ฌ
  • ํ…Œ์Šคํ„ฐ๋Š” ํ…Œ์ŠคํŠธ ๊ณ„ํš, ๋ถ„์„ ๋ฐ ์„ค๊ณ„ ๋ฐฉ๋ฒ•์— ๋”ฐ๋ผ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์‹คํ–‰
  • ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค ์‹คํ–‰ ์ค‘ ๊ฒฐํ•จ์„ ๊ฒ€์ถœํ•˜๊ณ  ๊ฒ€์ถœ๋œ ๊ฒฐํ•จ์„ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ์ „๋‹ฌ ๋ฐ ์ˆ˜์ • ์š”์ฒญ
  • ๊ฐœ๋ฐœ์ž๋Š” ๊ฒฐํ•จ์„ ์ˆ˜์ •ํ•˜๊ณ  ๋‹ค์‹œ ํ…Œ์Šคํ„ฐ์—๊ฒŒ ์ „๋‹ฌ

 

# ๊ฒฐํ•จ ์ฒ˜๋ฆฌ ์œ ํ˜•

  • Fixed : ์š”์ฒญ๋œ ๊ฒฐํ•จ์„ ์ˆ˜์ • ์™„๋ฃŒํ•œ ๊ฒฝ์šฐ
  • Duplicated : ๊ธฐ์กด์˜ ๋‹ค๋ฅธ ๊ฒฐํ•จ๊ณผ ์ค‘๋ณต๋˜๋Š” ๊ฒฝ์šฐ
  • Won't fix : ์ˆ˜์ •์ด ํ•„์š”ํ•  ์ •๋„๋กœ ์ค‘์š”ํ•˜๊ฑฐ๋‚˜ ๊ธด๊ธ‰ํ•œ ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ์ˆ˜์ •ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ
  • Invalid : ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค์— ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ
728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

๋ฌธ์ œ ๐Ÿ˜ต‍๐Ÿ’ซ

https://school.programmers.co.kr/learn/courses/30/lessons/12909?language=java

 

ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค

SW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„

programmers.co.kr

 

๋‚ด ํ’€๐Ÿฆท

import java.util.*;

class Solution {
    boolean solution(String s) {
        Stack<String> str = new Stack<>();
        boolean answer = true;
        
        for(int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            
            if(c == '(') {
                str.push(String.valueOf(c));
            } else if(c ==')') {
                if(str.isEmpty()) {
                    answer = false;
                    break;
                }
                str.pop();
            }
        }
        
        if (!str.isEmpty()) {
            answer = false;
        }
        return answer;
    }
}

 

์ •๋ง์ •๋ง ์˜ค๋žœ๋งŒ์— ๊ด„ํ˜ธ ๊ฒ€์‚ฌ ๋ฌธ์ œ๋ฅผ ํ’€์—ˆ๋‹ค ใ…Žใ…Žใ…Ž

์ง„์งœ ๊ด„ํ˜ธ ๊ฒ€์‚ฌ ์ถ”์–ต์ด ๋งŽ์€ ๋ฌธ์ œ๋ผ ๋„ˆ๋ฌด ๊ธฐ์–ต๋‚˜๋Š”๋ฐ ํŒŒ์ด์ฌ ํ–ˆ๋˜์‹œ์ ˆ์ด๋ผ ์ž ์‹œ ํ ์นซํ–ˆ๋‹ค ใ…Žใ…Žใ…Žใ…Ž

๋‹น์—ฐํžˆ ์Šคํƒ ์จ์„œ ํ’€์–ด์•ผ ๊ฒ ๋‹ค ํ–ˆ๋Š”๋ฐ ๋‹ค๋ฅธ ์‚ฌ๋žŒ ํ’€์ด๊ฐ€ ์Šคํƒ๋„ ์“ฐ์ง€ ์•Š๊ณ  ์ •๋ง ๊ฐ„๋‹จํ•˜๊ฒŒ ์ผ๋˜ ํ’€์ด๊ฐ€ ์žˆ์–ด์„œ ํ•œ๋ฒˆ ๊ฐ€์ ธ์™€ ๋ดค๋‹ค...

 

// ๋‹ค๋ฅธ ์‚ฌ๋žŒ ํ’€์ด

class Solution {
    boolean solution(String s) {
        boolean answer = false;
        int count = 0;
        for(int i = 0; i<s.length();i++){
            if(s.charAt(i) == '('){
                count++;
            }
            if(s.charAt(i) == ')'){
                count--;
            }
            if(count < 0){
                break;
            }
        }
        if(count == 0){
            answer = true;
        }

        return answer;
    }
}

 

์ฐธ๊ณ ํ•˜๋ฉด ์ข‹์„ ๊ฐœ๋…๋“ค โœ๏ธ

์ŠคํŠธ๋ง์œผ๋กœ ๋ณ€ํ™˜ : String.valueOf(๋ฐ”๊ฟ€ ๊ฐ’);

728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

MariaDB ๋ณผ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” tool์ด ๋„ˆ๋ฌด ๋Š๋ ธ๋Š”๋ฐ์š”...

VS CODE์—์„œ ์—ฐ๋™ํ•ด์„œ ๋ณด๊ธฐ ์ข‹๊ฒŒ ๋ณผ ์ˆ˜ ์žˆ๋‹ค๋”๋ผ๊ตฌ์š”!!

์—„์ฒญ ์‰ฝ์Šต๋‹ˆ๋‹ค!!!!

 

 

- ์ผ๋‹จ Database Client๋ฅผ ๊น”์•„์ค๋‹ˆ๋‹ค!!

 

 

- ์™ผ์ชฝ๋ฐ”์—์„œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ชจ์–‘์„ ๋ˆ„๋ฅด๊ณ  + ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์„œ  Server Type์„ ์„ ํƒํ•˜๊ณ  host, username, ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ๋งˆ์ง€๋ง‰ Connect๋ฅผ ๋ˆ„๋ฅด๋ฉด ์™„๋ฃŒ!!!

 

 

- ์‹คํ–‰์€ ํ•ด๋‹น ์ค„ [ Ctrl ] + [ L ]๋กœ ์„ ํƒํ•ด์„œ [ Ctrl ] + [ Enter ] ์„ ํƒํ•˜๋ฉด ์‹คํ–‰๋˜๋ฉด์„œ ํ…Œ์ด๋ธ”์ด ์ƒ๊น๋‹ˆ๋‹ค!!

UI๋„ ๋ณด๊ธฐ ํŽธํ•˜๊ณ  ๋นจ๋ผ์„œ ์™„์ „ ์ถ”์ฒœ๋“œ๋ ค์š”!

728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

(์›”์š”์ผ)

 

# String ๊ฐ’ ๋ณ€ํ™˜์— ๋”ฐ๋ฅธ ์ฃผ์†Œ ๋ณ€ํ™˜

 

package thisisjava;

public class str03 {

	public static void main(String[] args) {
		String s1 = "KR";
		s1 = null;
		s1 = "EN";
		s1 = "CH";
		
	}
}

 

 

# String ๋ฉ”์„œ๋“œ

 

package thisisjava;

public class str04 {

	public static void main(String[] args) {
		String s1 = "Welcome to Korea";
		
		System.out.println(s1.length());
		System.out.println(s1.charAt(0));
		System.out.println(s1.charAt(5));
		System.out.println(s1.charAt(7) + ", ");
//		System.out.println(s1.charAt(-1)); -1์€ ํŒŒ์ด์ฌ์—์„œ๋งŒ!
		
		System.out.println(s1.replace("K", "C"));
		System.out.println(s1.replace("Korea", "ํ•œ๊ตญ"));
		System.out.println(s1.replace("e", "2"));
		
		System.out.println(s1.substring(0, 8));
		System.out.println(s1.substring(3, 14));
		
		System.out.println(s1.indexOf("c")); // c์˜ ์œ„์น˜
		System.out.println(
				s1.substring(
						s1.indexOf("c"), s1.indexOf("r") + 1)); // ๋‘๊ฐ€์ง€ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ผํ•ฉํ•˜์—ฌ ๊ฐ„๋‹จํ•˜๊ฒŒ ์ถ”์ถœ๊ฐ€๋Šฅ
		
		String s2 = "์‚ฌ๊ณผ,๋ฐฐ,๋ฐ”๋‚˜๋‚˜,์ˆ˜๋ฐ•";
		String[] sArr = s2.split(",");
		for(int i = 0; i < sArr.length; i++) {
			System.out.println(sArr[i]);
		}
		
		System.out.println();
		
	}
}

 

 

 

# ์ด์ค‘ for๋ฌธ

 

package thisisjava;

public class arr07 {

	public static void main(String[] args) {
		int[][] iArr01 = {{1, 2, 3}, 
						  {4, 5, 6}, 
						  {7, 8, 9}};
		
		System.out.println(iArr01.length); // 3ํ–‰
		System.out.println(iArr01[0].length); // 1ํ–‰์˜ ์š”์†Œ์˜ ๊ฐœ์ˆ˜
		
		System.out.println(iArr01[0][0]);
		
		// 3, 4, 8
		System.out.println(iArr01[0][2]);
		System.out.println(iArr01[1][0]);
		System.out.println(iArr01[2][1]);
		
		System.out.println();
		
		// 1 2 3 / 4 5 6 / 7 8 9 ์ถœ๋ ฅํ•˜๊ธฐ 
		for(int i = 0; i < iArr01.length; i++) {
			for(int j = 0; j < iArr01[i].length; j++) {
				System.out.print(iArr01[i][j] + " ");
			}
			System.out.println();
		}
	}
}

 

 

# string ๋ฐฐ์—ด์˜ ๋ณต์‚ฌ : ์–•์€ ๋ณต์‚ฌ(shallow copy)

 

package thisisjava;

public class arr11 {

	public static void main(String[] args) {
		int i1 = 11, i2 = 0;
		int[] iArr01 = {10, 20, 30, 40};
		int[] iArr02 = new int[4];
		
		i2 = i1; i2 = 22;
		System.out.println(i1 + ", " + i2);
		iArr02 = iArr01;
		iArr01[3] = 400;
		
		// ---> 10 20 30 40
		for(int i : iArr02) {
			System.out.print(i + " ");
		}
		
	}
}

 


 

# class ๊ธฐ์ดˆ

 

package thisisjava;

/*
 class
 - ํ•„๋“œ(์†์„ฑ), ๋ฉ”์„œ๋“œ, ์ƒ์„ฑ์ž๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ๋‹ค
 - ๊ฐ’๊ณผ ์ฐธ์กฐ ํƒ€์ž…์ด ํ˜ผํ•ฉ๋˜์–ด ์žˆ๋‹ค
 - ๊ฐ’์€ 0, ์ฐธ์กฐ๋Š” null์ด ๋“ค์–ด์žˆ๊ณ  ๋‚˜์ค‘์— ๊ฐ’์ด ๋“ค์–ด๊ฐ€๊ณ  ์ฐธ์กฐ๋œ๋‹ค
 - ๋ถ•์–ด๋นต ํ‹€์— ๋ถ•์–ด๋ฅผ ์ฐ์–ด๋‚ด๋“ฏ ๊ฐ™์€ ํ˜•์‹์˜ ์—ฌ๋Ÿฌ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ด์•„๋‚ผ ์ˆ˜ ์žˆ๋‹ค
 */

class Book00 {
	String title; 	// ์ฑ…๋ช…
	String author; 	// ์ €์ž
	int price; 		// ๊ฐ€๊ฒฉ
	
	// ๋ฉค๋ฒ„ ๋ฉ”์†Œ๋“œ
	// ๋ฐ˜ํ™˜Type ์ด๋ฆ„(์ž…๋ ฅ Type ์ž…๋ ฅ) {์ฒ˜๋ฆฌ; return ๋ฐ˜ํ™˜๊ฐ’;}
	// void : ๋ฐ˜ํ™˜๊ฐ’ ์—†์Œ
	void pBook() {
		System.out.println(title + ", " + author + ", " + price);
	}
}

public class Cla00 {
	public static void main(String[] args) {
		Book00 b1 = new Book00();
		b1.title = "์ž๋ฐ”"; b1.author = "ํ™๊ธธ๋™"; b1.price = 30000;	
		b1.pBook();
//		System.out.println(b1.title + ", " + b1.author + ", " + b1.price);
		
		
		Book00 b2 = new Book00();
		b2.title = "์†Œ๊ณต"; b2.author = "๊น€์€๋น„"; b2.price = 40000;
		b2.pBook();
//		System.out.println(b2.title + ", " + b2.author + ", " + b2.price);
	}
}

 

 

 

# ํด๋ž˜์Šค ๊ตฌ์„ฑ 3๊ฐ€์ง€(ํ•„๋“œ, ์ƒ์„ฑ์ž, ๋ฉ”์„œ๋“œ)

 

package thisisjava;

public class Book01 {
	// ๋ฉค๋ฒ„ ํ•„๋“œ
	String title;
	String author;
	int price;
	
	// ๋ฉค๋ฒ„ ์ƒ์„ฑ์ž(์—†๋”๋ผ๋„ ์€๋‹‰๋˜์–ด ์žˆ์Œ)
	Book01(String t, String a, int p){
		this.title = t;
		this.author = a;
		this.price = p;
	}
	
	// ๋ฉค๋ฒ„ ๋ฉ”์„œ๋“œ
	void pBook() {
		System.out.println(title + ", " + author + ", " + price);
	}
	
}

 

 

 

# ์ƒ์„ฑ์ž ๋ฉ”์„œ๋“œ ์˜ค๋ฒ„๋กœ๋”ฉ

 

package thisisjava;

class Book03{
	String title; String author; int price;
	// ๊ฐ•์‚ฌ๋‹˜์€ ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋ฌด์ œ/์ž‘์ž๋ฏธ์ƒ/0 ๋„ฃ์–ด์ฃผ์‹ฌ
	
	// ์ƒ์„ฑ์ž ์˜ค๋ฒ„๋กœ๋”ฉ
	Book03(String title, String author, int price) {
		this.title = title;
		this.author = author;
		this.price = price;
	}
	
	Book03(String title, String author) {
		this(title, author, 0);
//		this.title = title;
//		this.author = author;
//		this.price = 0;
	}
	
	Book03(String title) {
		this(title, "์ž‘์ž๋ฏธ์ƒ", 0);
//		this.title = title;
//		this.author = "์ž‘์ž๋ฏธ์ƒ";
//		this.price = 0;
	}
	
	Book03() {
		this("๋ฌด์ œ", "์ž‘์ž๋ฏธ์ƒ", 0);
//		this.title = "๋ฌด์ œ";
//		this.author = "์ž‘์ž๋ฏธ์ƒ";
//		this.price = 0;
	}
	
	void pBook() {
		System.out.println(this.title + "," + 
						   this.author + "," + this.price);
	}
}

public class Cla03 {

	public static void main(String[] args) {
		Book03 b1 = new Book03("APT", "๋กœ์ œ", 10000);
		b1.pBook(); // APT, ๋กœ์ œ, 10000;
		Book03 b2 = new Book03("APT", "Tom");
		b2.pBook(); // ์ž๋ฐ”, Tom, 0
		Book03 b3 = new Book03("๊ธฐ์‚ฌ");
		b3.pBook(); // ๊ธฐ์‚ฌ, ์ž‘์ž๋ฏธ์ƒ, 0
		Book03 b4 = new Book03();
		b4.pBook(); // ๋ฌด์ œ, ์ž‘์ž๋ฏธ์ƒ, 0
	}
}

/*
์ƒ์„ฑ์ž ์ฒด์ด๋‹ :
- ํ˜„์—…์—์„œ ์ƒ์„ฑ์ž ์ฒด์ด๋‹์€ ์ค‘๋ณต ์ฝ”๋“œ ์ œ๊ฑฐ, ์œ ์ง€ ๋ณด์ˆ˜์„ฑ ํ–ฅ์ƒ, ์ฝ”๋“œ ์ผ๊ด€์„ฑ ํ™•๋ณด ๋“ฑ์˜ ์ด์œ ๋กœ ๋งŽ์ด ์‚ฌ์šฉ๋˜๋Š” ๊ธฐ๋ฒ•
- ๊ฐ์ฒด์˜ ์ดˆ๊ธฐํ™” ๋ฐฉ์‹์„ ๋‹จ์ˆœํ•˜๊ณ  ๋ช…ํ™•ํ•˜๊ฒŒ ์œ ์ง€ํ•˜๋Š” ๋ฐ ํฐ ๋„์›€์ด ๋˜๋ฏ€๋กœ 
- ์ดˆ๊ธฐํ™”์˜ ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ•˜๊ณ  ์ค‘๋ณต์„ ์ค„์ด๋Š” ๋ฐฉํ–ฅ์œผ๋กœ ์„ค๊ณ„ํ•  ๋•Œ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ
*/

 

 

(ํ™”์š”์ผ)

 

# ๊ฐ์ฒด(Object)

- ๋ฌผ๋ฆฌ์ ์œผ๋กœ ์กด์žฌํ•˜๊ฑฐ๋‚˜ ๊ฐœ๋…์ ์ธ ๊ฒƒ ์ค‘์—์„œ ๋‹ค๋ฅธ ๊ฒƒ๊ณผ ์‹๋ณ„ ๊ฐ€๋Šฅํ•œ ๊ฒƒ

- ์†์„ฑ๊ณผ ๋™์ž‘์œผ๋กœ ๊ตฌ์„ฑ, ์ž๋ฐ”๋Š” ์ด๋Ÿฌํ•œ ์†์„ฑ๊ณผ ๋™์ž‘์„ ๊ฐ๊ฐ ํ•„๋“œ์™€ ๋ฉ”์†Œ๋“œ๋ผ๊ณ  ๋ถ€๋ฆ„

- ์‹ค์ œ ์กด์žฌํ•˜๋Š” ๋ฐ์ดํ„ฐ ํ•˜๋‚˜ํ•˜๋‚˜๋ฅผ ์ธ์Šคํ„ด์Šค!

 

# ๊ฐ์ฒด ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ(OOP)

- ๊ฐ์ฒด๋“ค์„๋จผ์ € ๋งŒ๋“ค๊ณ , ์ด ๊ฐ์ฒด๋“ค์„ํ•˜๋‚˜์”ฉ ์กฐ๋ฆฝํ•ด์„œ ์™„์„ฑ๋œ ํ”„๋กœ๊ทธ๋žจ์„ ๋งŒ๋“œ๋Š” ๊ธฐ๋ฒ•

  

# ๋ฉ”์„œ๋“œ ์˜ค๋ฒ„๋กœ๋”ฉ

package thisisjava;

class Meth06 {
	int Sum(int x, int y) {
		int res = x + y;
		return res;
	}
	
	String Sum(String x, String y) {
		String res = x + y;
		return res;
	}
	
	String Sum(String x, int y, int z) {
		String res2 = x + "๊ฒฐ๊ณผ : " + Sum(y, z); 
		return res2;
	}	
}

public class Cla06 {
	public static void main(String[] args) {
		Meth06 m1 = new Meth06();
		System.out.println(m1.Sum(20, 10));	
		System.out.println(m1.Sum("๋Œ€ํ•œ", "๋ฏผ๊ตญ"));
		System.out.println(m1.Sum("๋ง์…ˆ", 30, 4));
	}
}

 

 

 

# ๊ฐ€๋ณ€๊ธธ์ด ๋งค๊ฐœ๋ณ€์ˆ˜ & ์˜ค๋ฒ„๋กœ๋”ฉ

 

package thisisjava;

import java.util.List;

class Meth07 {
	//  ๋ฐฐ์—ด ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ์‚ฌ์šฉํ•˜๋ฉด ์ž…๋ ฅ๋ฐ›์„ ๋•Œ ๋ฐฐ์—ด๋งŒ ํ—ˆ์šฉํ•˜๊ธฐ์— ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ฐ์ดํ„ฐ ํƒ€์ž…์„ ์‚ฌ์šฉํ•  ์ˆ˜๋Š” ์—†๋‹ค
	int Sum00(int[] iArray) {
		int ans = 0;
		for(int i : iArray) {
			ans += i;
		}
		return ans;
	}
	
	int Sum01(int ... iArray) {
		int ans = 0;
		for(int i : iArray) {
			ans += i;
		}
		return ans;
	}
	
	String Sum01(String ... sArray) {
		String ans2 = "";
		for(String s : sArray) {
			ans2 += s;
		}
		return ans2;
 	}
	
	String Sum00(List<String> string) {
		StringBuilder ans = new StringBuilder();
		for(String s : string) {
			ans.append(s);
		}
		return ans.toString();
	}
}

public class Cla07 {

	public static void main(String[] args) {
		Meth07 m1 = new Meth07(); int res = 0;
		int[] iArr01 = {20, 10, 40};
		res = m1.Sum00(iArr01);
		System.out.println(res);
		res = m1.Sum00(new int[] {20, 10, 5});
		System.out.println(res);
		res = m1.Sum00(new int[] {20, 10, 5, 3});
		System.out.println(res);
		res = m1.Sum00(new int[] {20, 10, 5, 3, 2});
		System.out.println(res);
		
		res = m1.Sum01(20, 10);
		System.out.println(res);
		res = m1.Sum01(20, 10, 5);
		System.out.println(res);
		res = m1.Sum01(20, 10, 5, 3);
		System.out.println(res);
		res = m1.Sum01(20, 10, 5, 3, 2);
		System.out.println(res);
		
		String s;
		s = m1.Sum01("์„œ์ดˆ", "์—ฌ์„ฑ", "์ธ๋ ฅ");
		System.out.println(s);
		s = m1.Sum01("๊ฐœ๋ฐœ", "์„ผํ„ฐ");
		System.out.println(s);
	}
}

 

 

# staic ์‚ฌ์šฉ

package thisisjava;

class Meth08 {
	static int iMoney; // static์ด ๋ถ™์œผ๋ฉด ๋ฉ”์†Œ๋“œ ์˜์—ญ์— static์ด ์ƒ๊ธฐ๊ณ  ํž™ ์˜์—ญ์—๋Š” ๋งŒ๋“ค์–ด์ง€์ง€ ์•Š๋Š”๋‹ค
	void setMoney(int i, int o) {
		iMoney = iMoney + i - o;
	}
	void getMoney() { System.out.println(iMoney); }
}

public class Cla08 {
	public static void main(String[] args) {
		Meth08 m = new Meth08();
		Meth08 w = new Meth08();
		
		m.setMoney(20000, 13000); m.getMoney();
		w.setMoney(30000, 10000); w.getMoney();
		
	}
}

 

 

# static ์‚ฌ์šฉ 2

package thisisjava;

class Meth09 {
	// instanceํ˜• method
	void Sum(int x, int y) {
		System.out.println(x + y);
	}
	
	// static ํ˜• method : ๊ณต๊ฐ„์„ ๋Š˜๋ฆด ํ•„์š”๊ฐ€ ์—†์–ด์„œ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์„ ์•„๋‚„ ์ˆ˜ ์žˆ๋‹ค!
	static void Sub(int x, int y) {
		System.out.println(x - y);
	}
}

public class Cla09 {
	public static void main(String[] args) {
		int a = 20, b = 10;
		// instance ์ƒ์„ฑ ํ›„, instance.๋ฉค๋ฒ„๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ์•ผ ํ•œ๋‹ค
		Meth09 m1 = new Meth09(); m1.Sum(20, 10);
		Meth09 m2 = new Meth09(); m2.Sum(20, 10);
		
		// class๋ช….๋ฉค๋ฒ„๋กœ ์‚ฌ์šฉํ•˜์—ฌ์•ผ ํ•œ๋‹ค
		Meth09.Sub(20, 10);
	}
}

 

 

# static ์‚ฌ์šฉ 3 

 

- ์‚ฌ์น™์—ฐ์‚ฐ ๋ฉ”์†Œ๋“œ๋ฅผ static์œผ๋กœ ์‚ฌ์šฉํ•˜๋ฉด ์ข‹์€ ์ด์œ !!

package thisisjava;

class Meth10 {
	static int Sum(int x, int y) {
		return x + y;
	}
	
	static void Sub(int x, int y) {
		System.out.println(x - y);
	}
	
	static int Mul(int x, int y) {
		return x * y;
	}
	
	static void Div(int x, int y) {
		System.out.println(x / y);
	}
}

public class Cla10 {
	public static void main(String[] args) {
		int a = 20, b = 10;
		System.out.println(Meth10.Sum(a, b));
		Meth10.Sub(a, b);
		System.out.println(Meth10.Mul(a, b));		
		Meth10.Div(a, b);
	}
}

 

 

# static ์‚ฌ์šฉ 4

 

package thisisjava;

class Meth13 {

	static int cnt0 = 0;
	int cnt3 = 0;
	void count01(int cnt1) {
		cnt0++; cnt1++; cnt3++;
		System.out.printf("%d, %d, %d\n", cnt0, cnt1, cnt3);
	}
	
	void count02(int cnt2) {
		cnt0++; cnt2++; cnt3++;
		System.out.printf("%d, %d, %d\n", cnt0, cnt2, cnt3);
	}
}

public class Cla13 {

	public static void main(String[] args) {
		Meth13 m1 = new Meth13(); m1.count01(10); // 1, 11, 1 
		Meth13 m2 = new Meth13(); m2.count02(20); // 2, 21, 1
	}
}

 

 


 

(์ˆ˜์š”์ผ)

 

# static / instance / local ๋ณ€์ˆ˜ ๋น„๊ตํ•˜๊ธฐ

 

package thisisjava;

class Meth14 {
	static int staticCnt = 0;
	int instanceCnt = 0;
	void Count() {
		int localCnt = 0;
		staticCnt++; instanceCnt++; localCnt++;
		System.out.printf("%d, %d, %d\n",staticCnt, instanceCnt, localCnt);
	}
}

public class Cla14 {	
	public static void main(String[] args) {
		Meth14 m1 = new Meth14(); 
		m1.Count(); // 1, 1, 1
		m1.Count(); // 2, 2, 1
		m1.Count(); //a3, 3, 1
		
		Meth14 m2 = new Meth14(); 
		m2.Count(); // 4, 1, 1
		m2.Count(); // 5, 2, 1
		m2.Count(); // 6, 3, 1
	}
}

 

static : ๋ชจ๋‘์˜ ๊ณต์šฉ ๊ณต๊ฐ„์— ์กด์žฌ!! ํ•ญ์ƒ ๊ฐ’์ด ๋ฐ”๋€๋‹ค

instance : ๋‚ด๊ฐ€ ๊ฐ™์€ ๊ฐ์ฒด๋ฅผ ํ˜ธ์ถœํ• ๋•Œ๋งˆ๋‹ค ๊ฐ’์ด ๋ฐ”๋€๋‹ค

local : method๊ฐ€ ์‹คํ–‰ํ• ๋•Œ๋งˆ๋‹ค ๊ฐ’์ด ์ƒ๊ธฐ๊ณ  ์—†์–ด์ง„๋‹ค!!

 

 

 

# private๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ getter, setter ๋ฉ”์„œ๋“œ๋ฅผ ์šฐํšŒ์ ์œผ๋กœ ์‚ฌ์šฉํ–ˆ์„๋•Œ..

 

package thisisjava;

class Book16{
	// ํ•„๋“œ๋ช…์ด ๊ทธ๋Œ€๋กœ ๋…ธ์ถœ๋˜๋Š”๊ฒƒ์ด ์ข‹์ง€ ์•Š์•„์„œ private๋กœ ์ฒ˜๋ฆฌ๋ฅผ ๋งŽ์ด ํ•˜๋Š”๋ฐ
	// ๊ทธ๋•Œ getter, setter ๋ฉ”์„œ๋“œ๋ฅผ ๋งŒ๋“ฆ์œผ๋กœ์จ ์šฐํšŒ์ ์œผ๋กœ ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋งŒ๋“œ๋Š”๊ฒƒ์ด ์ข‹๋‹ค
	private String title = "๋ฌด์ œ"; 
	private String author = "๋ฏธ์ƒ";
	
	public String getTitle() { return this.title; }
	public void setTitle(String title) { this.title = title; }
}

public class Cla16 {
	public static void main(String[] args) {
		Book16 b1 = new Book16();
		b1.setTitle("Java"); 
		System.out.println(b1.getTitle());
		
	}
}

 

 

# Class์˜ ํ™œ์šฉ

 

package thisisjava;

class Point17 {
    int x, y;
    
    Point17() { }; 
    
    Point17(int i, int j) {
        this.x = i;
        this.y = j;
        System.out.println(this.x + ", " + this.y);
    }
    
    void Sum(Point17 p1, Point17 p2) {
        this.x = p1.x + p2.x;
        this.y = p1.y + p2.y;
        System.out.println(this.x + ", " + this.y);
    }
    
    // ๊ฐ•์‚ฌ๋‹˜ ์ฝ”๋“œ
    static Point17 pSum(Point17 i, Point17 j) {
    	int a = i.x + j.x;
    	int b = i.y + j.y;
    	return new Point17(a, b);
    }
    
    // ์ง์‚ฌ๊ฐํ˜• ๋„“์ด ๊ตฌํ•˜๊ธฐ
    static int pRect(Point17 i, Point17 j) {
//    	int height;
//    	int width;
//    	if(i.x >= j.x) {
//    		width = i.x - j.x;
//    	} else width = j.x - i.x;
//    	
//    	if(j.y >= i.y) {
//    		height = j.y - i.y;
//    	} else height = j.y - i.y;
    	int height = Math.abs(i.x - j.x);
    	int width = Math.abs(i.y - j.y);
    	int res = height * width;
    	return res;
    	
    }
}

public class Cla17 {
    public static void main(String[] args) {
        Point17 p1 = new Point17(20, 10); 
        Point17 p2 = new Point17(35, 25); 
        Point17 p3 = new Point17();
        p3.Sum(p1, p2);      // 55, 35
        
        // ๊ฐ•์‚ฌ๋‹˜ ์ฝ”๋“œ
//        Point17 p4 = Point17.pSum(p1, p2);
        System.out.println(p3.pRect(p1, p2));
    }
}

 

 

# ์‹ฑ๊ธ€ํ†ค ํŒจํ„ด

  • ์ƒ์„ฑ์ž๋ฅผ private ์ ‘๊ทผ ์ œํ•œํ•ด์„œ ์™ธ๋ถ€์—์„œ new ์—ฐ์‚ฐ์ž๋กœ ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ•  ์ˆ˜ ์—†๋„๋ก ๋ง‰์•„์„œ ์™ธ๋ถ€์—์„œ ๋งˆ์Œ๋Œ€๋กœ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜์ง€ ๋ชปํ•˜๊ฒŒ ํ•จ
  • ๋Œ€์‹  ์‹ฑ๊ธ€ํ†ค ํŒจํ„ด์ด ์ œ๊ณตํ•˜๋Š” ์ •์  ๋ฉ”์†Œ๋“œ๋ฅผ ํ†ตํ•ด ๊ฐ„์ ‘์ ์œผ๋กœ ๊ฐ์ฒด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Œ
  • ์‹ฑ๊ธ€ํ†ค : ํด๋ž˜์Šค์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๋”ฑ ํ•˜๋‚˜๋งŒ ์ƒ์„ฑํ•˜๋„๋ก ๋ณด
package thisisjava;

class Sing18 {
	// ๋”ฑ ํ•œ๋ฒˆ๋งŒ ์‹คํ–‰๋˜์–ด์•ผ ํ•˜๋Š” ์• ๋“คํ•œํ…Œ ๊ฐ•์ œ๋กœ ํ•˜๊ฒŒ ํ•œ๋‹ค!! 
    // Sing18 ํด๋ž˜์Šค๋Š” ์ž๊ธฐ ์ž์‹ ์˜ ๊ฐ์ฒด๋ฅผ ํด๋ž˜์Šค ๋‚ด๋ถ€์—์„œ ๋‹จ ํ•œ ๋ฒˆ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
	private static Sing18 sing = new Sing18();
    // ์ƒ์„ฑ์ž๋ฅผ private์œผ๋กœ ์„ ์–ธํ•˜์—ฌ ์™ธ๋ถ€์—์„œ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์—†๋„๋ก ์ œํ•œํ•ฉ๋‹ˆ๋‹ค.
	private Sing18() {}
	
	static Sing18 getInstnace() {
		return sing;
	}
}

public class Cla18 {
	public static void main(String[] args) {
		Sing18 s1 = Sing18.getInstnace();
		Sing18 s2 = Sing18.getInstnace();
		
		System.out.println(s1 == s2);
	}
}

 

 

# ์ƒ์† (& ๋ฉ”์†Œ๋“œ ์˜ค๋ฒ„๋ผ์ด๋”ฉ)

 

package thisisjava;

class Ani20 {
	String name = "์ด๋ฆ„";
	void cry() { System.out.println("์œผ์•™"); }	
}

class Dog20 extends Ani20 {
	String name = "ํ•ดํ”ผ";
	@Override
	void cry() { System.out.println("๋ฉ๋ฉ"); } // Method Overriding
}

class Cat20 extends Ani20 {
	String name = "์•„์น˜";
	@Override
	void cry() { System.out.println("์•ผ์˜น"); 	}
}

class Duck20 extends Ani20 { 
	String name = "๋„ํŠธ";
	@Override
	void cry() { System.out.println("๊ฝค๊ฝฅ"); 	}
}

public class Cla20 {
	public static void main(String args[]) {
		Dog20 d1 = new Dog20();
		System.out.print(d1.name); d1.cry();
		
		Cat20 c1 = new Cat20();
		System.out.print(c1.name); c1.cry();
		
		Duck20 d2 = new Duck20();
		System.out.print(d2.name); d2.cry();
	}
}

 

 

# ์ƒ์† ( & final & Override)

package thisisjava;

class Vehicle22{
	static final int a = 1;
	void start() {System.out.println("์ถœ๋ฐœ");}
	void move() {System.out.println("์ด๋™");}
	void stop()  {System.out.println("๋ฉˆ์ถค");}
}
class Car22 extends Vehicle22{
	// final์ด ๋ถ™์€ ๊ฒฝ์šฐ ์˜ค๋ฒ„๋ผ์ด๋”ฉ ๋ถˆ๊ฐ€๋Šฅ 
//	@Override
//	int a = 2;
	
	// final + ๋ณ€์ˆ˜ -> ์ƒ์ˆ˜๊ฐ™์€ ๋Š๋‚Œ
	static final int Normal = 1;
	static final int Accel = 2;
	static final int Slow = 3;
	
	int moveMode = Normal;
	
	void move() {
		if (moveMode == Normal) { super.move(); }
		else if (moveMode == Accel) 
			{System.out.println("๋น ๋ฅธ ์ด๋™");}
		else {System.out.println("์ฒœ์ฒœํžˆ ์ด๋™");}
	}
}
public class Cla22 {
	public static void main(String[] args) {
		Car22 c1 = new Car22();
		c1.start();
		c1.move();
		c1.moveMode = Car22.Accel;
		c1.move();
		c1.moveMode = Car22.Slow;
		c1.move();
		c1.stop();
	}

}

 

 

# ์ฐธ์กฐํ˜• ํ˜•๋ณ€ํ™˜

 

- ๋ถ€๋ชจ ๋ณด๋‹ค ์ž์‹์— ๋” ๋งŽ์€ ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด์žˆ๋‹ค!!

- ๊ฐ’์„ ์ฐพ์„ ์ˆ˜ ์—†์–ด์„œ ๋งˆ์ง€๋ง‰ 4๋ฒˆ์€ ํ‹€๋ฆฐ๊ฑฐ์ž„

package thisisjava;

class A25 { int a = 200; }
class B25 extends A25{ int b = 100; }


public class Cla25 {
	public static void main(String[] args) {
		// ์ฐธ์กฐํ˜• ํ˜•๋ณ€ํ™˜
		A25 z1 = new A25();
		B25 z2 = new B25();
		A25 z3 = new B25();
		// B25 z4 = new A25(); ๋ฌธ๋ฒ•์ ์ธ ์—๋Ÿฌ๋Š” ์•„๋‹ˆ์ง€๋งŒ ๋ฉ”๋ชจ๋ฆฌ์ ์ธ ์—๋Ÿฌ
		
		short s1 = 10;
		int i1 = s1;
		int i2 = 20;
		short s2 = (short) i2;
	}
}

 

 


(๋ชฉ์š”์ผ)

 

# ์ƒ์†

 

package thisisjava;

class A26 {}
class B26 extends A26 {}
class C26 extends A26 {}
class D26 extends B26 {}
class E26 extends C26 {}

public class Cla26 {

	public static void main(String[] args) {
		B26 b = new B26();
		C26 c = new C26();
		D26 d = new D26();
		E26 e = new E26();
		
		A26 a1 = b; A26 a2 = c;
		A26 a3 = d; A26 a4 = e;
		
		B26 b1 = d; C26 c1 = e;
//		B26 b3 = e; C26 c3 = d;  -> ์ง๊ณ„๊ฐ€ ์•„๋‹ˆ๋ฉด ํ˜•๋ณ€ํ™˜ ๋ถˆ๊ฐ€
		
		System.out.println(d instanceof B26);
		System.out.println(d instanceof A26);
		System.out.println(b instanceof D26); // false 
		
		System.out.println(e instanceof C26);
		System.out.println(e instanceof A26);
	}

}

 

 

# ๋‹ค์ค‘ ์ƒ์†(์ธํ„ฐํŽ˜์ด์Šค๋Š” ๊ฐ€๋Šฅ) 

 

- ๋ถˆ๊ฐ€๋Šฅํ•œ ์ด์œ  : ํ•„๋“œ๋ž‘ ๋ฉ”์„œ๋“œ๋ฅผ ์•„๋ฌด๋ฆฌ ์•ˆ ๋งŒ๋“ ๋‹ค๊ณ  ํ•˜๋”๋ผ๋„ ๊ทผ๋ณธ์ ์œผ๋กœ object์— ์ƒ์†์„ ๋ฐ›๊ธฐ ๋•Œ๋ฌธ์— ์—†๋‹ค๊ณ  ๋Š๊ปด๋„ ์‹ค์งˆ์ ์œผ๋กœ equals()๋‚˜ toString()๊ฐ™์€ ๋ฉ”์„œ๋“œ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์ค‘ ์ƒ์†์ด ๋ถˆ๊ฐ€ํ•˜๋‹ค 

 

- Java๋Š” ํด๋ž˜์Šค ๊ฐ„์˜ ๋‹ค์ค‘ ์ƒ์†์„ ํ—ˆ์šฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ทธ ์ด์œ ๋Š” ๋‹ค์ค‘ ์ƒ์†์ด ํ—ˆ์šฉ๋  ๊ฒฝ์šฐ, ๋‘ ๋ถ€๋ชจ ํด๋ž˜์Šค์—์„œ ๊ฐ™์€ ์ด๋ฆ„์˜ ๋ฉ”์„œ๋“œ๋‚˜ ํ•„๋“œ๊ฐ€ ์ •์˜๋˜์—ˆ์„ ๋•Œ ์–ด๋–ค ๊ฒƒ์„ ์‚ฌ์šฉํ• ์ง€ ๊ฒฐ์ •ํ•˜๋Š” ๊ณผ์ •์—์„œ ํ˜ผ๋ž€์Šค๋Ÿฌ์›Œ์งˆ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค(๋‹ค์ด์•„๋ชฌ๋“œ ๋ฌธ์ œ). ๋˜ํ•œ, Java์˜ ๋ชจ๋“  ํด๋ž˜์Šค๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ Object๋ฅผ ์ƒ์†๋ฐ›๊ธฐ ๋•Œ๋ฌธ์—, ๋‹ค์ค‘ ์ƒ์†์ด ํ—ˆ์šฉ๋˜๋ฉด ์ƒ์† ๊ด€๊ณ„๊ฐ€ ์ง€๋‚˜์น˜๊ฒŒ ๋ณต์žกํ•ด์ง€๊ณ  ์ถฉ๋Œ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์•„์ง‘๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ด์œ ๋กœ Java๋Š” ํด๋ž˜์Šค ๊ฐ„์˜ ๋‹ค์ค‘ ์ƒ์†์„ ๊ธˆ์ง€ํ•˜๊ณ , ๋Œ€์‹  ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ†ตํ•ด ๋‹ค์ค‘ ๊ตฌํ˜„์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

 

- interface๋Š” ๊ฐ€๋Šฅํ•œ ์ด์œ  : ์ƒํƒœ(ํ•„๋“œ)๊ฐ€ ์—†๊ณ  ๋™์ž‘(ํ–‰์œ„)๋งŒ ์ •์˜ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์ค‘ ๊ตฌํ˜„์ด ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค.

 

package thisisjava;


//class A27{}
//class B27{}
//class C27 extends A27,B27 { }

interface A27{ }
interface B27{ }
class C27 implements A27, B27{ }

public class Cla27 {

	public static void main(String[] args) {
		System.out.println("์ž˜ ์‹คํ–‰๋จ");
	}
}

๋ณธ์งˆ์ ์œผ๋กœ ๊ฐ™์€๊ฑธ ์ƒ์†๋ฐ›์œผ๋ฉด extends ๋‹ค๋ฅด๋ฉด implements abstract class -> interface(implements)์ด๋‹ค!!

 

 

 

# ์ ‘๊ทผ์ œํ•œ์ž

(public / protected / (default) / private) 

package thisisjava;

class A28 {
	
	int aa1 = 10;				// default (๊ฐ™์€ ํŒจํ‚ค์ง€) / ์ˆจ๊ฒจ์ ธ ์žˆ๋‹ค / ๊ณต๊ฐœ ๋ฒ”์œ„ 3๋“ฑ
	public int aa2 = 100; 		// public (ํ•ญ์ƒ ๊ณต๊ฐœ) / ๊ณต๊ฐœ ๋ฒ”์œ„ 1๋“ฑ
	private int aa3 = 1000;		// private(์ž๊ธฐ ํด๋ž˜์Šค) / ๊ณต๊ฐœ ๋ฒ”์œ„ ๊ผด๋“ฑ
	protected int aa4 = 10000;	// protected (์ƒ์†๊ด€๊ณ„ ๋‚ด + default) / ๊ณต๊ฐœ ๋ฒ”์œ„ 2๋“ฑ
}

class B28 extends A28 {
	int bb1 = 20;
}

public class Cla28 {
	public static void main(String[] args) {
		A28 a = new A28(); 
		B28 b = new B28(); 
	}
}

 

 

# ์ƒ์†์—์„œ์˜ ์ ‘๊ทผ ๋ฒ”์œ„

 

- ๋ถ€๋ชจ์—์„œ ์ƒ์†๋ฐ›์€ ๋ฉค๋ฒ„๋Š” ์ ‘๊ทผ ๋ฒ”์œ„๊ฐ€ ์ž‘์•„์งˆ ์ˆ˜ ์—†๋‹ค

- ์˜ค๋ฒ„๋ผ์ด๋”ฉ๋œ ๋ฉ”์„œ๋“œ๋Š” ๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ๋ฉ”์„œ๋“œ๋ฅผ **๋Œ€์ฒด(replace)**ํ•˜๋Š” ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ถ€๋ชจ ํด๋ž˜์Šค ํƒ€์ž…์œผ๋กœ ์ž์‹ ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐํ•  ๋•Œ๋„, ์˜ค๋ฒ„๋ผ์ด๋”ฉ๋œ ๋ฉ”์„œ๋“œ์— ๋™์ผํ•œ ์ ‘๊ทผ ์ˆ˜์ค€์œผ๋กœ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

package thisisjava;

class A29 {
	void meth01() {}
}

class B29 extends A29 {
	// ๋ถ€๋ชจํ•œํ…Œ์„œ ์ƒ์†๋ฐ›์€ ๋ฉค๋ฒ„๋Š” ์ ‘๊ทผ๋ฒ”์œ„๊ฐ€ ์ž‘์•„์งˆ ์ˆ˜ ์—†๋‹ค
//	@Override
//	private void meth01() {}
}

public class Cla29 {

	public static void main(String[] args) {

	}

}

 

 

#  ์ถ”์ƒ ํด๋ž˜์Šค์˜ ํ™œ์šฉ

 

- ์ƒ์† ๊ด€๊ณ„๋ฅผ ์œ ์ง€ํ•˜๋ฉด์„œ ๋‹คํ˜•์„ฑ์„ ์ด์šฉํ•˜๊ณ ์ž ํ• ๋•Œ

- ๋ถ€๋ชจ๋Š” ๊ตฌํ˜„๋ถ€๊ฐ€ ํ•„์š”ํ•˜๋ฏ€๋กœ 

- abstract๋ฅผ ๋ถ™์—ฌ์„œ ์ถ”์ƒํด๋ž˜์Šค๋กœ ๋งŒ๋“ค๋ฉด ๋œ๋‹ค

 

package ch07.sec08.exam02;

public abstract class Vehicle {
	//๋ฉ”์†Œ๋“œ ์„ ์–ธ
	public abstract void run(); 
}

 

 

 

# main ๋ฉ”์„œ๋“œ๊ฐ€ ์žˆ๋Š” ํด๋ž˜์Šค์—์„œ ๋‹ค๋ฅธ ๋ฉ”์„œ๋“œ๋ฅผ static์œผ๋กœ ์ง€์ •ํ•˜๋Š” ๊ฒƒ์ด ๊ถŒ์žฅ๋˜๋Š” ์ด์œ 

 

1. static ๋ฉ”์„œ๋“œ์™€ non-static ๋ฉ”์„œ๋“œ ํ˜ผ์šฉ์˜ ๋ฌธ์ œ

  • main() ๋ฉ”์„œ๋“œ๋Š” static ๋ฉ”์„œ๋“œ์ž…๋‹ˆ๋‹ค. main() ๋ฉ”์„œ๋“œ ๋‚ด๋ถ€์—์„œ static ๋ฉ”์„œ๋“œ์™€ non-static ๋ฉ”์„œ๋“œ๊ฐ€ ํ˜ผ์šฉ๋˜๋ฉด ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์˜ˆ๋ฅผ ๋“ค์–ด, test02()๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์œ„ํ•ด ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•ด์•ผ ํ•˜๋Š” ๋ฐ˜๋ฉด, test01()์€ ๊ฐ์ฒด ์—†์ด ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค.
    ๊ฐœ๋ฐœ์ž๊ฐ€ ์ฝ”๋“œ๋ฅผ ์ฝ์„ ๋•Œ ์ด๋Ÿฌํ•œ ํ˜ผ์šฉ์€ ํ˜ผ๋ž€์„ ์ดˆ๋ž˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

2. ๊ฐ์ฒด ์ƒ์„ฑ ์˜ค๋ฒ„ํ—ค๋“œ

  • non-static ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•ด์•ผ ํ•˜๋ฏ€๋กœ, ๋ถˆํ•„์š”ํ•œ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๊ณผ ์ฒ˜๋ฆฌ ๋น„์šฉ์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    ๋งŒ์•ฝ ๋ฉ”์„œ๋“œ๊ฐ€ ์ธ์Šคํ„ด์Šค ์ƒํƒœ๋ฅผ ์ฐธ์กฐํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด, static์œผ๋กœ ์„ ์–ธํ•˜์—ฌ ๊ฐ์ฒด ์ƒ์„ฑ์„ ํ”ผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

3. ์ฝ”๋“œ์˜ ์ผ๊ด€์„ฑ ์œ ์ง€

  • main() ๋ฉ”์„œ๋“œ๊ฐ€ ์†ํ•œ ํด๋ž˜์Šค์—์„œ ๋ชจ๋“  ๋ฉ”์„œ๋“œ๋ฅผ static์œผ๋กœ ์„ ์–ธํ•˜๋ฉด, ๊ฐ์ฒด ์ƒ์„ฑ ์—†์ด ํด๋ž˜์Šค ์ด๋ฆ„์œผ๋กœ ๋ชจ๋“  ๋ฉ”์„œ๋“œ ํ˜ธ์ถœ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
  • ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์ผ๊ด€์„ฑ ์žˆ๋Š” ์ฝ”๋“œ ์Šคํƒ€์ผ์„ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

4. ์œ ์ง€๋ณด์ˆ˜์„ฑ

  • ์ •์  ๋ฉ”์„œ๋“œ๋Š” ์ƒํƒœ๋ฅผ ๊ณต์œ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ฝ”๋“œ์˜ ํ๋ฆ„์„ ์˜ˆ์ธกํ•˜๊ธฐ ์‰ฝ์Šต๋‹ˆ๋‹ค.
  • ๋น„์ •์  ๋ฉ”์„œ๋“œ๊ฐ€ ํ˜ผ์žฌ๋˜๋ฉด ๊ฐ์ฒด ์ƒ์„ฑ๊ณผ ๊ด€๋ฆฌ๋ฅผ ๋”ฐ๋กœ ์ถ”์ ํ•ด์•ผ ํ•˜๋ฏ€๋กœ ์œ ์ง€๋ณด์ˆ˜๊ฐ€ ์–ด๋ ค์›Œ์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
package thisisjava;

class Cla31 {
	public static void main(String[] args) {
		System.out.println("Cla30-main() ์‹คํ–‰");		
	}
	
	static void test01() {
		System.out.println("Cla31-test01() ์‹คํ–‰");
	}
	
	void test02() {
		System.out.println("Cla31-test02() ์‹คํ–‰");
	}
}

public class Cla30 {

	public static void main(String[] args) {
		System.out.println("Cla30-main() ์‹คํ–‰");
		Cla31.test01();
		Cla30.test01();
		test01();
		
		Cla31 c31 = new Cla31();
		c31.test02();
		
		// ๊ถŒ์žฅํ•˜์ง€ ์•Š๋Š” ์ด์œ  : main ๋ฉ”์„œ๋“œ๊ฐ€ ์žˆ๋Š” ๊ณณ์—์„œ๋Š” main ๋ฉ”์„œ๋“œ๋ฅผ ์ œ์™ธํ•˜๊ณ  ๋‹ค๋ฅธ ๋ฉ”์„œ๋“œ ๋˜ํ•œ static์„ ๋ถ™์—ฌ์ฃผ๋Š”๊ฒƒ์ด ์ข‹๋‹ค๊ณ  ๊ถŒ์žฅ (์•ˆ๋˜๋Š”๊ฑด ์•„๋‹˜)
		Cla30 c30 = new Cla30();
		c30.test02();
		
	}
	static void test01() { System.out.println("Cla30-test01() ์‹คํ–‰"); }
	void test02() {
		System.out.println("Cla31-test02() ์‹คํ–‰");
	}
}

 

 

# ๋ด‰์ธ๋œ ํด๋ž˜์Šค

 

- sealed ~ permits : ์ƒ์†์„ ํ—ˆ๋ฝํ•˜๋Š” ํด๋ž˜์Šค๋ฅผ ์ œํ•œํ•  ์ˆ˜ ์žˆ๋‹ค

- nonsealed : ๋ˆ„๊ฐ€ ์ƒ์†ํ•˜๋“  ์ƒ๊ด€ x

- final : ์ƒ์†ํ•˜์ง€ x

package ch07.sec11;

// Person ํด๋ž˜์Šค๋Š” Employee์™€ Manager์—๊ฒŒ๋งŒ ์ƒ์†์„ ํ—ˆ๋ฝํ•œ๋‹ค
public sealed class Person permits Employee, Manager {
	//ํ•„๋“œ
	public String name;
	
	//๋ฉ”์†Œ๋“œ
	public void work() {
		System.out.println("ํ•˜๋Š” ์ผ์ด ๊ฒฐ์ •๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.");
	}
}


// non-sealed๋Š” ๋ˆ„๊ฐ€ ์ƒ์†ํ•˜๋“ ์ง€ ์ƒ๊ด€ ์—†๋‹ค!
public non-sealed class Manager extends Person {
	@Override
	public void work() {
		System.out.println("์ƒ์‚ฐ ๊ด€๋ฆฌ๋ฅผ ํ•ฉ๋‹ˆ๋‹ค.");
	}
}


// final์€ Employee์ดํ›„ ํด๋ž˜์Šจ ๋” ์ด์ƒ ์ƒ์† ํ•ด์ฃผ์ง€ ์•Š์Œ
public final class Employee extends Person {
	@Override
	public void work() {
		System.out.println("์ œํ’ˆ์„ ์ƒ์‚ฐํ•ฉ๋‹ˆ๋‹ค.");
	}
}

 

 

# interface ์‚ฌ์šฉ!!

 

- ๊ตฌํ˜„์€ ํ•„์š”์—†๊ณ  ์ •์˜๋งŒ ํ•˜๋Š” ๊ฒฝ์šฐ interface ์‚ฌ์šฉ 

- class๊ฐ€ interface๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌํ˜„ํ•  ๋•Œ๋Š” extends -> implements๋กœ ๋ณ€๊ฒฝ

- ์ธํ„ฐํŽ˜์ด์Šค์˜ ๋ชจ๋“  ๋ฉ”์„œ๋“œ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ public abstract์ด๋ฏ€๋กœ interface์—์„œ ์ƒ์†๋ฐ›์•„์„œ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ์ ‘๊ทผ์ œํ•œ์ž๋ฅผ public ๋ณด๋‹ค ๊ฐ™๊ฑฐ๋‚˜ ํฐ ๋ฒ”์œ„์ธ public ์„ค์ • ํ•„์ˆ˜

 

package thisisjava;

// ๊ตณ์ด ์“ฐ์ง€๋„ ์•Š์€ ๊ตฌํ˜„์ฒด๊ฐ€ ์žˆ์„๋•Œ interface๋ฅผ ์‚ฌ์šฉ!!
interface TV{
	void PowerOn();
	void PowerOff();
}

class LGTV implements TV{
	// ๋ถ€๋ชจ ๋ฉค๋ฒ„์˜ ์ ‘๊ทผ ์ œํ•œ์ž๋ณด๋‹ค ๋ฒ”์œ„๊ฐ€ ์ปค์•ผํ•ด์„œ public์ด ํ•„์ˆ˜์ž„
	public void PowerOn() {
		System.out.println("LGTV ์ผœ์ง");
	}
	public void PowerOff() {
		System.out.println("LGTV ๊บผ์ง");
	}
}

class SSTV implements TV{
	public void PowerOn() {
		System.out.println("SSTV ์ผœ์ง");
	}
	public void PowerOff() {
		System.out.println("SSTV ๊บผ์ง");
	}
}

class KTTV implements TV{
	public void PowerOn() {
		System.out.println("KTTV ์ผœ์ง");
	}
	public void PowerOff() {
		System.out.println("KTTV ๊บผ์ง");
	}
}

public class Cla32 {
	public static void main(String[] args) {
		TV[] tvs = { new LGTV(), new SSTV(), new KTTV() };
		for(TV tv : tvs) {
			tv.PowerOn();
			tv.PowerOff();
		}
	}
}
728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

๋ฌธ์ œ ๐Ÿ˜ต‍๐Ÿ’ซ

https://school.programmers.co.kr/learn/courses/30/lessons/42840

 

ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค

SW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„

programmers.co.kr

 

๋‚ด ํ’€๐Ÿฆท

import java.util.*;

class Solution {
    public int[] solution(int[] answers) {
        // ์ˆ˜ํฌ์ž๋“ค์˜ ํŒจํ„ด ์ •์˜
        int[] pattern1 = {1, 2, 3, 4, 5};
        int[] pattern2 = {2, 1, 2, 3, 2, 4, 2, 5};
        int[] pattern3 = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5};
        
        // ์ ์ˆ˜๋ฅผ ๊ณ„์‚ฐํ•  ๋ฐฐ์—ด
        int[] scores = new int[3];
        
        // ๊ฐ ๋ฌธ์ œ์— ๋Œ€ํ•ด ์ˆ˜ํฌ์ž๋“ค์˜ ๋‹ต์•ˆ์„ ๋น„๊ตํ•˜์—ฌ ์ ์ˆ˜ ๊ณ„์‚ฐ
        for(int i = 0; i < answers.length; i++) {
            if(answers[i] == pattern1[i % pattern1.length]) {
                scores[0]++;
            }
            if(answers[i] == pattern2[i % pattern2.length]) {
                scores[1]++;
            }
            if(answers[i] == pattern3[i % pattern3.length]) {
                scores[2]++;
            }
        }
        
        // ์ œ์ผ ๋†’์€ ์ ์ˆ˜๋ฅผ ์ฐพ์Œ
        int maxScore = Math.max(scores[0], Math.max(scores[1], scores[2]));
        
        // ๊ฐ€์žฅ ๋†’์€ ์ ์ˆ˜๋ฅผ ๋ฐ›์€ ์ˆ˜ํฌ์ž๋ฅผ ๋ฆฌ์ŠคํŠธ์— ์ถ”๊ฐ€
        List<Integer> result = new ArrayList<>();
        for(int i = 0; i < scores.length; i++) {
            if(scores[i] == maxScore) {
                result.add(i+1);
            }
        }
        
        return result.stream().mapToInt(i -> i).toArray();
    }
}

 

๊ฐ€์žฅ ๋งŽ์€ ์ ์ˆ˜๋ฅผ ํš๋“ํ•œ ์‚ฌ๋žŒ์„ ๋ฐฐ์—ด๋กœ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฐ„๋‹จํ•œ ๋ฌธ์ œ์˜€๋‹ค!!

๋‹ด๋Š”๊ฒƒ ๊นŒ์ง€๋Š” ์ •๋ง ์‰ฌ์šด๋ฐ return ๋ฌธ ์ž‘์„ฑํ•˜๋Š” ๊ณผ์ •์—์„œ ์–ด๋ ค์›€์ด ์žˆ์—ˆ๋‹ค!

 

์ฐธ๊ณ ํ•˜๋ฉด ์ข‹์„ ๊ฐœ๋…๋“ค โœ๏ธ

  • .stream()
    • stream : ๋ฐ์ดํ„ฐ ์ปฌ๋ ‰์…˜์˜ ์ถ”์ƒํ™”๋กœ, ์š”์†Œ๋“ค์„ ์ฐจ๋ก€์ฐจ๋ก€ ๊บผ๋‚ด ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” "๋ฐ์ดํ„ฐ ํ๋ฆ„" 
    • List<Integer> ๊ฐ์ฒด์—์„œ ๊ฐ ์š”์†Œ์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋Š” ์ŠคํŠธ๋ฆผ์„ ์ƒ์„ฑํ•œ๋‹ค 
    • ์ŠคํŠธ๋ฆผ์€ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ์ž‘์—…์„ ์‰ฝ๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ์ถ”์ƒํ™” ๋„๊ตฌ์ด๋‹ค
  • .mapToInt(i -> i) 
    • ์ŠคํŠธ๋ฆผ์˜ ๊ฐ ์š”์†Œ๋ฅผ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜ํ•œ๋‹ค
    • i -> i๋Š” ๋žŒ๋‹ค ํ‘œํ˜„์‹์œผ๋กœ, ๋ฆฌ์ŠคํŠธ์˜ ๊ฐ ์š”์†Œ๋ฅผ i ๊ทธ๋Œ€๋กœ ๋ณ€ํ™˜ํ•œ๋‹ค๋Š” ์˜๋ฏธ์ด๋‹ค
    • ์ด ๊ณผ์ •์—์„œ ๊ฐ์ฒด(Integer)๋ฅผ ์›์‹œ ํƒ€์ž…(int)์œผ๋กœ ๋ณ€ํ™˜ํ•˜๊ฒŒ ๋œ๋‹ค
  • .toArray() 
    • ์ŠคํŠธ๋ฆผ์˜ ๊ฒฐ๊ณผ๋ฅผ ๋ฐฐ์—ด๋กœ ๋ณ€ํ™˜ํ•œ๋‹ค
    • ์ตœ์ข…์ ์œผ๋กœ List<Integer> ๊ฐ€ int[] ๋ฐฐ์—ด๋กœ ๋ณ€ํ™˜๋œ๋‹ค
728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

(์›”์š”์ผ)

# ์ตœ์ดˆ์˜ ํ”„๋กœ๊ทธ๋ž˜๋จธ

 

https://namu.wiki/w/%EC%97%90%EC%9D%B4%EB%8B%A4%20%EB%9F%AC%EB%B8%8C%EB%A0%88%EC%9D%B4%EC%8A%A4

 

์—์ด๋‹ค ๋Ÿฌ๋ธŒ๋ ˆ์ด์Šค

์—์ด๋‹ค ๋Ÿฌ๋ธŒ๋ ˆ์ด์Šค ๋Š” ์ž‰๊ธ€๋žœ๋“œ ์˜ ์ˆ˜ํ•™์ž ์ด์ž ์„ธ๊ณ„ ์ตœ์ดˆ์˜ ํ”„๋กœ๊ทธ๋ž˜๋จธ ์ด๋‹ค. ์ดˆ๊ธฐ ์ปดํ“จํ„ฐ ๊ณผํ•™ ์— ํฐ ๊ณตํ—Œ์„

namu.wiki

 

 

 

# it ์–ธ์–ด์˜ ์—ญ์‚ฌ

Lisp : ์ธ๊ณต์ง€๋Šฅ์–ธ์–ด(์—˜๋ŸฐํŠœ๋‹.. / ์ด๋ฏธํ…Œ์ด์…˜ ๊ฒŒ์ž„)

 

C์–ธ์–ด์˜ ํƒ„์ƒ

 

- ์ง๊ด€์  ์–ธ์–ด

- ๋ณ€์ˆ˜, ์กฐ๊ฑด๋ฌธ, ๋ฐ˜๋ณต๋ฌธ, ํ•จ์ˆ˜

- H/W, OS ๋ณ€ํ™”์‹œ, ๋‹ค์‹œ ์ปดํŒŒ์ผ ํ•„์š”

- ๋ฉ”๋ชจ๋ฆฌ ์ง์ ‘ ํ• ๋‹น/ํ•ด์ œ

- ์œ„ 2๋ฌธ์ œ์ ๋“ค๋กœ ํƒ„์ƒํ•จ => Java (JVM์—์„œ ์‹คํ–‰๋จ / OS์— ๋งž๋Š” JVM ํ™˜๊ฒฝ ๊ตฌ์„ฑ)

 

 

Java์˜ ์‹œ์ž‘

 

- ์ฐธ์กฐํ˜•(๋ฐ์ดํ„ฐ๊ฐ€ ๋ฌด์งˆ์„œํ•˜๊ฒŒ ๋“ค์–ด๊ฐ, ๋ฐ์ดํ„ฐ์˜ ์ฃผ์†Œ๊ฐ€ ๋“ค์–ด๊ฐ) / ๊ฐ’ํ˜•(๋ฐ์ดํ„ฐ์˜ ๊ฐ’์ด ๋“ค์–ด๊ฐ)

- Garbage Collection 

- OOP 

 

 

JRE(Java Runtime Environment)

 

- JDK = JRE + development tools

- JRE = JVM + libraries

 

 

# jdk ๋‹ค์šด๋กœ๋“œ

 

https://www.oracle.com/java/technologies/downloads/

 

Download the Latest Java LTS Free

Subscribe to Java SE and get the most comprehensive Java support available, with 24/7 global access to the experts.

www.oracle.com

 

x64 Installer ๋‹ค์šด

 

ํ™˜๊ฒฝ๋ณ€์ˆ˜ ๊ตฌ์„ฑ
JAVA_HOME : C:\Program Files\Java\jdk-21
PATH : %JAVA_HOME%\bin

ํ™˜๊ฒฝ๋ณ€์ˆ˜ ๊ตฌ์„ฑ ํ™•์ธ
java -version

javac -version

 

 

+ ์ œ์ผ ์œ„๋กœ ์˜ฌ๋ฆฌ๊ธฐ

 

 

# ๋ฉ”๋ชจ์žฅ์œผ๋กœ ์ฝ”๋”ฉํ•ด์„œ ์ปดํŒŒ์ผ ํ•ด๋ณด๊ธฐ

 

.txt ์‚ญ์ œํ•˜๊ธฐ!!

 

- java๋Š” ๊ฐ์ฒด์ง€ํ–ฅ ์–ธ์–ด

- class ๋‹จ์œ„๋กœ ๋ฉ”๋ชจ๋ฆฌ์— ์˜ฌ๋ผ๊ฐ„๋‹ค

- main๋ฉ”์†Œ๋“œ๋งŒ ์‹คํ–‰ํ•œ๋‹ค

- ํ•จ์ˆ˜๋Š” 4๊ฐ€์ง€๋กœ ๊ตฌ์„ฑ : ๋ฉ”์„œ๋“œ ์ด๋ฆ„, ์ž…๋ ฅ๊ฐ’, ์ฒ˜๋ฆฌ ๊ตฌ๋ฌธ, ์ถœ๋ ฅ๊ฐ’

- ๋ช…๋ น์–ด ๋งˆ์นจํ‘œ : ์„ธ๋ฏธ์ฝœ๋ก (;)

- public : ์ ‘๊ทผ์ œํ•œ์ž ๊ณต๊ฐœ!!

- static : cpu๊ฐ€ main๋ฉ”์†Œ๋“œ๋ฅผ ์ฐพ๊ธฐ ์‰ฝ๊ฒŒ ํ•˜๋Š”๊ฒƒ!

- void : ๋ฐ˜ํ™˜๊ฐ’์ด ์—†๋‹ค๋Š” ์˜๋ฏธ(return์ด ์—†์Œ)

 

# ๋ฉ”๋ชจ์žฅ ๊ฐœ๋ฐœ~
class Hello {
	public static void main(String[] args) {
		// ์ด๊ฒƒ์€ ํ•œ์ค„ ์ฃผ์„์ž…๋‹ˆ๋‹ค.
		System.out.println("Hello Seoul");
		/* ์ด๊ฒƒ์€
		    ์—ฌ๋Ÿฌ์ค„ ์ฃผ์„
		    ์ž…๋‹ˆ๋‹ค.
		*/
	}
}
// ์ฃผ์„์€ ์ œ์™ธํ•˜๊ณ  ์ปดํŒŒ์ผํ•œ๋‹ค(๋‚ ์งœ, ๋งŒ๋“  ๋ชฉ์ ,์„ค๋ช…์‹œ ์ฃผ์„ ์‚ฌ์šฉ)

javac Hello.java # cmd์—์„œ ์ปดํŒŒ์ผ ๋ช…๋ น์–ด
java Hello # Hello ๋ฉ”์„œ๋“œ ์‹คํ–‰

 

 

# Java ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๊ตฌ์„ฑ

 

- Eclipse ๊ตฌ์„ฑ

  • ์ž๋ฐ” ํ”„๋กœ๊ทธ๋žจ์„๊ฐœ๋ฐœํ•  ๋•Œ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” ํ†ตํ•ฉ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ(IDE)
  • JDK 21์„ ์ง€์›ํ•˜๋Š” Eclipse IDE 2023-12์ด์ƒ ๋ฒ„์ „ ์‚ฌ์šฉ 
  • [ctrl] + [s] (์ €์žฅ) ์„ ๋ˆ„๋ฅด๋ฉด ๋ฐ”๋กœ ์ปดํŒŒ์ผ๋œ๋‹ค!!

https://www.eclipse.org/downloads/

 

Eclipse Downloads | The Eclipse Foundation

The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 415 open source projects, including runtimes, tools and frameworks.

www.eclipse.org

 

jdk ์„ ํƒ์œผ๋กœ ๋ฐ”๊ฟ”์ฃผ๊ธฐ / UTF-8์œผ๋กœ ๋ฐ”๊ฟ”์ฃผ๊ธฐ(ํ•œ๊ธ€์ด ์•ˆ๊นจ์ ธ๋ณด์ž„)

 

 

# JVM ๋ฉ”๋ชจ๋ฆฌ ๊ตฌ์กฐ

 

 

Heap ์˜์—ญ : ๋ฌด์งˆ์„œํ•œ ๊ณต๊ฐ„ / ์ฐธ์กฐํ˜• ์นœ๊ตฌ๋“ค(string) 

Method ์˜์—ญ :  ๋ชจ๋“  ๊ฒฝ์šฐ์—์„œ๋“  ์ ‘๊ทผ ๊ฐ€๋Šฅํ•˜๋„๋ก..?(1์ธต ํ™”์žฅ์‹ค์€ ๋‹ค ์‚ฌ์šฉ ๊ฐ€๋Šฅ/ ๋‚ด ํ™”์žฅ์‹ค ๋ชป์“ด๋‹ค) 

Stack ์˜์—ญ : ๊ฐ’ํ˜• ๋ฐ์ดํ„ฐ๊ฐ€ ์Œ“์ž„(์ฑ… ์Œ“์ด๋“ฏ์ด - ์‚ฌ์ด์ฆˆ๊ฐ€ ๋ช…ํ™•ํ•ด์•ผํ•จ) / ๋ฐ์ดํ„ฐ๋ฅผ ๋บ„๋•Œ๋Š” (LIFO) 

Heap ์˜์—ญ: ๋™์ ์œผ๋กœ ํ• ๋‹น๋˜๋Š” ๋ฉ”๋ชจ๋ฆฌ๋กœ, ๋ฌด์งˆ์„œํ•˜๊ฒŒ(์ฆ‰, ์ผ์ •ํ•œ ์ˆœ์„œ ์—†์ด) ๋ฐ์ดํ„ฐ๊ฐ€ ์ €์žฅ๋˜๋Š” ๊ณต๊ฐ„์ด์—์š”. 
           ์ฃผ๋กœ ์ฐธ์กฐํ˜• ๋ฐ์ดํ„ฐ(์˜ˆ: ๊ฐ์ฒด)๊ฐ€ ํ• ๋‹น๋ฉ๋‹ˆ๋‹ค. ๋ง ๊ทธ๋Œ€๋กœ ๋ฌด์งˆ์„œํ•œ ๊ณต๊ฐ„์ด๋ผ, 
           ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ๋ฅผ ์ž˜ ํ•˜์ง€ ์•Š์œผ๋ฉด ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜(๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์ฐจ์ง€ํ•œ ์ฑ„ ๋ฐ˜ํ™˜๋˜์ง€ ์•Š๋Š” ์ƒํ™ฉ)๋„ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์–ด์š”.

Method ์˜์—ญ: ํ”„๋กœ๊ทธ๋žจ์ด ์‹คํ–‰๋  ๋•Œ ๋กœ๋“œ๋˜๋Š” ํด๋ž˜์Šค, ๋ฉ”์„œ๋“œ, ์ •์  ๋ณ€์ˆ˜ ๋“ฑ์ด ์ €์žฅ๋˜๋Š” ๊ณต๊ฐ„์ž…๋‹ˆ๋‹ค. 
            ๊ทธ๋ž˜์„œ ์–ด๋””์„œ๋“  ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๊ฒŒ ์ค€๋น„๋œ ๊ณต์šฉ ๊ณต๊ฐ„ ๊ฐ™์€ ๋Š๋‚Œ์ด์—์š”. 
            ์ด๊ณณ์—๋Š” ๊ณ ์ •๋œ ๋ฐ์ดํ„ฐ๊ฐ€ ์ฃผ๋กœ ์ €์žฅ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค๋ฅธ ์“ฐ๋ ˆ๋“œ์—์„œ๋„ ๋™์‹œ์— ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Stack ์˜์—ญ: ํ•จ์ˆ˜ ํ˜ธ์ถœ ์‹œ ํ• ๋‹น๋˜๋Š” ๋ฉ”๋ชจ๋ฆฌ๋กœ, ๊ฐ ํ˜ธ์ถœ๋งˆ๋‹ค ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ์Œ“์ด๊ณ (LIFO - ํ›„์ž…์„ ์ถœ ๊ตฌ์กฐ) ํ•จ์ˆ˜๊ฐ€ 
            ์ข…๋ฃŒ๋˜๋ฉด ํ•ด๋‹น ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ํ•ด์ œ๋ฉ๋‹ˆ๋‹ค. ๊ฐ„๋‹จํ•œ ๊ฐ’ํ˜• ๋ฐ์ดํ„ฐ(์˜ˆ: int, float)๊ฐ€ ์—ฌ๊ธฐ์— ์Œ“์ด๋Š”๋ฐ, 
            ๋ฐ์ดํ„ฐ์˜ ํฌ๊ธฐ๊ฐ€ ๋ช…ํ™•ํ•˜๊ฒŒ ์ •ํ•ด์ ธ ์žˆ์–ด์•ผ ํ•˜์ฃ .

 

 

public class Type01 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		short a1 = 10;
		int a2 = 20;
		int a3 = a1;
		short a4 = (short) a2; // ํฐ๊ฑฐ์—์„œ ์ž‘์€๊ฑธ๋กœ ๋„˜์–ด๊ฐ€๋ ค๋ฉด ๋ช…์‹œ์ ์œผ๋กœ ํ‘œ๊ธฐํ•ด์ค˜์•ผ error๊ฐ€ ๋‚˜์ง€ ์•Š๋Š”๋‹ค
		
		System.out.println(a1); 10
		System.out.println(a2); 20
		System.out.println(a3); 10
		System.out.println(a4); 20
	}
}

 

 

 

(ํ™”์š”์ผ)


# ๊ฐ’ํ˜• vs ์ฐธ์กฐํ˜•

package thisisjava;

public class Type02 {

	public static void main(String[] args) {
		// ๊ฐ’ํ˜•์€ ์ดˆ๊ธฐ๊ฐ’์„ ์„ค์ •ํ•ด์•ผ ์—๋Ÿฌ๊ฐ€ ์•ˆ๋‚จ..
		byte a1; a1 = 10;
		short a2 = 20;
		int a3 = 30;
		long a4 = 40;
		char a5 = 'A'; char a6 = '๊ฐ•';  // ์—ฌ๊ธฐ๊นŒ์ง€ ๊ฐ’ํ˜•(๊ทธ๋ฆ‡์ด ๋งŒ๋“ค์–ด์ง€๊ณ  ๊ฐ’์„ ๋„ฃ์Œ)
		String a7 = "์„œ์šธ"; // ์ฐธ์กฐํ˜•์€ ๋ฐ์ดํ„ฐ๊ฐ€ ๋งŒ๋“ค์–ด์ง€๊ณ  ๊ทธ๋ฆ‡์— ๋‹ด๋Š”๋‹ค(์ฃผ์†Œ๊ฐ€ ์Šคํƒ์— ๋“ค์–ด๊ฐ€์žˆ์Œ)
		
		System.out.println(a1);
		System.out.println(a2);
		System.out.println(a3);
		System.out.println(a4);
		System.out.println(a5);
		System.out.println((int)a5); // 65
		System.out.println((int)'a'); // 97
		System.out.println(a6);
		System.out.println(a7);
	}
}

 

 

 

# ์‹ค์ˆ˜ํ˜• & boolean ํƒ€์ž… 

package thisisjava;

public class Type03 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		float a1 = 3.14f; // float ํƒ€์ž…์ด๋ผ๊ณ  ๋ช…์‹œ ํ•ด์ค˜์•ผ ํ•œ๋‹ค!! / 4byte
		double a2 = 3.14; // 8byte
		System.out.println(a1);
		System.out.println(a2);
		
		boolean b1 = true;
		boolean b2 = 3 > 4;
		System.out.println(b1);
		System.out.println(b2);
	}
}

 

 

 

# 2์ง„์ˆ˜, 10์ง„์ˆ˜, 16์ง„์ˆ˜ ๋น„๊ตํ•˜๊ธฐ

package thisisjava;

public class Type04 {
	public static void main(String[] args) {
		char a1 = 'A';
		System.out.println(a1); 
		System.out.println((int)a1); // 65
		System.out.println(Integer.toBinaryString(a1));
		System.out.println(Integer.toOctalString(a1));
		System.out.println(Integer.toHexString(a1));
		
		char a2 = 65;
		System.out.println(a2); // A
		
		char a3 = 0101;
		System.out.println(a3); // A
		
		char a4 = 0x0041;
		System.out.println(a4); // A
	}
}

 

 

 

# string์˜ ์ฃผ์†Œ ๋ณ€ํ™˜ & \ ์‚ฌ์šฉ๋ฒ•

package thisisjava;

public class Type05 {

	public static void main(String[] args) {
		String s1 = null;
		System.out.println(s1);
		s1 = "์„œ์šธ";
		System.out.println(s1); // garbage collector๊ฐ€ ๋ฐ์ดํ„ฐ๋ฅผ ์น˜์›Œ์คŒ..
		s1 = null;
		System.out.println(s1);
		
		String s2 = "์‚ฌ๋ž‘";
		System.out.println(s2); 
		s2 = "์ฐ๋ "; // ๋ฐ์ดํ„ฐ์˜ ๊ฐ’์ด ์•„๋‹ˆ๋ผ ์ฃผ์†Œ๊ฐ€ ๋ฐ”๋€œ!! / ์‚ฌ๋ž‘์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ๋Š” gc๊ฐ€ ์น˜์›Œ์คŒ
		System.out.println(s2);
		
		String s3 = "'์‚ฌ๋ž‘'ํ•ฉ๋‹ˆ๋‹ค.";
		s3 = "\"์‚ฌ๋ž‘\"ํ•ฉ๋‹ˆ๋‹ค."; // ํฐ๋”ฐ์˜ดํ‘œ ์•ˆ์— ํฐ๋”ฐ์˜ดํ‘œ ๋„ฃ๊ณ  ์‹ถ์œผ๋ฉด \ ์‚ฌ์šฉ!!
		s3 = "2024๋…„ 11์›” 12์ผ. \n"
				+ "๋‚ ์”จ๊ฐ€ ์ข‹์•„์š” \n๊ทธ๋ž˜์„œ, "
				+ "๋ง›์žˆ๋Š” ์ ์‹ฌ์„ ๋จน๊ณ ์‹ถ์–ด์š”";
		System.out.println(s3);
		
		System.out.print("์•ˆ๋…•");  
		System.out.print("ํ•˜์„ธ์š”");  
		
	}
}

 

 

 

 

# ๊ฐ’ํ˜• -> ์ฐธ์กฐํ˜• ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜

package thisisjava;

public class Type06 {

	public static void main(String[] args) {
		// ๊ฐ’ํ˜• ์•ˆ์—์„œ์˜ ํ˜•๋ณ€ํ™˜์€ ์‚ฌ์ด์ฆˆ ๋ณ€ํ™˜๋งŒ ๊ฐ€๋Šฅ!(์Šคํƒ ์•ˆ์—์„œ์˜ ์œ„์•„๋ž˜๋งŒ ๋ณ€ํ™˜)
		short a1 = 10;
		int a2 = a1; // ์ž๋™ ํ˜•๋ณ€ํ™˜
		System.out.println(a2);
		
		short a3 = (short) a2; // ๊ฐ•์ œ ํ˜•๋ณ€ํ™˜
		System.out.println(a3);
		
		// ๊ฐ’ํ˜•์—์„œ ์ฐธ์กฐํ˜•์œผ๋กœ ๋ฐ”๊ฟ”์ค„๋•Œ๋Š” ์ž๋ฐ” ๋ฌธ๋ฒ•์ด ํ•„์š”ํ•˜๋‹ค
		int a4 = 20;
		String s4 = String.valueOf(a4); // ๋ฐ์ดํ„ฐ๋งŒ ์ด์ „ํ•˜๊ณ  ์ฃผ์†Œ๋งŒ a4๋กœ ๋„˜๊น€
		System.out.println(a4);
		
		// ์ฐธ์กฐํ˜•์—์„œ ๊ฐ’ํ˜•์œผ๋กœ 
		String s5 = "30";
		int a5 = Integer.parseInt(s5);
		System.out.println(a5);
	}
}

 

๊ฐ’ํ˜•์—์„œ ์ฐธ์กฐํ˜•์œผ๋กœ ๋ฐ”๊ฟ€๋•Œ์˜ ๋ฉ”๋ชจ๋ฆฌ ๊ตฌ์กฐ!

 

 

๋”๋ณด๊ธฐ

 String.valueOf()์™€ + ""๋Š” ๋‘˜ ๋‹ค ๊ฐ’์„ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด์ง€๋งŒ, ์ผ๋ฐ˜์ ์œผ๋กœ String.valueOf()๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋” ๊ถŒ์žฅ๋ฉ๋‹ˆ๋‹ค. ๊ทธ ์ด์œ ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:

  1. ์˜๋„๋ฅผ ๋ช…ํ™•ํ•˜๊ฒŒ ํ‘œํ˜„: String.valueOf()๋Š” ํ•ด๋‹น ๊ฐ’์„ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋ ค๋Š” ์˜๋„๋ฅผ ๋” ๋ช…ํ™•ํ•˜๊ฒŒ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ๋ฐ˜๋ฉด + ""๋Š” ๋ง์…ˆ ์—ฐ์‚ฐ์ž๋กœ ๋ณด์—ฌ์งˆ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ฝ”๋“œ๋ฅผ ์ฝ๋Š” ์‚ฌ๋žŒ์ด ์˜๋„๋ฅผ ์ดํ•ดํ•˜๋Š” ๋ฐ ๋” ์‹œ๊ฐ„์ด ๊ฑธ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. ์„ฑ๋Šฅ: + ""๋Š” ๋‚ด๋ถ€์ ์œผ๋กœ StringBuilder๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ๊ฐ’์„ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๊ณ  ๋ง์…ˆ์„ ์ˆ˜ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, String.valueOf()๋ณด๋‹ค ์•ฝ๊ฐ„ ๋” ๋น„ํšจ์œจ์ ์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. String.valueOf()๋Š” ์ง์ ‘ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋ฏ€๋กœ ์„ฑ๋Šฅ ๋ฉด์—์„œ ๋” ๋‚˜์€ ์„ ํƒ์ž…๋‹ˆ๋‹ค.
  3. Null ๊ฐ’ ์ฒ˜๋ฆฌ: String.valueOf()๋Š” ์ธ์ž๋กœ null์ด ๋“ค์–ด์˜ค๋ฉด ๋ฌธ์ž์—ด "null"๋กœ ๋ฐ˜ํ™˜ํ•˜์ง€๋งŒ, + ""๋Š” NullPointerException์„ ๋ฐœ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฆ‰, String.valueOf()๊ฐ€ ๋” ์•ˆ์ „ํ•ฉ๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•ด์•ผ ํ•  ๋•Œ๋Š” String.valueOf()๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

 

# ์ถœ๋ ฅ ๋ฐฉ์‹์— ๋”ฐ๋ผ println vs printf()

  • println(๋‚ด์šฉ) : ๊ด„ํ˜ธ ์•ˆ์˜ ๋‚ด์šฉ์„ ์ถœ๋ ฅํ•˜๊ณ  ํ–‰์„ ๋ฐ”๊ฟ”๋ผ
  • print(๋‚ด์šฉ) : ๊ด„ํ˜ธ ์•ˆ์˜ ๋‚ด์šฉ์„ ์ถœ๋ ฅํ•˜๊ณ  ํ–‰์€ ๋ฐ”๊พธ์ง€ ๋งˆ๋ผ
  • printf("ํ˜•์‹๋ฌธ์ž์—ด", ๊ฐ’1, ๊ฐ’2....) : ํ˜•์‹์— ๋งž์ถฐ์„œ ์ถœ๋ ฅํ•ด๋ผ(ํ–‰์€ ๋ฐ”๊พธ์ง€ ์•Š์Œ)
package thisisjava;

public class Type07 {

    public static void main(String[] args) {
        // ๋™์ผํ•œ ๋ฐ์ดํ„ฐ ํƒ€์ž…์œผ๋กœ ๋ณ€์ˆ˜๋ฅผ ๋‚˜์—ดํ• ๋•Œ๋Š” ์‰ผํ‘œ๋กœ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค
        String s1 = "apple", s2 = "ํฌ๋„"; 
        int a1 = 500, a2 = 700;

        System.out.println(s1 + " ๊ฐ€๊ฒฉ์€ " + a1 + "์›์ด๋‹ค.");
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %d์›์ด๋‹ค.\n", s1, a1); 
        
        System.out.println(s2 + " ๊ฐ€๊ฒฉ์€ " + a2 + "์›์ด๋‹ค.");
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %d์›์ด๋‹ค.\n", s2, a2);  

        String s3 = "๋”ธ๊ธฐ", s4 = "์ˆ˜๋ฐ•";
        float a3 = 900.99f;
        double a4 = 3333.33;

        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %.2f์›์ด๋‹ค.\n", s3, a3);  
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %.2f์›์ด๋‹ค.\n", s4, a4); 
        
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %d์›์ด๋‹ค.\n", "๊ณผ์ผ", 45678); 
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %10d์›์ด๋‹ค.\n", "๊ณผ์ผ", 45678); 
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %-10d์›์ด๋‹ค.\n", "๊ณผ์ผ", 45678); 
 
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %f์›์ด๋‹ค.\n", "๊ณผ์ผ", 123.45); 
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %5f์›์ด๋‹ค.\n", "๊ณผ์ผ", 123.45); 
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %.2f์›์ด๋‹ค.\n", "๊ณผ์ผ", 123.45); 
        System.out.printf("%s ๊ฐ€๊ฒฉ์€ %5.2f์›์ด๋‹ค.\n", "๊ณผ์ผ", 123.45); 

        System.out.printf("%s๋Š” ๊ณผ์ผ์ด๋‹ค.\n", "์‚ฌ๊ณผ"); 
        System.out.printf("%5s๋Š” ๊ณผ์ผ์ด๋‹ค.\n", "์‚ฌ๊ณผ"); // 5์นธ์—์„œ ์šฐ์ธก๋ถ€ํ„ฐ ์ฑ„์›€
        System.out.printf("%-5s๋Š” ๊ณผ์ผ์ด๋‹ค.\n", "์‚ฌ๊ณผ"); // 5์นธ์—์„œ ์ขŒ์ธก๋ถ€ํ„ฐ ์ฑ„์›€
    }
}

 

 

 

# Scanner(ํ‚ค๋ณด๋“œ ์ž…๋ ฅ)

package thisisjava;

import java.util.Scanner;

public class Type08 {

	public static void main(String[] args) {
		System.out.println("์ด๋ฆ„ ์ž…๋ ฅ=>");
		Scanner sc = new Scanner(System.in);
		// ๋นจ๊ฐ„์ค„ Click(import ~)
		// ์ง์ ‘ ์ž‘์„ฑ(import ๋ฌธ์žฅ)
		// Ctrl + Shift + o(์˜๋ฌธ)
		String name = sc.next();
		System.out.print(name + "๋‹˜, ์•ˆ๋…•ํ•˜์„ธ์š”");
		sc.close();
	}
}

 

 

# ์‚ฐ์ˆ  ์—ฐ์‚ฐ์ž

 

- ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ : ํƒ€์ž…์ด ํ—ˆ์šฉํ•˜๋Š” ์ตœ๋Œ€๊ฐ’์„ ๋ฒ—์–ด๋‚˜๋Š” ๊ฒƒ(์˜ˆ๋ฅผ ๋“ค์–ด, short์˜ ์ตœ๋Œ“๊ฐ’์ด 127์— 1์„ ๋”ํ•˜๋ฉด 128์ด ๋˜์–ด ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฏ€๋กœ ์—ฐ์‚ฐ๊ฒฐ๊ณผ๋Š” ์ตœ์†Œ๊ฐ’์ธ -128์ด ๋œ๋‹ค!!)

- ์–ธ๋”ํ”Œ๋กœ์šฐ : ํƒ€์ž…์ด ํ—ˆ์šฉํ•˜๋Š” ์ตœ์†Œ๊ฐ’์„ ๋ฒ—์–ด๋‚˜๋Š” ๊ฒƒ

package thisisjava;

public class Op01 {

	public static void main(String[] args) {
		
		int i1 = 20, i2 = 10;
		
		System.out.println(i1+i2); // ์‚ฐ์ˆ ์—ฐ์‚ฐ์ž
		System.out.println(i1-i2);
		System.out.println(i1*i2);
		System.out.println(i1/i2);
		System.out.println(i1%i2);
		
		String s1 = "30", s2 = "40"; 
		System.out.println(s1+s2); // ์—ฐ๊ฒฐ์—ฐ์‚ฐ์ž
		
		int i3 = Integer.parseInt(s1) + Integer.parseInt(s2); // Quiz
		
		System.out.println(i3); // 70
		
		int i4 = 100;
		i4 = i4 + 2; 
		System.out.println(i4);
		
		i4 += 2; 
		System.out.println(i4);
		
		i4 *= 2; 
		System.out.println(i4);
		
		i4 /= 2; 
		System.out.println(i4);
		
		byte b1 = 127;
		//b1 = b1 + 1;
		System.out.println(b1+1); // 128
		b1 += 1;
		System.out.println(b1); // -128(์˜ค๋ฒ„ ํ”Œ๋กœ์šฐ)
		System.out.println(b1+1);
		
	}

}
3 0 1 1
2 0 1 0
1 0 0 1
0 0 0 0
-1 1 1 1
-2 1 1 0
-3 1 0 1
-4 1 0 0

< ์ง„๋ฒ•์˜ ์Œ์ˆ˜ & ์–‘์ˆ˜ / ์ œ์ผ ์•ž์ž๋ฆฌ : ๋ถ€ํ˜ธ ๋น„ํŠธ(0์ด๋ฉด ์–‘์ˆ˜, 1์ด๋ฉด ์Œ์ˆ˜) >

 

 

 

# ๋‚˜๋ˆ—์…ˆ์—ฐ์‚ฐ์—์„œ ์˜ˆ์™ธ ๋ฐฉ์ง€ํ•˜๊ธฐ

  • ๋‚˜๋ˆ—์…ˆ(/) ๋˜๋Š” ๋‚˜๋จธ์ง€(%)์—ฐ์‚ฌ์—์„œ ์ขŒ์ธก ํ”ผ์—ฐ์‚ฐ์ž๊ฐ€ ์ •์ˆ˜์ด๊ณ  ์šฐ์ธก ํ”ผ์—ฐ์‚ฐ์ž๊ฐ€ 0์ผ ๊ฒฝ์šฐ ArithmeticException๋ฐœ์ƒ
  • ์ขŒ์ธก ํ”ผ์—ฐ์‚ฐ์ž๊ฐ€ ์‹ค์ˆ˜์ด๊ฑฐ๋‚˜ ์œผ์ธก ํ”ผ์—ฐ์‚ฐ์ž๊ฐ€ 0.0๋˜๋Š” 0.0f์ด๋ฉด ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๋‹ค
System.out.println(5/0.0); // Infinity
System.out.println(5%0.0); // NaN

 

 

 

# ์ฆ๊ฐ์—ฐ์‚ฐ์ž

- ์ „์น˜์ฆ๊ฐ์—ฐ์‚ฐ์ž : ++a

- ํ›„์น˜์ฆ๊ฐ์—ฐ์‚ฐ์ž : a--

package thisisjava;

public class Op02 {

	public static void main(String[] args) {
		// ++ , --
		int a = 10;
		int b = --a;
		System.out.println(a); // 9
		System.out.println(b); // 9
		
		int c = a--;
		System.out.println(a); // 8
		System.out.println(c); // 9

		int d = ++a;
		System.out.println(a); // 9
		System.out.println(d); // 9
		
		int e = a++;
		System.out.println(a); // 10
		System.out.println(e); // 9
	}

}

 

 

 

# ๋…ผ๋ฆฌ ์—ฐ์‚ฐ์ž && ๋น„ํŠธ๋…ผ๋ฆฌ์—ฐ์‚ฐ์ž

 

package thisisjava;

public class Op03 {

	public static void main(String[] args) {
		int i = 4, j = 3;
		System.out.println(i==j); // ๋น„๊ต์—ฐ์‚ฐ์ž
		System.out.println(i>j);
		System.out.println(i!=j);
		
		System.out.println(true&&true);
		System.out.println(true&&false);
		System.out.println(true&true);
		System.out.println(true&false);
		
		System.out.println(false&&true);
		System.out.println(false&&false);
		System.out.println(false&true);
		System.out.println(false&false);
		
		System.out.println(true||true);
		System.out.println(true||false);
		System.out.println(false||true);
		System.out.println(false||false);
		
		System.out.println("------");
//		System.out.println(6&&4);//๋…ผ๋ฆฌ์—ฐ์‚ฐ์ž (๋ถˆ๋ฆฌ์–ธ ํƒ€์ž…์œผ๋กœ๋งŒ ์™€์•ผํ•จ)
		System.out.println(6&4);//๋น„ํŠธ๋…ผ๋ฆฌ์—ฐ์‚ฐ์ž (์ด์ง„์ˆ˜๋กœ ๋ฐ”๊พธ๊ณ  ๋น„๊ต!)
//		System.out.println(6||3);//๋…ผ๋ฆฌ์—ฐ์‚ฐ์ž
		System.out.println(6|3);//๋น„ํŠธ๋…ผ๋ฆฌ์—ฐ์‚ฐ์ž	
		
		int k = 8; // 1000(2)
		System.out.println(k >> 1); // 100(2) 
		System.out.println(k << 1); // 100000(2)
	}
}




package thisisjava;
public class Op04 {
	public static void main(String[] args) {
		int a = 7, b = 3;
		System.out.println((a==b)&&(a>b++));//false
		System.out.println(b);//3
		
		System.out.println((a==b)&(a>b++));//false
		System.out.println(b);;//4
		
		System.out.println((a!=b)||(a>b++));//true
		System.out.println(b);;//4
		
		System.out.println((a!=b)|(a>b++));//true
		System.out.println(b);;//5

	}

}

 

 

 

(์ˆ˜์š”์ผ)

 
 

# ์‚ผํ•ญ ์—ฐ์‚ฐ์ž

 

- ์ด 3๊ฐœ์˜ ํ”ผ์—ฐ์‚ฐ์ž๋ฅผ๊ฐ€์ง

- ? ์•ž์˜ ํ”ผ์—ฐ์‚ฐ์ž๋Š” boolean ๋ณ€์ˆ˜ ๋˜๋Š” ์กฐ๊ฑด์‹์ด ์ฐธ์ด๋ฉด : ๋’ค์— ์•ž์— ๊ฒƒ์„ ์„ ํƒํ•˜๊ณ  ๊ฑฐ์ง“์ด๋ฉด ๋’ค์— ๊ฒƒ์„ ์„ ํƒ 

package ch03.sec11;

import java.util.Scanner;

public class ConditionalOperationExample {
	public static void main(String[] args) {
//		int score = 85;
//		char grade = (score > 90) ? 'A' : ( (score > 80) ? 'B' : 'C' );
//		System.out.println(score + "์ ์€ " + grade + "๋“ฑ๊ธ‰์ž…๋‹ˆ๋‹ค.");
		
		/* 90์ ์ด์ƒ์ด๋ฉด, ์šฐ์ˆ˜
		 * 80์ ์ด์ƒ์ด๋ฉด, ๋ณดํ†ต
		 * 80์ ๋ฏธ๋งŒ์ด๋ฉด, ๋ถ€์กฑ
		*/
		System.out.print("์ž์‹ ์˜ ์ ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์‹œ์˜ค => ");
		Scanner sc = new Scanner(System.in);
		int score = sc.nextInt();
		
		String grade = ((score >= 90) ? "์šฐ์ˆ˜" :
			((score >= 80) ? "๋ณดํ†ต" :
				((score >= 70) ? "๋ถ€์กฑ" : "๋‚™์ œ")));
		System.out.printf("Score๋Š” %d์ , %s", score, grade);
		sc.close();
	}
}




package ch03.sec11;

public class ConditionalOperationExample {
	public static void main(String[] args) {
		int score = 85;
		char grade = (score > 90) ? 'A' : ( (score > 80) ? 'B' : 'C' );
		System.out.println(score + "์ ์€ " + grade + "๋“ฑ๊ธ‰์ž…๋‹ˆ๋‹ค.");
	}
}

 

 

 

# if - else (์กฐ๊ฑด๋ฌธ)

package thisisjava;

import java.util.Scanner;

public class if01 {

	public static void main(String[] args) {
		// ์กฐ๊ฑด์‹ ? true : false
		System.out.print("์ˆซ์ž๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š” => ");
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String ans = null;
		
		if((n % 2) == 0) {
			ans = "์ง์ˆ˜"; 
		} else {			
			ans = "ํ™€์ˆ˜"; 
		}
		
		System.out.println(ans);
		sc.close();
	}
}


package thisisjava;

import java.util.Scanner;

public class if02 {

	public static void main(String[] args) {
		System.out.print("์ ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š” => ");
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String score = null;
		
		if(n >= 90) { score = "์šฐ์ˆ˜"; }
		else if(n >= 80) { score = "๋ณดํ†ต"; }
		else if(n >= 70) { score = "๋ถ€์กฑ"; }
		else { score = "๋‚™์ œ"; }
		
		System.out.printf("์ œ์ ์ˆ˜๋Š” %d์ด๊ณ , %s์ž…๋‹ˆ๋‹ค", n, score);
		sc.close();

	}
}

 

 

 

# switch - case ๋ฌธ

package thisisjava;

import java.util.Scanner;

public class switch01 {

	private static final int case1 = 0;

	public static void main(String[] args) {
		// ์กฐ๊ฑด์‹ ? true : false
		System.out.print("์ˆซ์ž๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š” => ");
		Scanner sc = new Scanner(System.in);
		int n = (sc.nextInt() % 2);
		sc.close();
		
		String ans = null;
		
		switch (n) {
			case 0: ans = "์ง์ˆ˜";
				break; // ๋น ์ ธ ๋‚˜๊ฐ€์ฃผ์ง€ ์•Š์œผ๋ฉด ๋‹ค ๊ธฐํƒ€๋กœ ๋น ์ง....
			case 1: ans = "ํ™€์ˆ˜";
				break;
			default: ans = "๊ธฐํƒ€";
		}
		
		System.out.println(ans);
	}

}

 

 

#  ==๊ณผ .equals()์˜ ์ฐจ์ด

 

package thisisjava;

import java.util.Scanner;

public class str01 {

	public static void main(String[] args) {
		int i1 = 20, i2 = 10, i3 = 20;
		System.out.println(i1 == i2);
		System.out.println(i1 == i3);
		
		// s1 : KR์„ ๋จผ์ € ๋งŒ๋“ค๊ณ  ์ฃผ์†Œ ํ• ๋‹นํ•˜๊ณ  / s2 : ์ด๋ฏธ KR์ด ์žˆ์œผ๋ฏ€๋กœ ๊ฐ™์€ ์ฃผ์†Œ๊ฐ€ ๋“ค์–ด๊ฐ
		String s1 = "KR", s2 = "KR";
//		String s3 = new String("KR");
		System.out.println(s1 == s2);
//		System.out.println(s1 == s3);
		System.out.println(s1.equals(s2));
		
		// ์™ธ๋ถ€์—์„œ ์ž…๋ ฅ๋ฐ›์•˜์„ ๊ฒฝ์šฐ..
		// ์–ด๋–ค ๋ฐ์ดํ„ฐ๊ฐ€ ์˜ฌ์ง€ ๋ชฐ๋ผ์„œ ์ผ๋‹จ ์ฃผ์†Œ๋ฅผ ๋„ฃ๊ณ  KR์ด ๋“ค์–ด๊ฐ!! ๊ทธ๋ž˜์„œ ํ‚ค๋ณด๋“œ๋กœ ์ž…๋ ฅ๋ฐ›์€๊ฒƒ์€ 
		// ์ด๋ฏธ heap์— ์ €์žฅ๋˜์–ด ์žˆ๋Š” ๊ฐ’์ด๋”๋ผ๋„ ์ฃผ์†Œ๊ฐ€ ๋‹ค๋ฅผ ์ˆ˜ ๋ฐ–์— ์—†๋‹ค 
		System.out.println("KR ์ž…๋ ฅ =>");
		Scanner sc = new Scanner(System.in);
		String s3 = sc.next();
		sc.close();
		
		System.out.println(s1 == s3);
		System.out.println(s1.equals(s3));
	}
}

ํ‚ค๋ณด๋“œ๋กœ ์ž…๋ ฅ๋ฐ›์•˜์„๋•Œ ๊ฐ’์ด ๊ฐ™๋”๋ผ๋„ ==์ด false๊ฐ€ ๋‚˜์˜ค๋Š”์ด์œ 

 

 

 

# ํ™”์‚ดํ‘œ ์ฒ˜๋ฆฌ (jdk12๋ฒ„์ „ ๋ถ€ํ„ฐ ์žˆ์—ˆ๋‹น)

package thisisjava;

import java.util.Scanner;

public class switch03 {

	public static void main(String[] args) {
		System.out.println("์˜์–ด๋ฅผ ์•Œ๋ ค์ค˜ ๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡");
		Scanner sc = new Scanner(System.in);
		String direction = sc.next();
		String eng;
		sc.close();
		
		switch(direction) {
			case "๋™" -> eng = "East";
			case "์„œ" -> eng = "West"; 
			case "๋‚จ" -> eng = "South"; 
			case "๋ถ" -> eng = "North"; 
			default -> eng = "๊ธฐํƒ€"; 
		}
		
		System.out.printf("%s์— ๋Œ€ํ•œ ์˜์–ด ๋‹จ์–ด๋Š” %s์ž…๋‹ˆ๋‹ค :)", direction, eng);
	}
}


package thisisjava;

import java.util.Scanner;

public class switch04 {

	public static void main(String[] args) {
		System.out.println("์˜์–ด๋ฅผ ์•Œ๋ ค์ค˜ ๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡");
		Scanner sc = new Scanner(System.in);
		String direction = sc.next();
		sc.close();
		
		String eng = switch(direction) {
			case "๋™", "๋™์ชฝ", "๋™๋…" -> "East";
			case "์„œ" -> "West"; 
			case "๋‚จ" -> {
				String result = "South" + "๋ฐฉํ–ฅ";
				yield result;  // switch ํ‘œํ˜„์‹์˜ ๋ฐ˜ํ™˜ ๊ฐ’์„ ์ง€์ •ํ•  ๋•Œ ์‚ฌ์šฉ
			}
			case "๋ถ" -> "North"; 
			default -> "๊ธฐํƒ€"; 
		};
		
		System.out.printf("%s์— ๋Œ€ํ•œ ์˜์–ด ๋‹จ์–ด๋Š” %s์ž…๋‹ˆ๋‹ค :)", direction, eng);
	}
}

 

 

(๋ชฉ์š”์ผ)


# ๊ฐ€์œ„๋ฐ”์œ„๋ณด ๊ฒŒ์ž„!!

 

package thisisjava;

import java.util.Scanner;

public class if07 {

	public static void main(String[] args) {

		int num = (int)(Math.random()*3); // ์ƒ๋Œ€ ๋žœ๋ค

		String sRan; // ์ƒ๋Œ€๊บผ ์ €์žฅ
		if(num== 0) { sRan= "๊ฐ€์œ„"; }
		else if (num == 1) { sRan= "๋ฐ”์œ„"; }
		else { sRan= "๋ณด"; }		
		
		System.out.println("๊ฐ€์œ„/๋ฐ”์œ„/๋ณด ์ž…๋ ฅ => ");
		Scanner sc = new Scanner(System.in);  // ๋‚ด๊บผ ์ž…๋ ฅ
		String sMe= sc.next(); // ๋‚ด๊บผ ์ €์žฅ
		
		// ๋น„๊ธฐ๋Š” ๊ฒฝ์šฐ (๊ฐ€์œ„-๊ฐ€์œ„, ๋ฐ”์œ„-๋ฐ”์œ„, ๋ณด-๋ณด)
		if(sMe.equals("๊ฐ€์œ„") || sMe.equals("๋ฐ”์œ„") || sMe.equals("๋ณด")) {
//			while(sMe.equals("๊ฐ€์œ„") || sMe.equals("๋ฐ”์œ„") || sMe.equals("๋ณด")) {
			System.out.printf("๋‚˜ : %s, ์ƒ๋Œ€ : %s \n",sMe,sRan);
			if(sMe.equals(sRan)) { System.out.println("๋น„๊น€");}
			// ์ด๊ธฐ๋Š” ๊ฒฝ์šฐ (๊ฐ€์œ„-๋ณด || ๋ฐ”์œ„-๊ฐ€์œ„ || ๋ณด-๋ฐ”์œ„)
			else if(    (sMe.equals("๊ฐ€์œ„") && sRan.equals("๋ณด"))
					|| (sMe.equals("๋ฐ”์œ„") && sRan.equals("๊ฐ€์œ„"))
					|| (sMe.equals("๋ณด") && sRan.equals("๋ฐ”์œ„"))
					){
				System.out.println("์ด๊น€");
			}
			// ์ง€๋Š” ๊ฒฝ์šฐ
			else { System.out.println("์กŒ์Œ"); }			
		}
		else {
			System.out.println("์ž˜๋ชป์ž…๋ ฅํ•˜์˜€์Šต๋‹ˆ๋‹ค (Tใ…กT)");
		}
	}
}

 

 

 

# ๊ฐ•์‚ฌ๋‹˜ ๋ฌธ์ œ

package thisisjava;

import java.util.Scanner;

public class if08 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("๊ตญ์–ด ์ ์ˆ˜ ์ž…๋ ฅ => ");
		int iKr = sc.nextInt();
		System.out.println("์˜์–ด ์ ์ˆ˜ ์ž…๋ ฅ => ");
		int iEn = sc.nextInt();
		sc.close();
		
		int iTotal = iKr + iEn;
		double dAvg = iTotal / 2.0; // int๋กœ ๊ณ„์‚ฐํ•œ๋’ค ์ €์žฅํ•˜๊ธฐ ๋•Œ๋ฌธ์— 2๋ฅผ double์ธ 2.0์œผ๋กœ ๋ฐ”๊ฟ”์คŒ
		System.out.printf("์ด์  : %d, ํ‰๊ท  : %.2f \n", iTotal, dAvg);
		
		if(iKr < 60 || iEn < 60) {
			System.out.println("๊ณผ๋ชฉ๋‚™์ œ ์ž…๋‹ˆ๋‹ค FFF");
		}
		else {
			if(dAvg >= 90) {
				System.out.println("์šฐ์ˆ˜");
			} else if(dAvg >= 80) {
				System.out.println("๋ณดํ†ต");
			} else if(dAvg >= 70) {
				System.out.println("๋ถ€์กฑ");
			} else {
				System.out.println("ํ‰๊ท ๋‚™์ œ");
			}
		}
	}

}

 

 

https://www.w3schools.com/

 

W3Schools.com

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

www.w3schools.com

๊ณต๋ถ€ํ•˜๊ธฐ ์ข‹์€ url

 

 

# ๋ฐ˜๋ณต๋ฌธ 3๊ฐ€์ง€!! (for / while / do-while)

 

package thisisjava;

public class for01 {

	public static void main(String[] args) {
		// 1 ~ 5 ๊นŒ์ง€ ๊ฐ€๋กœ๋ฐฉํ–ฅ ์ถœ๋ ฅ
		// ์‹œ์ž‘์  : int i = 1 / ๋์  : i <= 5 / ์Šคํ… : 1์”ฉ ์ฆ๊ฐ€ : i++ / ์ฒ˜๋ฆฌ : ๊ฐ€๋กœ ๋ฐฉํ–ฅ ์ถœ๋ ฅ (syout) 
		
		/*
		 for๋ฌธ์˜ ๊ตฌ์กฐ
		 for(์‹œ์ž‘์ ; ๋์ ; ์Šคํ…;) {
		 	์ฒ˜๋ฆฌ;
		 }
		 */
		
		for(int i = 5; i >= 1; i--) {
			System.out.print(i + " ");
		}
		
		
		/*
		 while๋ฌธ์˜ ๊ตฌ์กฐ
		 ์‹œ์ž‘์ ;
		 while(๋์ ) {
		 	์ฒ˜๋ฆฌ;
		 	์Šคํ…;
		 }
		 */
		int z = 5;
		while(z >= 1) {
			System.out.print(z + " ");
			z--;
		}
		
		
		/*
		 do - while๋ฌธ์˜ ๊ตฌ์กฐ
		 ์‹œ์ž‘์ ;
		 do {
		 	์ฒ˜๋ฆฌ;
		 	์Šคํƒญ;
		 }while (๋์ );
		 */
		
		int y = 5;
		do {
			System.out.print(y + " ");
			y--;
		}
		while(y >= 1);
		
	}
}

 

 

# ์˜ˆ์™ธ์ฒ˜๋ฆฌ

 

package thisisjava;

import java.util.InputMismatchException;
import java.util.Scanner;

public class try01 {

	public static void main(String[] args) {
		System.out.print("์ˆซ์ž ํ•˜๋‚˜ ์ž…๋ ฅ => ");
		Scanner sc = new Scanner(System.in);
		
		try {
			int i1 = sc.nextInt();
			int i2 = 100/i1;
			System.out.println(i2);			
		} catch(ArithmeticException e) {
			System.out.println("0์€ ์•ˆ๋˜์š”");
			System.out.println(e);
		} catch(InputMismatchException e) {
			System.out.println("๋ฌธ์ž๋Š” ์•ˆ๋˜์š”");
			System.out.println(e);
		}
		sc.close();
	}
}

 

 

(๊ธˆ์š”์ผ)

 

# array ๊ธฐ์ดˆ

package thisisjava;

public class arr01 {

	public static void main(String[] args) {
		int i1 = 10;
		int i2 = 20;
		int i3 = 30;
		int i4 = 40;
	
		int[] iArr1 = {10, 20, 30, 40};
		
		
		for(int i = 0; i < iArr1.length; i++) {
			System.out.println(iArr1[i]);
		}
		System.out.println();
		
		// sArr1 ์„ธ๋กœ๋ฐฉํ–ฅ ์ถœ๋ ฅ
		String[] sArr1 = {"์‚ฌ๊ณผ", "๋ฐฐ", "๋ฐ”๋‚˜๋‚˜"};
		for(int i = 0; i < sArr1.length; i++) {
			System.out.println(sArr1[i]);
		}
	}
}

package thisisjava;

import java.util.Arrays;

public class arr02 {

	public static void main(String[] args) {
		int i1 = 100, i2 = 200;
		
		int[] iArr1 = {10, 20, 30, 40};
		// ๋‹ค๋ฅธ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์“ฐ๋Š” ์ด์œ  : ๊ตฌ์กฐ๋ฅผ ๋งŒ๋“ค๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ๋Š” ๊ฒƒ์ด๋ฏ€๋กœ ๊ฐ™์€ ๊ฐ’์ด๋”๋ผ๋„ ์ฃผ์†Œ๊ฐ’์ด ๋‹ค๋ฅด๋‹ค
        /*
        ์ƒˆ๋กœ์šด ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„์— ๊ตฌ์กฐ(๋ฐฐ์—ด ๊ฐ์ฒด)๋ฅผ ํ• ๋‹นํ•˜๊ณ  ๊ทธ ์•ˆ์— ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ๋Š” ๋ฐฉ์‹์œผ๋กœ ๋™์ž‘ํ•˜๋ฏ€๋กœ, 
         ๊ฐ™์€ ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด๊ฐ€๋”๋ผ๋„ ๊ฐ์ฒด๋งˆ๋‹ค ๋ณ„๊ฐœ์˜ ๋ฉ”๋ชจ๋ฆฌ ์ฃผ์†Œ๋ฅผ ๊ฐ€์ง€๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. 
         */
		int iArr2[] = {10, 20, 30, 40}; 
		if(Arrays.equals(iArr1, iArr2)) {
			System.out.println("g");
		}
		
		// new๋ฅผ ๋ณด๋ฉด heap ๊ณต๊ฐ„์— ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ๊ธฐ ์œ„ํ•ด ํ™•๋ณดํ•œ๋‹ค๋Š” ์˜๋ฏธ
		int[] iArr3 = new int[4]; 
		
		iArr3[0] = 11; iArr3[1] = 22; 
		iArr3[2] = 33; iArr3[3] = 44; 
		
		for(int i = 0; i < iArr3.length; i++) {
			System.out.println(iArr3[i]);
		}
	}
}

 

 

 

# ํ–ฅ์ƒ๋œ for ๋ฌธ

 

package thisisjava;

public class arr04 {

	public static void main(String[] args) {
		int[] iArr1 = {10, 20, 30, 40, 50};
		
		// ๋ฐฉ๋ฒˆํ˜ธ ๋ถ™์—ฌ์„œ ๊ฐ€์ง€๊ณ  ์˜ฌ๋ž˜
		for(int i = 0; i < iArr1.length; i++) {
			 System.out.print(iArr1[i] + " ");
		}
		
		System.out.println();
		
		// ๋ฐฉ๊ฐ’ ๋ณต์‚ฌํ•ด์„œ ๊ฐ€์ง€๊ณ  ์˜ฌ๋ž˜..
		for(int iA : iArr1) {
			System.out.print(iA + " ");
		}
	}
}

 

 

# String๊ณผ String[]์˜ ๋ฉ”๋ชจ๋ฆฌ ๊ตฌ์กฐ ์ดํ•ด!!!

 

 

#  null & nullPointerException

 

package thisisjava;

public class arr06 {

	public static void main(String[] args) {
		// ์‚ฌ๊ณผ, ๋ฐฐ, ๋ฐ”๋‚˜๋‚˜๊ฐ€ ๋“ค์–ด๊ฐ€๋Š” ๋นˆ STring ๋ฐฐ์—ด 3์นธ ๊ตฌ์„ฑ
		String[] fruits =  new String[3];
		
		for(int i = 0; i < fruits.length; i++) {
			System.out.print(fruits[i] + " "); // null : ์—ฐ๊ฒฐํ•  ์ฃผ์†Œ ์—†์Œ
		}
		
		fruits[0] = "์‚ฌ๊ณผ";
		fruits[1] = "๋ฐฐ";
		fruits[2] = "๋ฐ”๋‚˜๋‚˜";
		
	}
}


package thisisjava;

public class NullPointerExceptionExample {
	public static void main(String[] args) {
		int[] intArray = null;
//		intArray[0] = 10;	 //NullPointerException

		// eclipse๋„ ์‹คํ–‰์„ ํ•ด๋ด์•ผ ์—๋Ÿฌ๊ฐ€ ๋‚˜์˜จ๋‹ค! ๋ฌธ๋ฒ•์ ์ธ ์—๋Ÿฌ๊ฐ€ ๋”ฐ๋กœ ์—†์–ด์„œ ์‹คํ–‰์€ ๋˜๋Š”๋ฐ ๋ง‰์ƒ ์‹คํ–‰ํ•ด๋ณด๋ฉด ์•ˆ๋จ;;
		String str = null;
		System.out.println("์ด ๋ฌธ์ž์ˆ˜: " + str.length() );	  //NullPointerException
	}
}

 

728x90
๋ฐ˜์‘ํ˜•
728x90
๋ฐ˜์‘ํ˜•

(ํ™”์š”์ผ)

- github ์ด์Šˆ ์ƒ์„ฑํ•ด์„œ jira๋ž‘ ์—ฐ๋™ ์‹ค์Šตํ•˜๊ธฐ(?)

- README.md ํŒŒ์ผ์—์„œ md๋ž€...? markdown ํŒŒ์ผ์ด๋ผ๋Š” ๋œป (์›น ํŽ˜์ด์ง€ ๊ธ€์˜ฌ๋ฆด ๋•Œ ์“ฐ์ž„) 

Github Project์—์„œ Board๋Š” ์• ์ž์ผ ํ•˜๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค!! ์š”์ฆ˜ ์ œ์ผ ๋งŽ์ด ์‚ฌ์šฉ

 

Todo : ์ด์Šˆ ์ง„ํ–‰ ์ „ ์ƒํƒœ

In Progress : ๋‹ด๋‹น์ž๊ฐ€ ์ด์Šˆ๋ฅผ ํ™•์ธํ•˜๊ณ  ์ง„ํ–‰์ค‘์ธ ์ƒํƒœ

In Review : ๊ฒ€ํ† ๋ฅผ ์š”์ฒญ/์ง„ํ–‰ ์ค‘์ธ ์ƒํƒœ(์ค‘๊ฐ„์— ๊ฒ€ํ†  ๋‹จ๊ณ„๋ฅผ ๋„ฃ๋Š”๊ฒŒ ์š”์ฆ˜ ๊ทผํ™ฉ)  

Done : ์™„๋ฃŒ ๋ฐ ์ข…๋ฃŒ๋œ ์ƒํƒœ

 

๊ธฐ๋ณธ ์„ธํŒ… ์™„๋ฃŒ!!

 

issue๋ž‘ project ์—ฐ๊ฒฐ

 

 

 

ํ”„๋กœ์ ํŠธ ๋ชฉํ‘œ : ์ •ํ•ด์ง„ ๋น„์šฉ๊ณผ ๊ธฐ๊ฐ„๋‚ด์—์„œ ์–ด๋–ป๊ฒŒ ํ•˜๋ฉด ํ’ˆ์งˆ์„ ๋†’์ด๋ฉด์„œ ๋งˆ๋ฌด๋ฆฌํ•  ์ˆ˜ ์žˆ์„๊ฑด์ง€...

 

- R&R : Role & Responsibility (pm์ด๋ผ๋ฉด ํ”„๋กœ์ ํŠธ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•œ ์ฑ…์ž„)

 

ํ•™์ƒ / ํ•™์ƒ ๋“ฑ๋ก / ํ•™์ƒ ๋“ฑ๋ก ์ˆ˜์ • ์ด์ฒ˜๋Ÿผ... ์„ธ๋ถ„ํ™”ํ•˜๋Š” ๊ตฌ์กฐํ™”ํ•˜๋Š” ํ™œ๋™ WBS / Level 3~4 ์ •๋„๋กœ ์ชผ๊ฐœ๋Š”๊ฒƒ์ด ์ข‹๋‹ค (2-3์ฃผ ๋‹จ์œ„๋กœ ํ•  ์ˆ˜ ์žˆ๋Š” ๋ถ„๋Ÿ‰)

 

- wbs ์‹ค์Šต์€ ๋‚ด์ผ!!

 

- ์œ„ํ—˜๊ณผ ์ด์Šˆ์˜ ์ฐจ์ด : ์œ„ํ—˜(potential problem)์€ ์•„์ง ์ž ์žฌ์  ๋ฌธ์ œ๋กœ ์•„์ง ์ผ์–ด๋‚˜์ง€ ์•Š์€ ๊ฒƒ์ด๊ณ  ์ด์Šˆ๋Š” ์ผ์–ด๋‚œ ๋ฌธ์ œ๋กœ ์‹ค์ œ๋กœ ์ผ์–ด๋‚  ์ด์Šˆ๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ์œ„ํ—˜์„ ๋ฐฉ์ง€ํ•ด์•ผํ•œ๋‹ค!

- ์œ„ํ—˜๊ณผ ๊ด€๋ จ๋œ์šฉ์–ด : ๋ฐœ์ƒ ๊ฐ€๋Šฅ์„ฑ๊ณผ ๋ฐœ์ƒํ–ˆ์„๋•Œ์˜ ์‹ฌ๊ฐ๋„(์œ„ํ—˜๋„)๋ฅผ ๊ณฑํ•œ๊ฒƒ์ด ์œ„ํ—˜๋„.. ๋†’์€๊ฒƒ์ด ์šฐ์„ ์ˆœ์œ„๋กœ ์ •ํ•ด์ง€๊ณ  ์ด๋ฅผ ๋Œ€๋น„ํ•˜๊ธฐ ์œ„ํ•ด ์ฒ ์ €ํ•˜๊ฒŒ ๊ณ„ํš์„ ์„ธ์›Œ์•ผํ•œ๋‹ค

 

 

 

(์ˆ˜์š”์ผ)

- wbs ๋งŒ๋“ค๊ธฐ 

 

ํ•™์ƒ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ WBS ๋งŒ๋“ค๊ธฐ

 

 

 

๋ฒ ์ด์Šค ๋ผ์ธ : ํŠน์ • ์‹œ์ ์—์„œ ํ•„์š”ํ•œ ํŒŒ์ผ๋“ค์„์ •ํ™•ํžˆ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ์ž‘์—…..

 - ์–ด๋–ค ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ๋ฅผ ๋ฐ˜์˜ํ•˜๋Š” ์†Œ์Šค์ฝ”๋“œ์ธ๊ฑด์ง€๋ฅผ ์•Œ๊ธฐ ์• ๋งคํ•˜๋ฏ€๋กœ ์–ด๋–ค ์‚ฐ์ถœ๋ฌผ์„ ๊ธฐ์ค€์œผ๋กœ ๊ฐœ๋ฐœํ•œ๊ฑด์ง€๋ฅผ ์•Œ๊ธฐ ์œ„ํ•ด ์ ์–ด ๋†“์€๊ฒƒ์ด baseline..

- ์–ด๋–ค ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ์™€ ์„ค๊ณ„์„œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๊ฐœ๋ฐœํ• ๊ฑด์ง€๋ฅผ ํ™•์ธํ•˜๊ณ  ๊ฐœ๋ฐœํ•ด์•ผํ•œ๋‹ค!

- ์†Œํ”„ํŠธ์›จ์–ด ํ˜•์ƒ ํ†ต์ œ : ํ˜•์ƒํ†ต์ œ์œ„์›ํšŒ์—์„œ ๋ณ€๊ฒฝ ์š”์ฒญ์„ ์ˆ˜์šฉํ•  ๊ฒƒ์ธ์ง€ ํ‰๊ฐ€ํ•˜๊ณ  ํ˜‘์˜ํ•˜๋Š” ๊ณผ์ •(CCBํ•œํ…Œ ํ†ต๊ณผ ๋ฐ›์•„์•ผ ์—…๋ฐ์ดํŠธ ๊ฐ€๋Šฅ)

 

 

์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ(SW Requirement Specification) : ๋ฌด์—‡์„ ๊ฐœ๋ฐœํ• ๊ฑด์ง€์— ์ดˆ์ ์„ ๋งž์ถ˜๋‹ค! (์–ด๋–ค ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ• ๊ฒƒ์ธ์ง€, ์–ด๋–ค ํ’ˆ์งˆ๋กœ / ์–ด๋–ป๊ฒŒ๋Š” ์„ค๊ณ„์„œ์— ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค..)

- ์‹œ์Šคํ…œ(SYSRS)

- ์†Œํ”„ํŠธ์›จ์–ด(SWRS)

- ํ•˜๋“œ์›จ์–ด(HWRS)

 

๊ธฐ๋Šฅ vs ๋น„๊ธฐ๋Šฅ 

- ๊ธฐ๋Šฅ :  ์ฐ ๊ธฐ๋Šฅ

- ๋น„๊ธฐ๋Šฅ : ํ’ˆ์งˆ, ์„ฑ๋Šฅ, ์ œ์•ฝ์‚ฌํ•ญ

 

๋น„๊ธฐ๋Šฅ ์š”๊ตฌ์‚ฌํ•ญ ์˜ˆ์‹œ

 

๊ธฐ๋Šฅ ์š”๊ตฌ์‚ฌํ•ญ ์–ด๋–ป๊ฒŒ ๋ถ„์„ํ•˜๊ณ  ์ž‘์„ฑํ•˜๋Š”์ง€... (๋„์ถœ, ๋ถ„์„, ๋ช…์„ธ, ํ™•์ธ...)

- ์ข‹์€ ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ๋ผ๋ฉด ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ๋ฅผ ๊ฐ€์ง€๊ณ  ํ…Œ์ŠคํŠธ๋ฅผ ๋งŒ๋“ค์–ด์„œ ๋‹ค ์ž˜ ๋Œ์•„๊ฐ€๋Š”์ง€...(ํ…Œ์ŠคํŠธ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค๋ฉด ์š”๊ตฌ์‚ฌํ•ญ์ด ๊ต‰์žฅํžˆ ๋””ํ…Œ์ผ ํ•˜๋‹ค๋Š”๊ฒƒ!! / ์•„๋‹ˆ๋ผ๋ฉด ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ ๋” ์ž์„ธํ•˜๊ฒŒ ํ•ด๋‹ฌ๋ผ๊ณ  ๋ถ€ํƒํ•˜๊ธฐ!!)

- ์ถ”์ ์„ฑ : ์šฐ๋ฆฌ์˜ ์†Œ์Šค์ฝ”๋“œ๊ฐ€ ์–ด๋–ค ์„ค๊ณ„์„œ, ์•„ํ‚คํ…์ฒ˜ ์„ค๊ณ„์„œ, ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ์„œ๋ฅผ ๋งŒ์กฑ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ๋‚˜์™”๋Š”์ง€ ์ถ”์ ์ด ๊ฐ€๋Šฅํ•œ์ง€... / ์šฐ๋ฆฌ์˜ ์š”๊ตฌ์‚ฌํ•ญ์€ ์–ธ์ œ๋“ ์ง€ ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์–ด๋–ค๊ฑธ ์ˆ˜์ •ํ•ด์•ผํ• ์ง€ ์ฐพ๋Š”๋ฐ ์‹œ๊ฐ„์ด ์˜ค๋ž˜๊ฑธ๋ฆผ, ๋ˆ„๋ฝ ๊ฐ€๋Šฅํ•˜๋‹ค

 

- ๋ณ€๊ฒฝ ์šฉ์ด์„ฑ : ๋‹ค๋ฅธ๊ฒƒ๊ณผ ์ตœ๋Œ€ํ•œ ๋…๋ฆฝ์„ฑ์„ ๋„์šฐ๋Š”๊ฒƒ์ด ์ข‹๋‹ค(์˜์กด์ ์ด๋ฉด ๋ณ€๊ฒฝํ•˜๊ธฐ ํž˜๋“ฆ) 

-  uml ๊ทธ๋ฆฌ๊ธฐ ์‹ค์Šต์€ ๋‚ด์ผ..

 

 

<๋ชฉ์š”์ผ)

- UML : ์‹œ์Šคํ…œ ์„ค๊ณ„๋ฅผ ํ‘œํ˜„ํ•˜๋Š”๋ฐ ์‚ฌ์šฉํ•˜๋Š” ํ†ตํ•ฉ๋œ ๋ชจ๋ธ๋ง์–ธ์–ด

 

MBD : MODEL BASED DEVELOPMENT / ๋ชจ๋ธ๋ง๋งŒ ํ•˜๋ฉด ์ž๋™์œผ๋กœ ๊ฐœ๋ฐœํ•ด์คŒ... / ๊ฐœ๋ฐœ์ž๋Š” ์—†์–ด์ ธ๋„... ์„ค๊ณ„์ž๋Š” ์•ˆ ์—†์–ด์ง„๋‹ค

 

USECASE DIAGRAM ๊ตฌ์„ฑ์š”์†Œ

- user actor :  ์‹œ์Šคํ…œ์˜ ์™ธ๋ถ€์— ์žˆ์œผ๋ฉด์„œ ์‹œ์Šคํ…œ๊ณผ ์ƒํ˜ธ์ž‘์šฉํ•˜๋Š” ๊ฒƒ๋“ค... ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉ์ž ํ˜น์€ ์™ธ๋ถ€ ์‹œ์Šคํ…œ

- system actor : ํ•ด๋‹น ํ”„๋กœ์ ํŠธ์˜ ๊ฐœ๋ฐœ ๋ฒ”์œ„์—๋Š” ์†ํ•˜์ง€ ์•Š์ง€๋งŒ ๋ฐ์ดํ„ฐ๋ฅผ์ฃผ๊ณ ๋ฐ›๋Š” ๋“ฑ ์„œ๋กœ ์—ฐ๋™๋˜๋Š” ๋‹ค๋ฅธ ์‹œ์Šคํ…œ 
                          ex) ์šฐ๋ฆฌ ์‹œ์Šคํ…œ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๋Š” ๊ธฐ์ƒ์ฒญ ์‹œ์Šคํ…œ   

- usecase : ์‹œ์Šคํ…œ์ด ์•กํ„ฐ์—๊ฒŒ ์ œ๊ณตํ•ด์•ผ ํ•˜๋Š” ๊ธฐ๋Šฅ์˜ ์ง‘ํ•ฉ / ๋™์‚ฌ+๋ช…์‚ฌ ํ˜•์‹์œผ๋กœ ์ž‘์„ฑ(์„ฑ์ ๋“ฑ๋ก, ์„ฑ์ ์กฐํšŒ)

- relationship : ์•กํ„ฐ์™€ ์œ ์Šค์ผ€์ด์Šค / ์œ ์Šค์ผ€์ด์Šค์™€ ์œ ์Šค์ผ€์ด์Šค ์‚ฌ์ด์˜ ์—ฐ๊ด€ ๊ด€๊ณ„!!! (๊ด€๊ณ„ ์ข…๋ฅ˜.....)

 

 

# USECASE DIAGRAM ๊ทธ๋ฆฌ๊ธฐ

https://app.diagrams.net/

 

Flowchart Maker & Online Diagram Software

Flowchart Maker and Online Diagram Software draw.io is free online diagram software. You can use it as a flowchart maker, network diagram software, to create UML online, as an ER diagram tool, to design database schema, to build BPMN online, as a circuit d

app.diagrams.net

 

 

# ์„ค๊ณ„

- ๊ด€์  : HOW(์–ด๋–ป๊ฒŒ)

- ํŠน์ง• : ์‚ฌ์šฉ ํ™˜๊ฒฝ์„ ๋ฐ˜์˜ํ•ด ๊ตฌ์ฒด์ 

- ์ƒ์œ„ ์„ค๊ณ„์„œ, ์ƒ์„ธ ์„ค๊ณ„์„œ ๋‘๊ฐ€์ง€๋กœ ๋‚˜๋‰จ

 

 

(๊ธˆ์š”์ผ)

https://velog.io/@hongjunland/Clean-Architecture

 

ํด๋ฆฐ ์•„ํ‚คํ…์ฒ˜(Clean Architecture)

DDD์ฑ…์„ ์ •๋…ํ•ด๋ณด๊ณ  ์•„ํ‚คํ…์ฒ˜ ํŒจํ„ด์ค‘์— ํ•˜๋‚˜์ธ ํฌํŠธ์™€ ์–ด๋Œ‘ํ„ฐ ํŒจํ„ด์„ ์ž ๊น ๊ณต๋ถ€ํ•ด๋ณธ ์ ์ด์žˆ๋‹ค. ํ”ํžˆ ๋งํ•˜๋Š” ํด๋ฆฐ์•„ํ‚คํ…์ฒ˜์™€ ๊ฑฐ์˜ ๊ฐ™์€๋ง๋กœ ์•Œ๋ ค์ ธ์žˆ๋Š”๋ฐ, ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์ž์„ธํžˆ ๋‚˜์™€์žˆ

velog.io

ํด๋ฆฐ ์•„ํ‚คํ…์ฒ˜ ํ•„๋…์„œ...

 

# ์„ค๊ณ„!!!

 

## ์ถ”์ƒํ™” : ์ƒ์œ„ ๋ ˆ๋ฒจ์—์„œ ์ œํ’ˆ์˜ ๊ตฌํ˜„์„ ์ƒ๊ฐํ•ด๋ด„!!

 

https://wealthymindset.tistory.com/entry/%EC%82%AC%EC%97%85%EC%B6%94%EC%A7%84-%ED%98%95%ED%83%9C%EC%9D%98-%EB%91%90%EA%B0%80%EC%A7%80-%EB%B0%A9%EB%B2%95-%ED%83%91%EB%8B%A4%EC%9A%B4Top-down%ED%95%98%ED%96%A5%EC%8B%9D-%EB%B0%94%ED%85%80%EC%97%85Bottom-up%EC%83%81%ED%96%A5%EC%8B%9D-%EB%B0%A9%EC%8B%9D

 

์‚ฌ์—…์ถ”์ง„ ํ˜•ํƒœ์˜ ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ•, ํƒ‘๋‹ค์šด(Top-down,ํ•˜ํ–ฅ์‹) & ๋ฐ”ํ…€์—…(Bottom-up,์ƒํ–ฅ์‹) ๋ฐฉ์‹

Top-down๊ณผ Bottom-up์€ ๋ฌธ์ œ ํ•ด๊ฒฐ์ด๋‚˜ ์˜์‚ฌ ๊ฒฐ์ •์„ ์œ„ํ•œ ๋‘ ๊ฐ€์ง€ ์ ‘๊ทผ ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. Top-down ์ ‘๊ทผ ๋ฐฉ์‹์€ ํฐ ๊ทธ๋ฆผ์—์„œ ์‹œ์ž‘ํ•˜์—ฌ ์ž‘์€ ์„ธ๋ถ€ ์‚ฌํ•ญ์œผ๋กœ ๋‚ด๋ ค๊ฐ€๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋ฐ˜๋ฉด, Bottom-up ์ ‘๊ทผ ๋ฐฉ์‹์€ ์ž‘์€

wealthymindset.tistory.com

Top-down(ํ•˜ํ–ฅ์‹)๊ณผ Bottom-up(์ƒํ–ฅ์‹)์˜ ์ฐจ์ด..

 

comfile ๊ณผ์ • : .java ํŒŒ์ผ์„ ์ปดํ“จํ„ฐ๊ฐ€ ํ•ด์„ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ปดํŒŒ์ผ๋Ÿฌ๋ฅผ ๊ฑฐ์ณ์„œ .class ํŒŒ์ผ๋กœ ๋ฐ”๊ฟ”์ฃผ๋Š” ๊ณผ์ •

 

 

## ๋ถ„ํ• ๊ณผ ์ •๋ณต(Divide Conquer)

 

- Component : ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์š”์†Œ๋“ค์˜ ์ง‘ํ•ฉ / ํด ์ˆ˜๋„ ์ž‘์„ ์ˆ˜๋„ ์–ด๋–ป๊ฒŒ ์ชผ๊ฐœ์ง€๋Š”์ง€๋Š” ๋•Œ๋งˆ๋‹ค ๋‹ค๋ฅด๋‹ค  

- Unit : ๋”์ด์ƒ ๋‚˜๋ˆŒ ์ˆ˜ ์—†๋Š” atomicํ•œ ์š”์†Œ

 

๋ถ„ํ• ๊ณผ ์ •๋ณต์˜ ์˜๋ฏธ...

- ํ•˜๋‚˜๋กœ ํ•˜์ง€ ๋ง๊ณ  ์—ฌ๋Ÿฌ ๊ฐœ๋กœ ์ชผ๊ฐœ๊ณ  ํ•˜๋‚˜ํ•˜๋‚˜ ์ž‘์€ ๋‹จ์œ„๋ถ€ํ„ฐ ๊ฐœ๋ฐœํ•˜๊ณ  ํ•ฉ์ณ์„œ ์ƒํ–ฅ์‹์œผ๋กœ ๊ฐœ๋ฐœํ•ด ๋‚˜๊ฐ€๋ผ๋Š” ์˜๋ฏธ

- ๋ชจ๋“ˆํ™”๋ž‘ ๊ฐ™์€ ์˜๋ฏธ(= unit๊ณผ๋„ ๊ฐ™์Œ)

- ํ•œ ํ™”๋ฉด์— ๋ณด๊ธฐ ์ข‹์€ 50-80์ค„ ์‚ฌ์ด๋กœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Œ

 

 

## ๋ชจ๋“ˆํ™”(Modularity)

 

- ์˜๋ฏธ : ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌ์กฐ๋ฅผ ์ด๋ฃจ๋Š” ๊ธฐ๋ณธ ๋‹จ์œ„

- ํŠน์ง•

  • ๋…๋ฆฝ์ ์ธ ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๋‹จ์œ„
  • ์œ ์ผํ•œ ์ด๋ฆ„์„ ๊ฐ€์ง
  • ๋ชจ๋“ˆ์—์„œ ๋˜ ๋‹ค๋ฅธ ๋ชจ๋“ˆ์„ ํ˜ธ์ถœ(call)ํ•  ์ˆ˜ ์žˆ์Œ -> interaction์˜ ํ•œ ์ข…๋ฅ˜ / interface : interaction์„ ํ•˜๋Š”๋ฐ ์†์‰ฝ๊ฒŒ ํ•˜๋Š” ์ˆ˜๋‹จ(ํ™”๋ฉด) / ํ˜ธ์ถœ์„ ํ•˜๋Š”๊ฒฝ์šฐ... ๋ฐ์ดํ„ฐ๋ฅผ ์š”์ฒญํ•˜๊ณ  ์‘๋‹ต ๋ฐ›์„  
  • ๋‹ค๋ฅธ ํ”„๋กœ๊ทธ๋žจ์—์„œ๋„ ๋ชจ๋“ˆ์„ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Œ

- ๋ชจ๋“ˆ์˜ ํฌ๊ธฐ : ์‹œ์Šคํ…œ์˜ ๊ทœ๋ชจ, ์œ ํ˜•, ํŠน์„ฑ์— ๋”ฐ๋ผ ์ž‘์Œ / ์ž‘์€ ์‹œ์Šคํ…œ์ด๋ผ๋ฉด ๋ชจ๋“ˆ์˜ ํฌ๊ธฐ๋Š” ํ•จ์ˆ˜ / ํฐ ์‹œ์Šคํ…œ์ด๋ผ๋ฉด...

 

- ์‘์ง‘๋„๋Š” ๊ฐ•ํ•˜๊ฒŒ(๋ชจ๋“ˆ ๊ตฌ์„ฑ ์š”์†Œ๊ฐ„์—๋Š” ๊ฐ•ํ•˜๊ฒŒ) / ๊ฒฐํ•ฉ๋„๋Š” ์•ฝํ•˜๊ฒŒ(์˜์กด์„ฑ์ด ์•ฝํ•ด์•ผํ•œ๋‹ค)

- ๊ฒฐํ•ฉ๋„๋ฅผ ๋Š์Šจํ•˜๊ฒŒ ํ•˜๋ผ๋Š” ๋ง์ด... ๋ชจ๋“  ๊ด€๊ณ„๊ฐ€ ์•ˆ์ข‹๋‹ค๋Š” ๋ง์ด ์•„๋‹ˆ๋ผ A,B๊ฐ€ ์„œ๋กœ ํ˜ธ์ถœํ•˜์—ฌ ์—๋Ÿฌ์˜ ๋ฌดํ•œ๋ฃจํ”„๋ฅผ ๋Œ์ง€ ๋ง๋ผ๋Š” ์†Œ๋ฆฌ  

- ๊ฒฐํ•ฉ๋„๊ฐ€ ๋†’์„์ˆ˜๋ก ๋ณต์žกํ•ด์ง / ๋‚ฎ์„์ˆ˜๋ก ๋‹จ์ˆœํ•ด์ง€๋„ ์œ ์ง€๋ณด์ˆ˜, ์žฌ์‚ฌ์šฉ์„ฑ์ด ์ข‹๋‹ค

 

 

C์–ธ์–ด ์ ˆ์ฐจ์ง€ํ–ฅํ˜• ์–ธ์–ด...

- ๋‹ค๋ฅธ ์–ธ์–ด๋“ค๋„ ๋‹ค ์ˆœ์„œ๋Œ€๋กœ ์ฝ”๋“œ๊ฐ€ ์‹คํ–‰๋˜๋Š”๋ฐ ์™œ ์ ˆ์ฐจ์ง€ํ–ฅ์ด๋ผ๊ณ  ํ•˜๋Š”์ง€ ???? ํŠนํžˆ๋‚˜ ์ˆœ์„œ์— ์ง‘์ค‘ํ•ด์„œ?? ํ•จ์ˆ˜๋ฅผ ์–ด๋””์„œ๋‚˜ ์“ฐ๋ ค๊ณ  ํ•˜๋ฉด ์ „์—ญ๋ณ€์ˆ˜๋กœ ์„ ์–ธํ•ด์•ผ ํ•œ๋‹ค / ์œ ์ง€๋ณด์ˆ˜ ์–ด๋ ค์›€

 

JAVA ๊ฐ์ฒด์ง€ํ–ฅ ์–ธ์–ด...

- ์‚ฌ๋žŒ์ด ์ดํ•ดํ•œ๊ฒƒ์ฒ˜๋Ÿผ ์ฝ”๋“œ๋ฅผ ์งœ๋ณด์ž ํ•ด์„œ ๋‚˜์˜จ ์–ธ์–ด

- interaction์ด ์ด๋ฃจ์–ด์ง€๊ธฐ ๋•Œ๋ฌธ์— loose coupling, strong cohension์„ ๊ผญ ํ•˜์ž

 

 

# ๊ฐ์ฒด์ง€ํ–ฅ๋ฐฉ๋ฒ•๋ก ์˜ ํŠน์ง•

 

- ์บก์Šํ™” : ์ •๋ณด์€๋‹‰์˜ ๊ฐœ๋…์ด ํฌํ•จ๋œ ๊ฐœ๋… / ๋‚˜์˜ ์ •๋ณด๋ฅผ ๊ฐ์‹ธ์„œ ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ์ •๋ณด๋ฅผ ์ˆจ๊ธฐ๋Š” ํšจ๊ณผ 

- ์ƒ์† : ๋‹ค๋ฅธํด๋ž˜์Šค์˜ ์†์„ฑ์„ ๋ฌผ๋Ÿฌ๋ฐ›์•„ ๋‚ด ๊ฒƒ์ฒ˜๋Ÿผ ์“ฐ๋Š” ๊ฒƒ 

- ๋‹คํ˜•์„ฑ : ํ•˜๋‚˜ ์ด์ƒ์˜ ํ˜•ํƒœ๋ฅผ ๊ฐ–๋Š” ๊ฒƒ

  • ์˜ค๋ฒ„๋กœ๋”ฉ : ๊ฐ™์€ ํ•จ์ˆ˜ ์ด๋ฆ„์ด์–ด๋„ ๋งค๊ฐœ๋ณ€์ˆ˜์˜ ๊ฐœ์ˆ˜๋‚˜ ํƒ€์ž…์ด ๋‹ค๋ฅด๋ฉด ์ค‘๋ณต ์ •์˜ํ•˜์—ฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅ
  • ์˜ค๋ฒ„๋ผ์ด๋”ฉ : ์ƒ์† ๊ด€๊ณ„์—์„œ ๋ถ€๋ชจ์˜ ๊ฐ€์ ธ์˜จ ๋ฉ”์†Œ๋“œ๋ฅผ ์ž์‹ ํด๋ž˜์Šค๊ฐ€ ์žฌ์ •์˜ ํ•˜์—ฌ ์‚ฌ์šฉ ๊ฐ€๋Šฅ
    • ์˜ค๋ฒ„๋ผ์ด๋”ฉ์€ ๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ๋ฉ”์†Œ๋“œ๋ฅผ ์ž์‹ ํด๋ž˜์Šค์—์„œ ๋™์ผํ•œ ์ด๋ฆ„๊ณผ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์žฌ์ •์˜ํ•˜์—ฌ, ์ž์‹ ํด๋ž˜์Šค์—์„œ ๋ฉ”์†Œ๋“œ๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ ๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ๋ฉ”์†Œ๋“œ๊ฐ€ ์•„๋‹Œ ์ž์‹ ํด๋ž˜์Šค์˜ ๋ฉ”์†Œ๋“œ๊ฐ€ ์‹คํ–‰๋˜๋„๋ก ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์˜ค๋ฒ„๋ผ์ด๋”ฉ์€ ๋ฉ”์†Œ๋“œ์—์„œ๋งŒ ์ด๋ฃจ์–ด์ง‘๋‹ˆ๋‹ค.
    • ์‰๋„์ž‰์€ ์ž์‹ ํด๋ž˜์Šค์—์„œ ๋ถ€๋ชจ ํด๋ž˜์Šค์™€ ๋™์ผํ•œ ์ด๋ฆ„์˜ ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•˜์—ฌ ๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ๋ณ€์ˆ˜๋ฅผ ๋ฎ์–ด์“ฐ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ด ๊ฒฝ์šฐ ์ž์‹ ํด๋ž˜์Šค์˜ ์ธ์Šคํ„ด์Šค๋Š” ๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ๋ณ€์ˆ˜ ๋Œ€์‹  ์ž์‹ ํด๋ž˜์Šค์˜ ๋ณ€์ˆ˜๋ฅผ ์ฐธ์กฐํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ถ€๋ชจ ํด๋ž˜์Šค์˜ ๋ณ€์ˆ˜ ์ž์ฒด๊ฐ€ ๋ณ€๊ฒฝ๋˜๋Š” ๊ฒƒ์€ ์•„๋‹™๋‹ˆ๋‹ค
728x90
๋ฐ˜์‘ํ˜•

+ Recent posts