728x90

๐Ÿ“š Computer Science 24

[Back-End] ์Šคํ”„๋ง ์ž…๋ฌธ :: ํšŒ์› ๊ด€๋ฆฌ ์˜ˆ์ œ - ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ

1. ํšŒ์› domain ๊ณผ repository ๋งŒ๋“ค๊ธฐ  src/main/java/com.yoonsung.firstproject/domain/Member.javapackage com.yoonsung.firstproject.domain;public class Member { private Long id; private String name; public Long getId(){ return id; } public void setId(Long id){ this.id = id; } public String getName(){ return name; } public void setName(String name){ t..

[Back-End] ์Šคํ”„๋ง ์ž…๋ฌธ :: Spring ์›น ๊ฐœ๋ฐœ ๊ธฐ์ดˆ

Spring Boot ๋กœ ์›น์„ ๊ฐœ๋ฐœํ•˜๋Š” ๋ฐฉ๋ฒ• 3๊ฐ€์ง€. 1. Static Content ์ •์  ์ปจํ…์ธ ํŒŒ์ผ์„ ๊ทธ๋Œ€๋กœ ์›น๋ธŒ๋ผ์šฐ์ €์— ๋‚ด๋ฆฌ๋Š” ๊ฒƒ.Spring Boot ๋Š” ์ •์  ์ปจํ…์ธ ๋ฅผ ์ž๋™์œผ๋กœ ์ฐพ์•„์„œ ๋‚ด๋ ค์ฃผ๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•œ๋‹ค.์ฆ‰, static ์ด๋ผ๋Š” ์˜ˆ์•ฝ์–ด๋กœ ํด๋”๋ฅผ ๋งŒ๋“ค์–ด์„œ ์•ˆ์— .html ํŒŒ์ผ์„ ๋„ฃ์œผ๋ฉด ์ด๋ฅผ ์Šคํ”„๋ง ๋ถ€ํŠธ๊ฐ€ ์ฐพ์•„์„œ ๊ทธ๋Œ€๋กœ ์ปจํ…์ธ ๋ฅผ ๋‚ด๋ ค์ค€๋‹ค. ์ •์  ์ปจํ…์ธ ์— ๋”ฐ๋กœ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์€ ํ•  ์ˆ˜ ์—†๋‹ค. controller ๊ฐ€ ๋” ์šฐ์„ ์ˆœ์œ„๋ฅผ ๊ฐ–๋Š”๋‹ค. Servlet Web Applications :: Spring BootIf you want to build servlet-based web applications, you can take advantage of Spring Boot’s auto-configuration ..

[Git] ์›๊ฒฉ์ €์žฅ์†Œ์— Push ํ•œ Commit ์‚ญ์ œํ•˜๊ธฐ

1. ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์‚ญ์ œํ•  commit ์„ ํ™•์ธ. git log 2. ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰์— push ํ•œ(๊ฐ€์žฅ ์œ„์— ์žˆ๋Š”) commit ์„ ์ง€์šฐ๊ณ  ์‹ถ๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์Œ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ commit ์„ ์‚ญ์ œํ•œ๋‹ค. git reset HEAD^ 3. ๊ทธ๋ฆฌ๊ณ  ๋‚ด๊ฐ€ commit ์„ ์ง€์› ๋‹ค๋Š” ๊ฒƒ์„ github ์„œ๋ฒ„์— ์•Œ๋ ค์ฃผ์–ด github ๋‚ด์—์„œ๋„ ํ•ด๋‹น commit ์„ ์‚ญ์ œํ•˜๋„๋ก ํ•œ๋‹ค. git push -f origin "๋ธŒ๋žœ์น˜๋ช…" cf) master ์—์„œ push ํ•œ commit ์„ ์‚ญ์ œํ•˜๋ ค๋ฉด git push -f origin master ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

[GitHub Packages] GitHub Packages

GitHub Packages documentation - GitHub Docs Learn to safely publish and consume packages, store your packages alongside your code, and share your packages privately with your team or publicly with the open source community. You can also automate your packages with GitHub Actions. docs.github.com *GitHub Packages ๋ณ„๋„์˜ ์„ค์น˜๋‚˜ ์…‹ํŒ… ์—†์ด *npm, *Apache maven, *rubygems, *Gradle, *NuGet ํŒจํ‚ค์ง€ ๋ฐ Docker Image๋ฅผ ๋ฐฐํฌ..

[Unity][๋””์ž์ธ ํŒจํ„ด] Simple Factory Pattern(์‹ฌํ”Œ ํŒฉํ† ๋ฆฌ ํŒจํ„ด)

*Factory: ๊ฐ์ฒด ์ƒ์„ฑ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ํด๋ž˜์Šค๋ฅผ ํŒฉํ† ๋ฆฌ๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค. *Simple Factory: ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์ผ์„ ์ „๋‹ดํ•˜๋Š” ํด๋ž˜์Šค. Simple Factory Pattern ์—๋Š” ์ฃผ์–ด์ง„ ์ž…๋ ฅ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋‹ค๋ฅธ ์œ ํ˜•์˜ ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๋ฉ”์†Œ๋“œ๊ฐ€ ์žˆ๋Š” ํŒฉํ† ๋ฆฌ ํด๋ž˜์Šค๊ฐ€ ์žˆ๋‹ค. Simple Factory ๋Š” ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ํ•  ๋•Œ ํ•ญ์ƒ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋ผ ํŒจํ„ด์œผ๋กœ ์ทจ๊ธ‰ํ•˜์ง€๋Š” ์•Š๋Š”๋‹ค. ๋‹ค๋งŒ, ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ ํŒจํ„ด์ด๋‚˜ ์ถ”์ƒ ํŒฉํ† ๋ฆฌ ํŒจํ„ด์˜ ๊ธฐ๋ณธ์ด ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์•Œ์•„๋‘์ž. using UnityEngine; public abstract class Unit { public abstract void move(); } public class Marine : Unit { public Marine() { Debug.Log("M..

[Unity][๋””์ž์ธ ํŒจํ„ด] Component Pattern

*Component Pattern: ๋กœ์ง์„ ๊ธฐ๋Šฅ๋ณ„๋กœ ์ปดํฌ๋„ŒํŠธ ํ•˜๋Š” ๊ฒƒ. ํด๋ž˜์Šค๋ฅผ ๋ถ„๋ฆฌํ•˜๊ณ  ๊ฐ€๋…์„ฑ์„ ๋†’์ด๊ณ  Decoupling(๋…์ž์ ์ธ ํ๋ฆ„์„ ๋ณด์ด๋Š” ๊ฒƒ) ์‹œํ‚ค๋Š” ๊ฒƒ์€ ํ˜‘์—…ํ•˜์—ฌ ๊ฐœ๋ฐœ์„ ๋งŽ์ด ํ•ด๋ณธ ์‚ฌ๋žŒ๋“ค์—๊ฒŒ๋Š” ์ž์—ฐํžˆ ๋…น์•„ ์žˆ๋Š” ์Šต๊ด€์ด๋‹ค. ์ด๋Ÿฐ ๊ตฌ์กฐ์ ์ธ ๊ฐœ์„  ์ž‘์—…์„ ์„ ๋ฐฐ ๊ฐœ๋ฐœ์ž๋“ค์ด ์ด๋ฏธ ์ปดํฌ๋„ŒํŠธ ํŒจํ„ด์œผ๋กœ ๋ช…๋ช…ํ•ด ๋‘์—ˆ๋‹ค. ํŠนํžˆ Unity ์˜ GameObject ๋Š” Component ํŒจํ„ด์ด ์ž˜ ๋ฐ˜์˜๋˜์–ด ์„ค๊ณ„๋œ ํด๋ž˜์Šค์ด๋‹ค. GetComponet Method ๋กœ ๊ฐ๊ฐ์˜ Decoupling ๋œ ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ๋“ค์„ ๋ถˆ๋Ÿฌ์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ์œ ๋‹ˆํ‹ฐ๋Š” ์ƒˆ๋กœ์šด ํ–‰๋™์„ ์ถ”๊ฐ€ํ•˜๋Š” ์ปดํฌ์ง€์…˜(composition: ํ•ฉ์„ฑ) ๊ตฌ์กฐ๋ฅผ ์ฑ„์šฉํ•œ๋‹ค. ์ด ์ ์€ ์ƒ์†(Inheritance)๋ฅผ ํ†ตํ•ด ํ™•์žฅ๋˜๋Š” ์˜ค๋ธŒ์ ํŠธ ์ง€ํ–ฅ ํด๋ž˜์Šค ๊ณ„์ธต๊ณผ๋Š” ์œ„์ƒ์„ ๋‹ฌ๋ฆฌ..

[C#][Unity][๋””์ž์ธ ํŒจํ„ด] Strategy Pattern(์ „๋žต ํŒจํ„ด)

*Strategy Pattern: ์—ฌ๋Ÿฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ํ•˜๋‚˜์˜ ์ถ”์ƒ์ ์ธ ์ ‘๊ทผ์ (์ธํ„ฐํŽ˜์ด์Šค)์„ ๋งŒ๋“ค์–ด์„œ ์ ‘๊ทผ์ ์—์„œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ์„œ๋กœ ๊ตํ™˜ ๊ฐ€๋Šฅํ•˜๋„๋ก ํ•˜๋Š” ํŒจํ„ด *์‚ฌ์šฉ ์˜ˆ: ์›Œ๋“œ ๋ฌธ์„œ์—์„œ ํ”„๋ฆฐํ„ฐ, ํฐํŠธ ์‚ฌ์šฉ. ์–ด๋–ค ๊ธฐ์ข…์˜ ํ”„๋ฆฐํŠธ๋”๋ผ๋„ 'Print' ๋ฒ„ํŠผ๋งŒ ๋ˆ„๋ฅด๋ฉด ๋˜‘๊ฐ™์ด ๋™์ž‘ํ•จ. ๊ฒŒ์ž„ ์บ๋ฆญํ„ฐ์˜ ๋ฌด๊ธฐ(๊ต์ฒด ํ›„) ์‚ฌ์šฉ. ์–ด๋–ค ๋ฌด๊ธฐ๋ผ๋„ '๊ณต๊ฒฉ' ๋ฒ„ํŠผ๋งŒ ๋ˆ„๋ฅด๋ฉด ๊ณต๊ฒฉ ๋™์ž‘์„ ์ˆ˜ํ–‰ํ•จ. public class MyWeapon { //์ ‘๊ทผ์  private IWeapon weapon; //๋ฌด๊ธฐ ์ฒด์ธ์ง€ public void SetWeapon(IWeapon weapon) { this.weapon = weapon; } //๋ฌด๊ธฐ์‚ฌ์šฉ public void Shoot() { weapon.Shoot(); } } IWeapon ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์—ฐ๊ฒฐํ•˜..

[C#][Unity][๋””์ž์ธ ํŒจํ„ด] Command ํŒจํ„ด

* Commnad ํŒจํ„ด: ๋ฉ”์„œ๋“œ ํ˜ธ์ถœ์„ ์‹ค์ฒดํ™”, ์ฆ‰ ๊ฐ์ฒด๋กœ ๊ฐ์‹ผ ๊ฒƒ. : ํ•จ์ˆ˜ ํ˜ธ์ถœ์„ ๊ฐ์ฒด๋กœ ๋งŒ๋“  ์ด์œ ๋Š” ๋””์ปคํ”Œ๋ง์œผ๋กœ ์ฝ”๋“œ๊ฐ€ ์œ ์—ฐํ•ด์ง€๊ธฐ ๋•Œ๋ฌธ. ex) ์ž…๋ ฅํ‚ค ๋ณ€๊ฒฝ, ์‹คํ–‰์ทจ์†Œ/์žฌ์‹คํ–‰ ๋“ฑ์˜ ๊ธฐ๋Šฅ์„ ๋งŒ๋“ค ๋•Œ ์‚ฌ์šฉ. 1. Command ํŒจํ„ด์—†์ด ๋งŒ๋“  GetKey ๊ธฐ๋Šฅ using System.Collections; using UnityEngine; public class Player : MonoBehaviour { [SerializeField] private GameObject shield; [SerializeField] private GameObject cannon; [SerializeField] private Transform firePos; void Update() { if (Input.GetKeyDown(..

728x90