๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Android & Kotlin

(12)
[๋‚ด๋ณด๋‚ด๋ฒˆ] Interfaces | Kotlin Kotlin์„ ๊ณต๋ถ€ํ•˜๋ฉด์„œ ์ƒ์†์— ๋Œ€ํ•œ ๋ถ€๋ถ„์„ ๊ณต๋ถ€ํ•˜๊ณ ์ž ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ง์ ‘ ๋ฒˆ์—ญํ–ˆ๋‹ค. ํ•ด๋‹น ๋ฌธ์„œ๋Š” 2022๋…„ 3์›” 3์ผ์ž ๊ณต์‹ ๋ฌธ์„œ์ด๋‹ค. ์ค‘๊ฐ„์ค‘๊ฐ„ ๐Ÿ‘€ ํ‘œ์‹œ๊ฐ€ ์žˆ๋Š” ๋ฌธ์žฅ์ด๋‚˜ ์†Œ์ œ๋ชฉ์€ ๋ฒˆ์—ญ์ด ๋ถ€์ •ํ™•ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ๊ตฌ๊ธ€์ด๋‚˜ ํŒŒํŒŒ๊ณ  ๋ฒˆ์—ญ๊ธฐ์˜ ๋„์›€์„ ๋ฐ›์•˜๋‹ค. Kotlin ๊ณต์‹๋ฌธ์„œ ํ™•์ธํ•˜๊ธฐ โžก๏ธ Interfaces | Kotlin kotlinlang.org โ€ป ์˜์–ด ์ „๊ณต์ž๋„ ํ•ด์™ธ ์œ ํ•™ํŒŒ๋„ ์•„๋‹ˆ๊ธฐ์— ๋ฒˆ์—ญ์—๋Š” ์˜์—ญ, ์˜ค์—ญ, ๊ตฌ๊ธ€ ๋ฒˆ์—ญ์ด ๋ฌด์ˆ˜ํžˆ ๋งŽ์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ํ˜ผ์ž ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•ด๊ฐ€๋ฉฐ ๋ฒˆ์—ญํ•˜๋‹ค ๋ณด๋‹ˆ ์˜คํƒ€๋„ ๋งŽ์„ ์ˆ˜ ์žˆ๋‹ค. ์ •ํ™•ํ•œ ๋‚ด์šฉ์€ ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ง์ ‘ ์‚ดํŽด๋ณด๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์ •๋ณด๋“ค์„ ๋” ์ฐพ์•„๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค. (ํ•˜์ง€๋งŒ ๋Œ“๊ธ€ ํ”ผ๋“œ๋ฐฑ๋„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค๐Ÿ˜ƒ ) Interfaces in Kotlin can contain declaratio..
[๋‚ด๋ณด๋‚ด๋ฒˆ] Properties | Kotin Kotlin์„ ๊ณต๋ถ€ํ•˜๋ฉด์„œ ์ƒ์†์— ๋Œ€ํ•œ ๋ถ€๋ถ„์„ ๊ณต๋ถ€ํ•˜๊ณ ์ž ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ง์ ‘ ๋ฒˆ์—ญํ–ˆ๋‹ค. ํ•ด๋‹น ๋ฌธ์„œ๋Š” 2022๋…„ 3์›” 3์ผ์ž ๊ณต์‹ ๋ฌธ์„œ์ด๋‹ค. ์ค‘๊ฐ„์ค‘๊ฐ„ ๐Ÿ‘€ ํ‘œ์‹œ๊ฐ€ ์žˆ๋Š” ๋ฌธ์žฅ์ด๋‚˜ ์†Œ์ œ๋ชฉ์€ ๋ฒˆ์—ญ์ด ๋ถ€์ •ํ™•ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ๊ตฌ๊ธ€์ด๋‚˜ ํŒŒํŒŒ๊ณ  ๋ฒˆ์—ญ๊ธฐ์˜ ๋„์›€์„ ๋ฐ›์•˜๋‹ค. Kotlin ๊ณต์‹๋ฌธ์„œ ํ™•์ธํ•˜๊ธฐ โžก๏ธ Properties | Kotlin kotlinlang.org โ€ป ์˜์–ด ์ „๊ณต์ž๋„ ํ•ด์™ธ ์œ ํ•™ํŒŒ๋„ ์•„๋‹ˆ๊ธฐ์— ๋ฒˆ์—ญ์—๋Š” ์˜์—ญ, ์˜ค์—ญ, ๊ตฌ๊ธ€ ๋ฒˆ์—ญ์ด ๋ฌด์ˆ˜ํžˆ ๋งŽ์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ํ˜ผ์ž ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•ด๊ฐ€๋ฉฐ ๋ฒˆ์—ญํ•˜๋‹ค ๋ณด๋‹ˆ ์˜คํƒ€๋„ ๋งŽ์„ ์ˆ˜ ์žˆ๋‹ค. ์ •ํ™•ํ•œ ๋‚ด์šฉ์€ ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ง์ ‘ ์‚ดํŽด๋ณด๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์ •๋ณด๋“ค์„ ๋” ์ฐพ์•„๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค. (ํ•˜์ง€๋งŒ ๋Œ“๊ธ€ ํ”ผ๋“œ๋ฐฑ๋„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค๐Ÿ˜ƒ ) Declaring properties Properties in Kotlin c..
[๋‚ด๋ณด๋‚ด๋ฒˆ] Classes | Kotlin Kotlin์„ ๊ณต๋ถ€ํ•˜๋ฉด์„œ ์ƒ์†์— ๋Œ€ํ•œ ๋ถ€๋ถ„์„ ๊ณต๋ถ€ํ•˜๊ณ ์ž ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ง์ ‘ ๋ฒˆ์—ญํ–ˆ๋‹ค. ํ•ด๋‹น ๋ฌธ์„œ๋Š” 2022๋…„ 3์›” 3์ผ์ž ๊ณต์‹ ๋ฌธ์„œ์ด๋‹ค. Kotlin ๊ณต์‹๋ฌธ์„œ ํ™•์ธํ•˜๊ธฐ โžก๏ธ Classes | Kotlin kotlinlang.org โ€ป ์˜์–ด ์ „๊ณต์ž๋„ ํ•ด์™ธ ์œ ํ•™ํŒŒ๋„ ์•„๋‹ˆ๊ธฐ์— ๋ฒˆ์—ญ์—๋Š” ์˜์—ญ, ์˜ค์—ญ, ๊ตฌ๊ธ€ ๋ฒˆ์—ญ์ด ๋ฌด์ˆ˜ํžˆ ๋งŽ์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ํ˜ผ์ž ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•ด๊ฐ€๋ฉฐ ๋ฒˆ์—ญํ•˜๋‹ค ๋ณด๋‹ˆ ์˜คํƒ€๋„ ๋งŽ์„ ์ˆ˜ ์žˆ๋‹ค. ์ •ํ™•ํ•œ ๋‚ด์šฉ์€ ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ง์ ‘ ์‚ดํŽด๋ณด๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์ •๋ณด๋“ค์„ ๋” ์ฐพ์•„๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค. (ํ•˜์ง€๋งŒ ๋Œ“๊ธ€ ํ”ผ๋“œ๋ฐฑ๋„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค๐Ÿ˜ƒ ) Classes in Kotlin are declared using the keyword class: ์ฝ”ํ‹€๋ฆฐ์˜ ํด๋ž˜์Šค๋Š” class ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์„ ์–ธ๋œ๋‹ค: class Person { /*.....
[๋‚ด๋ณด๋‚ด๋ฒˆ] Inheritance | Kotlin Kotlin์„ ๊ณต๋ถ€ํ•˜๋ฉด์„œ ์ƒ์†์— ๋Œ€ํ•œ ๋ถ€๋ถ„์„ ๊ณต๋ถ€ํ•˜๊ณ ์ž ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ง์ ‘ ๋ฒˆ์—ญํ–ˆ๋‹ค. ํ•ด๋‹น ๋ฌธ์„œ๋Š” 2022๋…„ 3์›” 2์ผ์ž ๊ณต์‹ ๋ฌธ์„œ์ด๋‹ค. Kotlin ๊ณต์‹๋ฌธ์„œ ํ™•์ธํ•˜๊ธฐ โžก๏ธ Inheritance | Kotlin kotlinlang.org โ€ป ์˜์–ด ์ „๊ณต์ž๋„ ํ•ด์™ธ ์œ ํ•™ํŒŒ๋„ ์•„๋‹ˆ๊ธฐ์— ๋ฒˆ์—ญ์—๋Š” ์˜์—ญ, ์˜ค์—ญ, ๊ตฌ๊ธ€ ๋ฒˆ์—ญ์ด ๋ฌด์ˆ˜ํžˆ ๋งŽ์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ํ˜ผ์ž ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•ด๊ฐ€๋ฉฐ ๋ฒˆ์—ญํ•˜๋‹ค ๋ณด๋‹ˆ ์˜คํƒ€๋„ ๋งŽ์„ ์ˆ˜ ์žˆ๋‹ค. ์ •ํ™•ํ•œ ๋‚ด์šฉ์€ ๊ณต์‹๋ฌธ์„œ๋ฅผ ์ง์ ‘ ์‚ดํŽด๋ณด๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ์ •๋ณด๋“ค์„ ๋” ์ฐพ์•„๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค. (ํ•˜์ง€๋งŒ ๋Œ“๊ธ€ ํ”ผ๋“œ๋ฐฑ๋„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค๐Ÿ˜ƒ ) All classes in Kotlin have a common superclass, Any, which is the default superclass for a class with no..
Overloading / Overriding Overloading ์˜๋ฏธ ๊ณผ์ ํ•˜๋‹ค, ๊ณผ๋ถ€ํ•˜๋ผ๋Š” overload์˜ ๋œป์—์„œ ์œ ์ถ”ํ•ด๋ณด๋ฉด ๋ฌด์–ธ๊ฐ€๋ฅผ ๋” ์‹ฃ๋Š”, ์–น๋Š” ๊ทธ๋ฆผ์ด ๊ทธ๋ ค์ง„๋‹ค. ๋น„์Šทํ•˜๊ฒŒ ์˜ค๋ฒ„๋กœ๋”ฉ๋„ ํ•œ ํด๋ž˜์Šค ๋‚ด์— ๊ฐ™์€ ์ด๋ฆ„์˜ ๋ฉ”์„œ๋“œ๋ฅผ ์—ฌ๋Ÿฌ ๊ฐœ ์ •์˜ํ•˜๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค. ๋ฉ”์„œ๋“œ๋“ค์ด ๋ชจ๋‘ ๊ฐ™์€ ์ผ์„ ํ•˜์ง€๋งŒ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋‹ฌ๋ฆฌํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ ๋ฉ”์„œ๋“œ ์ด๋ฆ„์€ ๊ฐ™๊ณ  ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๋‹ค๋ฅด๊ฒŒ ํ•˜์—ฌ ์˜ค๋ฒ„๋กœ๋”ฉ์„ ๊ตฌํ˜„ํ•œ๋‹ค. ์กฐ๊ฑด ์˜ค๋ฒ„๋กœ๋”ฉ์ด ์„ฑ๋ฆฝํ•˜๊ธฐ ์œ„ํ•œ ์กฐ๊ฑด์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค. ๋ฉ”์„œ๋“œ ์ด๋ฆ„์ด ๊ฐ™์•„์•ผ ํ•œ๋‹ค. ๋งค๊ฐœ๋ณ€์ˆ˜์˜ ๊ฐœ์ˆ˜ ๋˜๋Š” ํƒ€์ž…์ด ๋‹ฌ๋ผ์•ผ ํ•œ๋‹ค. ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ๊ฐ™๊ณ  ๋ฆฌํ„ดํƒ€์ž…์ด ๋‹ค๋ฅธ ๊ฒฝ์šฐ๋Š” ์˜ค๋ฒ„๋กœ๋”ฉ์ด ์„ฑ๋ฆฝ๋˜์ง€ ์•Š๋Š”๋‹ค. (๋ฆฌํ„ดํƒ€์ž…์€ ์˜ค๋ฒ„๋กœ๋”ฉ์„ ๊ตฌํ˜„ํ•˜๋Š”๋ฐ ์•„๋ฌด๋Ÿฐ ์˜ํ–ฅ์„ ์ฃผ์ง€ ๋ชปํ•œ๋‹ค.) ์œ„์˜ ์กฐ๊ฑด๋“ค์„ ๋งŒ์กฑ์‹œํ‚ค์ง€ ๋ชปํ•˜๋ฉด ์˜ค๋ฒ„๋กœ๋”ฉ์ด ์•„๋‹Œ ์ค‘๋ณต์ •์˜๋œ ๊ฒƒ์œผ๋กœ ๊ฐ„์ฃผ๋˜์–ด ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. ์˜ˆ์‹œ int add..
Lesson 6: App Architecture (Persistence) 4. Designing Entities Entity: Object or concept to store in the database. Entity class defines a table, each instance is stored as a table row. Query: Request for data or information from a database table or tables, or a request to perform some action on the table. dataclass๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ…Œ์ด๋ธ”์„ ์ •์˜. annotation์„ ์‚ฌ์šฉํ•˜์—ฌ์„œ ์–ด๋Š property๊ฐ€ primary key์ธ์ง€ ๋“ฑ์„ ๋‚˜ํƒ€๋‚ธ๋‹ค. interface๋ฅผ ์ƒ์„ฑํ•˜์—ฌ Database์™€ ์–ด๋–ป๊ฒŒ interactํ•  ๊ฒƒ์ธ์ง€๋ฅผ ์ •์˜ํ•œ๋‹ค. Ro..
Lesson 5: App Architecture(UI Layer) 5. What is Architecture Application Architecture๋ž€ ์•ฑ์˜ ํด๋ž˜์Šค๋“ค์— ๋Œ€ํ•œ ๋””์ž์ธ๊ณผ ๊ทธ๋“ค ์‚ฌ์ด์˜ ๊ด€๊ณ„. ์•ฑ์„ ๊ตฌ์„ฑํ•˜๋Š”๋ฐ ํ•œ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•๋งŒ ์žˆ๋Š” ๊ฒƒ์€ ์•„๋‹ˆ๋‹ค. ์ง‘์„ ์„ค๊ณ„ํ•˜๋Š” ๊ฒƒ์€ ์ƒํ™ฉ, ํ•„์š”, ์ทจํ–ฅ ๋“ฑ์— ๊ฐ•ํ•œ ์˜์กด์„ฑ์„ ๋ˆ๋‹ค. ์ด์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์•ˆ๋“œ๋กœ์ด๋“œ ์•ฑ๋„ ๋‹ค์–‘ํ•œ ์„ค๊ณ„ ์Šคํƒ€์ผ์ด ์žˆ๋‹ค. ๋˜ ๊ฐ ๋ฐฉ์‹์€ ์žฅ๋‹จ์ ์ด ์žˆ๋‹ค. ์„œ๋กœ๊ฐ€ ๊ณตํ†ต์ ์„ ๊ฐ–๊ธฐ๋„ ํ•œ๋‹ค. ๊ฐ๊ธฐ ๋‹ค๋ฅธ ์•ฑ์˜ ํ•„์š”๋‚˜ ํŒ€์˜ ํฌ๊ธฐ, ํŒ€์˜ ์„ฑํ–ฅ ๋“ฑ์— ๋”ฐ๋ผ ์ ํ•ฉํ•œ ์Šคํƒ€์ผ์ด ๋‹ค๋ฅผ ์ˆ˜ ์žˆ๋‹ค. ์ด๋ฒˆ lesson์—์„œ๋Š” a single multipurpose architectural pattern์„ ์‚ฌ์šฉํ•˜๋Š”๋ฐ MVVM๊ณผ ๋น„์Šทํ•˜๋‹ค. 6. Our App Architecture Software design principle - Separati..
๊ณต๋ถ€ ์ฃผ์ œ ๋ณดํ˜ธ๋˜์–ด ์žˆ๋Š” ๊ธ€์ž…๋‹ˆ๋‹ค.