앱 개발/Andriod Studio

[Android Studio] 웹개발과 앱개발의 비교 (claude)

cha430 2026. 2. 3. 12:07

 

클로드에게 물어보고 정리하는 내용이다.

 

 

 

 

 

📦 각 컴포넌트 역할 (웹과 비교)

1. ApiService (Retrofit Interface)

  • 웹의 Controller와 반대 역할!
  • 웹: Controller가 요청을 받음
  • 안드로이드: ApiService가 요청을 보냄
// 웹의 @GetMapping과 비슷한 느낌
interface NoticeApiService {
    @GET("api/notice/list")
    fun getNoticeList(): Call<NoticeListResponse>
    
    @GET("api/notice/{id}")
    fun getNoticeDetail(@Path("id") id: Int): Call<NoticeResponse>
}

 

 

 

 

2. ApiClient

  • baseUrl + Retrofit 설정
  • 웹의 application.properties나 설정 파일 역할
object ApiClient {
    private const val BASE_URL = "https://your-server.com/"
    
    val retrofit: Retrofit = Retrofit.Builder()
        .baseUrl(BASE_URL)
        .addConverterFactory(GsonConverterFactory.create())
        .build()
    
    val noticeService: NoticeApiService = 
        retrofit.create(NoticeApiService::class.java)
}

 

 

 

 

 

3. DTO (Request/Response)

  • 웹과 똑같음!
  • 서버와 주고받는 데이터 형태
// 웹의 DTO와 100% 동일
data class NoticeListRequest(
    val page: Int,
    val size: Int
)

data class NoticeResponse(
    val id: Int,
    val title: String,
    val content: String
)

 

 

 

 

 

4. Fragment

  • 웹의 Vue 컴포넌트와 비슷!
  • 화면의 일부를 담당하는 UI 조각
  • Vue의 .vue 파일처럼 화면 하나를 담당
// Vue의 <template> + <script> 역할
class NoticeListFragment : Fragment() {
    // Vue의 data() 같은 역할
    private lateinit var adapter: NoticeAdapter
    
    // Vue의 mounted() 같은 역할
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        loadNoticeList()
    }
}

 

 

 

 

 

 

 

5. Adapter (RecyclerView Adapter)

  • 웹에는 없는 개념!
  • Vue의 v-for를 수동으로 구현하는 느낌
  • 리스트 데이터를 화면에 반복해서 표시
// Vue에서:
// <div v-for="notice in notices">{{ notice.title }}</div>

// 안드로이드에서:
class NoticeAdapter(private val notices: List<NoticeItem>) 
    : RecyclerView.Adapter<NoticeAdapter.ViewHolder>() {
    
    // 각 항목을 어떻게 그릴지 정의
    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        holder.titleText.text = notices[position].title
    }
}