Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

ID: 28673, Roll Your Own Dependency Injection demo

by Sean B. Durkin Email: Anonymous

This is a demo program provided for a blog entry in the ADUG blog.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 16.1  to 16.1 76 downloads
Copyright: No significant restrictions

Size: 16,157 bytes
Updated on Tue, 20 Dec 2011 17:59:34 GMT
Originally uploaded on Mon, 19 Dec 2011 23:07:18 GMT
SHA1 Hash: 4FD5B1B83CC77B650588197A21B36E42037A83D5
MD5 Hash: F6B4D03BE38A3959FFD6F54C84A59512

    Explore the files in this upload

In Part 1 we covered the beginnings of rolling your own Dependency Injection framework as an alternative to using the Delphi Spring Framework. We discussed the patterns and objects involved and described using RTTI to perform the actual injection. Now we'll look at an example of using DI to inject logging functionality into an object.

So, here is what DI looks like in action. Let's say you build a car and all the salient action on that car, including construction, is logged in a logger. In Listing 1, ILogger is an interface to some event logger like CodeSite, SmartInspect or maybe just writes lines to a text file. ICar uses an instance of ILogger on the inside to record vehicle events.
(continued in blog)

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03