Skip to content

Conversation

@zozero94
Copy link

No description provided.

@zozero94 zozero94 added the help wanted Extra attention is needed label Aug 25, 2020
@zozero94 zozero94 self-assigned this Aug 25, 2020
# For customization when using a Version Control System, please read the
# header note.
#Thu Aug 20 19:53:31 KST 2020
sdk.dir=/Users/zero/Library/Android/sdk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안드로이드는 이거 필요해요..??? 궁금궁금

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헤카앱 안드로이드같은 경우는 기본 sdk 로 자바 8을 쓰고있어서 해당 경로가 기입된것 같습니다 ㅇㅅㅇ...

import org.springframework.context.annotation.Configuration

@Configuration
class BoardConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

배운 걸 잘 응용하셨네요 굿

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꾸오오옹 아직은 잘 모르겠습니다 해리 감사해요 👍

@PostMapping("/board")
fun postBoard(@RequestBody body: Board): Boolean = boardService.create(body)

@GetMapping("/getBoardList")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

참고로 서버개발할 때는 RESTful하게 많이 짜는데요(물론 완벽히 구현이 불가함) RESTful하게 짤떄 동사는 사용하지 않습니다!
한번 이 글을 참고해주시면 좋을 것 같아요 https://gmlwjd9405.github.io/2018/09/21/rest-and-restful.html

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와우 감사합니다...저는 함수명처럼 사용하고 있었군요
실제로 저도 요청할 때, 저런 url을 보진 못했지만 이런 이유가 있었군요
그렇다면 getBoardList 보다는 boardList 가 맞는 형태겠군요

자원의 표현: 그 자원을 표현하기 위한 이름
-> Ex) DB의 학생 정보가 자원일 때, ‘students’를 자원의 표현으로 정한다.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

보내주신 포스트 참고하여 수정 커밋 올리도록 하겠습니다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boardList보다는 board그대로 가거나 boards가 어울릴것 같다는 생각이 드네요, 자바에서도 보통
변수명에 데이터타입을 넣지 않는 것 처럼 물론 데이터가 리스트 일 수는 있겠지만 너무 해당 데이터가 종속 되어버리는 것 같아요.
REST라 함은 board라는 자원을 가지고 행위를 표현한다고 보면 board와 boardList는 다른 자원의 관점으로 보게 될 수 있지 않을까 싶네요! 다른분들 의견은 어떤가요??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kkw01234 @DongHyukki
저도 마크 의견에 동의합니다.
변수 이름에 컬렉션 이름 포함 안시키는게 좀 더 클린한 코드라고 생각합니다.
저같은 경우 단수는 board, 복수인 경우 boards를 쓰고 있습니다.
미처 못봤는데 REST에 관한 리뷰는 다니엘이 잘 주셨네요 👍

제가 REST API를 구현하는 스타일인데 참고하시면 좋을 것 같습니다.

// 추가하는 경우
@PostMapping("board")
...

// 전체 조회인 경우
@GetMapping("/board")
....

// 단건 조회인 경우
@GetMapping("board/{id}")
....

Copy link
Member

@kkw01234 kkw01234 Aug 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 @minkukjo (해리) 처럼 많이 사용하는 편이에요!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

으악 체고! 👍

if (it.id == board.id) {
boardList.remove(it)
boardList.add(board)
return@forEach
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코틀린에서 이렇게도 사용할 수 있군요..처음 알았습니다

근데 필요없어보이는 코드 같아보이네요...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋ급하게 막 짜느라곸ㅋㅋㅋㅋ죄송합니다..우선은 동작만 하게 만들어뒀어요 ㅠㅅㅠ...
데이터베이스 적용되면 대대적인 변화를 주도록 하겠습니다.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also 배워갑니다

Copy link
Member

@minkukjo minkukjo Aug 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fun updateItem(board: Board) = boardList.find { it.id == board.id }.run { 
            boardList.remove(it)
            boardList.add(board)
}

boardList안에서 boardList를 부르는 모습도 썩 아름답지는 않지만 이렇게 리팩토링하면 return문을 제외시킬 수 있을 것 같네요 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants