Skip to content

Commit b7a5619

Browse files
committed
Merge branch 'md_cleanup'
2 parents e8adc5a + 2d517ef commit b7a5619

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

chapters/design_patterns/builder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ builder.newTodo "Fill gas tank"
8787
### Exercises
8888

8989
* Expand the project- and context-tag generation code to filter out duplicate entries.
90-
* Some Todo.txt users like to insert project and context tags inside the description of their to-do items. * Add code to identify these tags and filter them out of the end tags.
90+
* Some Todo.txt users like to insert project and context tags inside the description of their to-do items. Add code to identify these tags and filter them out of the end tags.

chapters/design_patterns/strategy.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ Encapsulate your algorithms inside of Strategy objects.
1313

1414
Given an unsorted list, for example, we can change the sorting algorithm under different circumstances.
1515

16+
###The base class:
17+
1618
{% highlight coffeescript %}
1719
StringSorter = (@algorithm) ->
18-
sort: (list) ->
19-
@algorithm list
20+
sort: (list) -> @algorithm list
21+
{% endhighlight %}
2022

23+
###The strategies:
24+
25+
{% highlight coffeescript %}
2126
bubbleSort = (list) ->
2227
anySwaps = false
2328
swapPass = ->
@@ -45,7 +50,11 @@ reverseBubbleSort = (list) ->
4550
anySwaps = false
4651
swapPass()
4752
list
53+
{% endhighlight %}
54+
55+
###Using the strategies:
4856

57+
{% highlight coffeescript %}
4958
sorter = new StringSorter bubbleSort
5059

5160
unsortedList = ['e', 'b', 'd', 'c', 'x', 'a']

0 commit comments

Comments
 (0)