'100.알고리즘/02. Code Kata'에 해당되는 글 2건

  1. 2015.11.06 Kata01: Supermarket Pricing
  2. 2015.11.02 CodeKata

http://codekata.com/kata/kata01-supermarket-pricing/


Kata01: Supermarket Pricing

This kata arose from some discussions we’ve been having at the DFW Practioners meetings. The problem domain is something seemingly simple: pricing goods at supermarkets.

Some things in supermarkets have simple prices: this can of beans costs $0.65. Other things have more complex prices. For example:

  • three for a dollar (so what’s the price if I buy 4, or 5?)
  • $1.99/pound (so what does 4 ounces cost?)
  • buy two, get one free (so does the third item have a price?)

This kata involves no coding. The exercise is to experiment with various models for representing money and prices that are flexible enough to deal with these (and other) pricing schemes, and at the same time are generally usable (at the checkout, for stock management, order entry, and so on). Spend time considering issues such as:

  • does fractional money exist?
  • when (if ever) does rounding take place?
  • how do you keep an audit trail of pricing decisions (and do you need to)?
  • are costs and prices the same class of thing?
  • if a shelf of 100 cans is priced using “buy two, get one free”, how do you value the stock?

This is an ideal shower-time kata, but be careful. Some of the problems are more subtle than they first appear. I suggest that it might take a couple of weeks worth of showers to exhaust the main alternatives.

Goal

The goal of this kata is to practice a looser style of experimental modelling. Look for as many different ways of handling the issues as possible. Consider the various tradeoffs of each. What techniques are best for exploring these models? For recording them? How can you validate a model is reasonable?


이번 kata는 DFW Practitioners 회의에서 이루어졌던 토론들에 기반하였다. 문제의 영역은 아주 간단하다. 슈퍼마켓의 상품 가격을 매기는 것!

슈퍼 마켓의 몇몇 물건들은 심플한 가격이 매겨진다.  한 캔의 콩에 $0.65 이런 식으로. 다른 것들의 가격은 더 복잡하다. 예를 들어,

  • 1달러에 3개 ( 만약 4개나 5개를 사면 가격이 어떻게 되는거지? )
  • 1파운드에 1.99달러 ( 4온스는 그럼 얼마지? )
  • 두 개를 사면 하나가 무료인 경우 ( 그럼 세번째 아이템은 가격을 가지고는 있는 건가? )

이번 kata는 코딩이 필요 없다. 이 연습 문제는 돈과 가격을 표현하는 다양한 모델을 실험하는 것이고, 이 때 이 가격들은 위의 ( 또는 다른 ) 가격 책정 스키마들을 다루기 적합할 만큼 유연해야 하며 동시에 일반적으로 사용 가능한 모델 이어야 합니다. ( 체크아웃, 재고 관리, 주문 엔트리 등등 에서 ) 다음과 같은 상황에 대해 시간을 들여 고민해 보세요.

  • 분수형 돈이 존재 할까?
  • 만약 그렇다면 언제 라운딩(rounding)이 발생할까?
  • 가격 결정에 대한 감사 추척(audit trail)은 어떻게 유지할까?(그리고 해야 할 필요가 있을까?)
  • 비용과 가격은 같은 클래스로 봐야 할까?
  • 만약 한 선반의 100개의 캔을 "두 개 사면 하나 공짜"로 가격을 매겨 놓았다면, 재고에는 얼마의 값을 매겨야 할까?

 이건 정말 최적의 샤워 타임의 kata이지만 신중해야 한다. 어떤 문제들은 처음에 생각한 것 보다 더 미묘하게 복잡할 수 있다. 내 생각에 이건, 주요 대안을 찾는 것에 한 2주 정도의 샤워 시간을 할당하는 것이 좋을 것 같다.

Goal


 이번 kata의 목적은 느슨한 스타일의 실험적 모델링을 연습하는 것이다. 가능한 많은 다양한 해결 방법을 찾아보라. 각각의 문제에 대해 다양한 대체 방법들을 생각해 보라. 이 모델들을 탐사하고 기록하는데 가장 최선의 테크닉은 어떤 것인가? 어떻게 모델이 합리적임을 입증할 수 있는가?


'100.알고리즘 > 02. Code Kata' 카테고리의 다른 글

CodeKata  (0) 2015.11.02
Posted by Righ
,

http://codekata.com


How do you get to be a great musician? It helps to know the theory, and to understand the mechanics of your instrument. It helps to have talent. But ultimately, greatness comes from practicing; applying the theory over and over again, using feedback to get better every time.

How do you get to be an All-Star sports person? Obviously fitness and talent help. But the great athletes spend hours and hours every day, practicing.

But in the software industry we take developers trained in the theory and throw them straight in to the deep-end, working on a project. It’s like taking a group of fit kids and telling them that they have four quarters to beat the Redskins (hey, we manage by objectives, right?). In software we do our practicing on the job, and that’s why we make mistakes on the job. We need to find ways of splitting the practice from the profession. We need practice sessions.

The Kata

What makes a good practice session? You need time without interruptions, and a simple thing you want to try. You need to try it as many times as it takes, and be comfortable making mistakes. You need to look for feedback each time so you can work to improve. There needs to be no pressure: this is why it is hard to practice in a project environment. it helps to keep it fun: make small steps forward when you can. Finally, you’ll recognize a good practice session because you’ll came out of it knowing more than when you went in.

Code Kata is an attempt to bring this element of practice to software development. A kata is an exercise in karate where you repeat a form many, many times, making little improvements in each. The intent behind code kata is similar. Each is a short exercise (perhaps 30 minutes to an hour long). Some involve programming, and can be coded in many different ways. Some are open ended, and involve thinking about the issues behind programming. These are unlikely to have a single correct answer. I add a new kata every week or so. Invest some time in your craft and try them.

Remember that the point of the kata is not arriving at a correct answer. The point is the stuff you learn along the way. The goal is the practice, not the solution.



위대한 음악가가 되는 법을 알고 계시나요? 이론을 알고, 여러분 악기의 매커니즘을 이해하는 것이 도움이 될 것이고 재능을 타고나는 것도 도움을 줄 것 입니다. 하지만, 궁극적으로 위대함은 연습에서 나옵니다. 이론을 반복적으로 적용하고, 피드백을 받아 매번 나아지면서 말이죠.

 위대한 운동선수가 되는 법을 알고 계시나요? 물론 피트니스와 재능이 도움을 주긴 할 겁니다. 하지만 위대한 운동선수는 매일 매일 시간에 시간을 거듭하여 연습을 합니다. 

 그런데, 소프트웨어 산업에 종사하는 우리는 이론으로 무장한 개발자들을 곧장 프로젝트에서 일하도록 내몹니다. 이것은 마치 어린 아이들을 데려와서 Redskins와 한판 붙으라고 말하는 것과 같습니다. (이봐, 객체로 어떻게든 할 수 있잖아, 응?) 소프트웨어의 경우 우리는 업무를 함과 동시에 연습을 하고 이 때문에 업무에서 실수를 하게 됩니다. 우리는 일에서 연습을 분리시키는 법을 찾아야 합니다. 즉, 우리는 연습 세션들이 필요합니다.

 The KATA

 무엇이 좋은 연습 세션을 만드는 요소일까요? 방해 받지 않는 시간, 그리고 당신이 시도해보길 원하는 간단한 것이 필요 할 것입니다. 최대한 많은 시간을 들여 이를 시도해 보아야 하며 이때, 실수를 하는 것에 인색하지 말아야 합니다.  각각의 경우 피드백을 찾아 좀 더 작업이 향상 될 수 있도록 해야 합니다. 외부적인 압박감이 있을 필요가 없습니다. 이런 면이 프로젝트 환경에서 연습을 하기 힘든 이유입니다. 이는 계속해서 재미를 느끼게 해줄 수 있습니다. 당신이 할 수 있을 때 조금만 더 전진하면 되는 일이니까요. 마지막으로 당신이 참여하기 시작할 때 보다 더 많은 것을 알게 되었다고 깨달았을 때 좋은 연습 세션이었다는 것을 알아챌 것입니다.

 Code Data는 이러한 연습의 요소들을 소프트웨어 개발로 가져오려는 시도입니다. Kata는 당신이 어떠한 폼을 아주 아주 많이, 매번 약간의 개선을 이루면서 반복하는 karate 내에서의 연습을 말합니다. Code kata 의 의도 역시 비슷합니다. 각각의 code kata는 짧은 연습 문제입니다 (아마 30분에서 1시간 정도). 어떤 것은 프로그래밍을 포함하고 다양한 많은 방법을 코딩이 가능 합니다. 어떤 것은 결론이 나지 않는 것도 있으며 프로그래밍 너머의 이슈에 대해 생각하게 하는 것도 있습니다. 이것들은 단 하나의 정확한 정답을 갖지 않을 것입니다. 저는 매 주 마다 하나의 새로운 kata를 추가할 것입니다. 당신의 기술에 약간의 시간을 투자하세요 그리고 그것들을 실행해보세요!

 Kata의 요점이 정확한 정답에 이르는 것이 아니라는 것을 명심하세요. 그 요점은 당신이 과정에서 배우는 것들입니다. 목표는 연습이지 정답이 아닙니다.

'100.알고리즘 > 02. Code Kata' 카테고리의 다른 글

Kata01: Supermarket Pricing  (0) 2015.11.06
Posted by Righ
,