Announcing the Sourcegraph developer release: The intelligent, hackable code host for teams https://sourcegraph.com/blog/133554180524/announcing-the-sourcegraph-developer-release-the
The problem I see is that the service locator is a singleton and I might need different dataSources in the same runtime.
In some languages, there is the notion of dynamically-scoped variables (Emacs Lisp) or fluids (https://www.gnu.org/software/guile/manual/html_node/Fluids-and-Dynamic-States.html) which basically mean that to find MyService, the language runtime will walk up the stack until I find a special tag saying "MyService is in fact PostgresqlService".
Couldn't these special scopes be used to define services that are different according to which part of the code requests them? (By "parts of the code" I mean "dynamic roots".)
Maybe we should look a bit more into the tricks that we can do with stacks, switching them, coroutines which stacks are each "in a parallel world", and the incredible "call-with-current-continuation" function in Scheme?
You could have as many service locators as you have services, but I think in the general case, you don't want more than one service locator -- otherwise the problem of finding the service implementation just becomes the problem of finding the right service locator.
An alternative is outlined in Fowler's article near the bottom (JS example), where you're basically handing down the dependencies from the top, minimizing the "environment" that you hand down appropriately. A similar approach is taken by the component library for Clojure.
This also comes with a price, of course.
- Amadeus IT GroupDeveloper Advocate, 2015 - present
- Amadeus IT GroupSoftware Development Engineer, 2012 - 2015
- AstekSoftware Development Engineer, 2011 - 2013
- ReplyConsultant, 2010 - 2011
fahd.blog: Java 8: Sorting a List using Lambdas and Method References
This post shows how you can use Java 8 lambda expressions and method references to sort a list of Person objects by age. In Java 8, the List
Scientifically Proven Ways to Persuade & Influence Others
A good book I often recommend is: Yes!: 50 Scientifically Proven Ways to Be Persuasive by Dr. Robert B. Cialdini et al. I first read the boo
Seth's Blog: The difference between commitment and technique
We spend way too much time teaching people technique. Teaching people to be good at flute, or C++ or soccer. It's a waste because the fact i
Four of our most watched videos you should check out now
Have a look below at four of our most popular videos that you should have a look at now if you have not already.
Win a FREE Nikon D800 or Canon 5D Mark III plus more!
SnapKnot along with Miller's Professional Imaging, SmugMug and BorrowLenses are giving away your choice of a brand new Nikon D800 or Canon 5
In the last 30 seconds there were 1,565,880 Facebook likes.
From tweets to likes, see how fast data is generated every second on the internet in this interactive visualization.
HTML5 UP! Responsive HTML5 and CSS3 Site Templates
Responsive HTML5 and CSS3 site templates designed by @n33co.