<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
"ANComponent userRepository"<br>
userRepository<br>
TheUserRepository ifNil: [TheUserRepository := GDRepository for: ANUser].<br>
^ TheUserRepository<br>
<br>
"ANComponent>>initialize"<br>
initialize<br>
super initialize.<br>
userRepository := ANComponent userRepository.<br>
<br>
</blockquote></div><br>I agree with James but I'll be more specific, how about this...<br><br>
UserRepository class>>forApp: anApp<br> ^ (Repository ifNil: [Repository := Dictionary new ])<br> at: anApp ifAbsentPut: [ GDRepository for: ANUser ]<br> <br>
<br>
ANComponent>>initialize<br> super initialize.<br> userRepository := UserRespository forApp: self session baseUrl printString.<br><br>No need to stick the repository on a component class, create a unique class just for it, you get an automatic singleton because classes *are* singletons and why shouldn't a user repository be its own abstraction?<br>
<br>Ramon Leon<br><a href="http://onsmalltalk.com">http://onsmalltalk.com</a><br>