Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/asir.rb | 242 | 18 | 100.00%
|
100.00%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 # !SLIDE |
2 # Abstracting Services in Ruby |
3 # |
4 # * Kurt Stephens |
5 # * Enova Financial |
6 # * 2012/01/25 |
7 # * Slides -- "":http://kurtstephens.com/pub/ruby/abstracting_services_in_ruby/asir.slides/ |
8 # * Code -- "":http://kurtstephens.com/pub/ruby/abstracting_services_in_ruby/ |
9 # * Git -- "":http://github.com/kstephens/abstracting_services_in_ruby |
10 # * Tools |
11 # ** Riterate -- "":http://github.com/kstephens/riterate |
12 # ** Scarlet -- "":http://github.com/kstephens/scarlet |
13 # |
14 # !SLIDE END |
15 |
16 # !SLIDE |
17 # Issues |
18 # |
19 # * Problem Domain, Solution Domain |
20 # * Service Middleware Semantics |
21 # * Testing, Debugging, Diagnostics |
22 # * Productivity |
23 # |
24 # !SLIDE END |
25 |
26 # !SLIDE |
27 # Problem Domain, Solution Domain |
28 # |
29 # * Client knows too much about infrastructure. |
30 # * Evaluating and switching infrastructures. |
31 # |
32 # !SLIDE END |
33 |
34 # !SLIDE |
35 # Service Middleware Semantics |
36 # |
37 # * Directionality: One-way, Two-way |
38 # * Synchronicity: Synchronous, Asynchronous, Delayed, Buffered |
39 # * Distribution: Local Thread, Local Process, Distributed |
40 # * Transport: File, IPC, Pipe, Network |
41 # * Robustness: Retry, Replay, Fallback |
42 # * Encoding: XML, JSON, YAML, Base64, Compression |
43 # |
44 # !SLIDE END |
45 |
46 # !SLIDE |
47 # Testing, Debugging, Diagnostics |
48 # |
49 # * Configuration for testing and QA is more complex. |
50 # * Measuring test coverage of remote services. |
51 # * Debugging the root cause of remote service errors. |
52 # * Diagnostic hooks. |
53 # |
54 # !SLIDE END |
55 |
56 # !SLIDE |
57 # Objectives |
58 # |
59 # * Simplify service/client definitions and interfaces. |
60 # * Anticipate new encoding, delivery and security requirements. |
61 # * Separate encoding and transport concerns. |
62 # * Composition over Configuration. |
63 # * Elide deployment decisions. |
64 # * Integrate diagnostics and logging. |
65 # * Simplify testing. |
66 # |
67 # !SLIDE END |
68 |
69 # !SLIDE |
70 # Foundations of Objects |
71 # |
72 # * Message |
73 # * State |
74 # * Behavior |
75 |
76 # !SLIDE |
77 # Messaging |
78 # |
79 # * "Call a Method", "Call a Function" are all the same, in *all* languages. |
80 # ** Decomposed lookup() and apply(). |
81 # * "Send Message", not "Call a Method". |
82 # * Messaging abstracts: |
83 # ** Object use from its implemenation. |
84 # ** Transfer of control (method, function invocation). |
85 |
86 # !SLIDE |
87 # REST |
88 # |
89 # "Roy Fielding - Architectural Styles and the Design of Network-based Software Architectures":http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm |
90 # |
91 # * Imperative Action .vs. Behavorial Resource |
92 # * REST Connector .vs. REST Component |
93 # |
94 # !SLIDE END |
95 |
96 # !SLIDE |
97 # Design |
98 # |
99 # * Nouns -> Objects -> Classes |
100 # * Verbs -> Responsibilities -> Methods |
101 # |
102 # h3. Book: "Designing Object-Oriented Software" |
103 # * Wirfs-Brock, Wilkerson, Wiener |
104 # |
105 # !SLIDE END |
106 |
107 # !SLIDE |
108 # Design: Nouns |
109 # |
110 # * Service -> Module |
111 # * Client -> Just a Ruby caller |
112 # * Proxy |
113 # * Request -> Just a method call. |
114 # * Response, Exception (two-way) -> Return value or else. |
115 # * Transport -> (file, pipe, http, queue, ActiveResource) |
116 # * Encoder, Decoder -> Coder (Marshal, XML, JSON, ActiveResource) |
117 # * Logging |
118 # |
119 # !SLIDE END |
120 |
121 # !SLIDE |
122 # Design: Verbs |
123 # |
124 # * Intercept Request -> Proxy |
125 # * Invoke Request -> Request |
126 # * Invoke Exception |
127 # * Send Request, Recieve Request -> Transport |
128 # * Encode Object, Decode Object -> Coder |
129 # |
130 # !SLIDE END |
131 |
132 # !SLIDE |
133 # Simple |
134 # |
135 # !PIC BEGIN |
136 # |
137 # box "Client" "(CustomersController" "#send_invoice)"; arrow; |
138 # ellipse "Send" "Request" "(Ruby message)"; arrow; |
139 # box "Service" "(Email.send_email)"; |
140 # |
141 # !PIC END |
142 # |
143 # !SLIDE END |
144 |
145 # !SLIDE |
146 # Client-Side Request |
147 # |
148 # !PIC BEGIN |
149 # box "Client"; arrow; |
150 # ellipse "Proxy"; arrow; |
151 # ellipse "Create" "Request"; arrow; |
152 # ellipse "Encode" "Request"; arrow; |
153 # ellipse "Send" "Request"; |
154 # line; down; arrow; |
155 # !PIC END |
156 # |
157 # !SLIDE END |
158 |
159 # !SLIDE |
160 # Server-Side |
161 # |
162 # !PIC BEGIN |
163 # down; line; right; arrow; |
164 # ellipse "Receive" "Request"; arrow; |
165 # ellipse "Decode" "Request"; arrow; |
166 # ellipse "Request"; |
167 # line; down; arrow; |
168 # IR: ellipse "Invoke" "Request"; |
169 # right; move; move; |
170 # Service: box "Service" with .w at IR.e + (movewid, 0); |
171 # arrow <-> from IR.e to Service.w; |
172 # move to IR.s; down; line; |
173 # left; arrow; |
174 # ellipse "Create" "Response"; arrow; |
175 # ellipse "Encode" "Response"; arrow; |
176 # ellipse "Send" "Response"; |
177 # line; down; arrow |
178 # !PIC END |
179 # |
180 # !SLIDE END |
181 |
182 # !SLIDE |
183 # Client-Side Response |
184 # |
185 # !PIC BEGIN |
186 # down; line; left; arrow; |
187 # ellipse "Receive" "Response"; arrow; |
188 # ellipse "Decode" "Response"; arrow; |
189 # ellipse "Response"; arrow; |
190 # ellipse "Proxy"; arrow; |
191 # box "Client"; |
192 # !PIC END |
193 # |
194 # !SLIDE END |
195 |
196 # !SLIDE |
197 # Implementation |
198 # |
199 # * Primary Base classes: Transport, Coder |
200 # * Primary API: Proxy via Client mixix |
201 # * Handful of mixins. |
202 # |
203 |
204 # !SLIDE |
205 # Modules and Classes |
206 module ASIR |
207 # Reusable constants to avoid unnecessary garbage. |
208 EMPTY_ARRAY = [ ].freeze; EMPTY_HASH = { }.freeze; EMPTY_STRING = ''.freeze |
209 MODULE_SEP = '::'.freeze; IDENTITY_LAMBDA = lambda { | x | x } |
210 |
211 end |
212 # !SLIDE END |
213 |
214 require 'asir/error' |
215 require 'asir/log' |
216 require 'asir/initialization' |
217 require 'asir/additional_data' |
218 require 'asir/object_resolving' |
219 require 'asir/request_identity' |
220 require 'asir/code_more' |
221 require 'asir/request' |
222 require 'asir/response' |
223 require 'asir/client' |
224 require 'asir/coder' |
225 require 'asir/transport' |
226 require 'asir/channel' |
227 require 'asir/transport/local' |
228 |
229 # !SLIDE |
230 # Synopsis |
231 # |
232 # * Services are easy to abstract away. |
233 # * Separation of transport, encoding. |
234 # |
235 # !SLIDE END |
236 # |
237 # !SLIDE |
238 # Appendix |
239 # |
240 # |
241 # !SLIDE END |
242 |
Generated on Fri Jan 27 17:37:46 -0600 2012 with rcov 0.9.8