Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 117 lines (75 sloc) 3.086 kB
24abfb9 @raganwald I have another question
raganwald authored
1 I have a question about organizing projects:
2 ===
3
4 If someone wrote code like this:
5
6 class Account
7 ...
8 end
9
10 class Customer
11 ...
12 end
13
14 class Displayamajig
15
16 def display_account(account)
17 ...
18 end
19
20 def display_customer(customer)
21 ...
22 end
23
24 ...
25
26 end
27
28 class Persistamajig
29
30 def persist_account(account)
31 ...
32 end
33
34 def retrieve_account(account_identifier)
35 ...
36 end
37
38 def persist_customer(customer)
39 ...
40 end
41
42 def retrieve_customer(customer_identifier)
43 ...
44 end
45
46 ...
47
48 end
49
50 ...
51
52 Would you suggest they rewrite things like this?
53
54 class Account
55
56 def display
57 ...
58 end
59
60 def persist
61 ...
62 end
63
1399742 @raganwald identifier parameters added
raganwald authored
64 def retrieve(identifier)
24abfb9 @raganwald I have another question
raganwald authored
65 ...
66 end
67
68 ...
69
70 end
71
72 class Customer
73
74 def display
75 ...
76 end
77
78 def persist
79 ...
80 end
81
1399742 @raganwald identifier parameters added
raganwald authored
82 def retrieve(identifier)
24abfb9 @raganwald I have another question
raganwald authored
83 ...
84 end
85
86 ...
87
88 end
89
90 If so, wouldn't it make sense that if you saw an application organized like this:
91
92 [![A Standard Rails App](http://farm4.static.flickr.com/3609/3349332232_75c370f812_o.png)](http://www.flickr.com/photos/raganwald/3349332232/ "A Standard Rails App")
93
94 That you should refactor it into this:
95
96 [![A Refactored Rails App](http://farm4.static.flickr.com/3440/3348520567_3030b63a31_o.png)](http://www.flickr.com/photos/raganwald/3348520567/ "A Refactored Rails App")
97
d78b434 @raganwald discussion links
raganwald authored
98 **Why? Why not??**
99
bddc0c7 @raganwald slimmed and trimmed links down
raganwald authored
100 *Join the discussion on [Hacker News](http://news.ycombinator.com/item?id=513472)*.
24abfb9 @raganwald I have another question
raganwald authored
101
7d4a695 @raganwald dasherize the mores
raganwald authored
102 ---
f69ce70 @raganwald Link to the book
raganwald authored
103
8c4fb37 @raganwald My recent work
raganwald authored
104 My recent work:
105
f9d4487 @raganwald allongé
raganwald authored
106 ![](http://i.minus.com/iL337yTdgFj7.png)[![JavaScript Allongé](http://i.minus.com/iW2E1A8M5UWe6.jpeg)](http://leanpub.com/javascript-allonge "JavaScript Allongé")![](http://i.minus.com/iL337yTdgFj7.png)[![CoffeeScript Ristretto](http://i.minus.com/iMmGxzIZkHSLD.jpeg)](http://leanpub.com/coffeescript-ristretto "CoffeeScript Ristretto")![](http://i.minus.com/iL337yTdgFj7.png)[![Kestrels, Quirky Birds, and Hopeless Egocentricity](http://i.minus.com/ibw1f1ARQ4bhi1.jpeg)](http://leanpub.com/combinators "Kestrels, Quirky Birds, and Hopeless Egocentricity")
4479986 @raganwald More recent work!
raganwald authored
107
f9d4487 @raganwald allongé
raganwald authored
108 * [JavaScript Allongé](http://leanpub.com/javascript-allonge), [CoffeeScript Ristretto](http://leanpub.com/coffeescript-ristretto), and my [other books](http://leanpub.com/u/raganwald).
21fcc00 @raganwald redirect to allong.es
raganwald authored
109 * [allong.es](http://allong.es), practical function combinators and decorators for JavaScript.
17be325 @raganwald revised footers
raganwald authored
110 * [Method Combinators](https://github.com/raganwald/method-combinators), a CoffeeScript/JavaScript library for writing method decorators, simply and easily.
4f7cce6 @raganwald githiub
raganwald authored
111 * [jQuery Combinators](http://github.com/raganwald/jquery-combinators), what else? A jQuery plugin for writing your own fluent, jQuery-like code.
f69ce70 @raganwald Link to the book
raganwald authored
112
16fa4bb @raganwald separated .sig
raganwald authored
113 ---
114
b2b5c4a @raganwald shuffle
raganwald authored
115 (Spot a bug or a spelling mistake? This is a Github repo, fork it and send me a pull request!)
116
7e71700 @raganwald updated links
raganwald authored
117 [Reg Braithwaite](http://braythwayt.com) | [@raganwald](http://twitter.com/raganwald)
Something went wrong with that request. Please try again.