Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

James Simpson

@James Simpson
About
Posts
209
Topics
38
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • A proper DI implementation?
    J James Simpson

    I think my examples are probably more confusing than they should be. if you develop your layers without thinking about the DI layer, just rely on getting dependencies into objects via a constructor, you can add the DI container later. Typically the container would resolve the controller (transparent to your code) and inject an instance of a factory, or repository, or service.. or whatever is needed Then in the example of the IOrderFactory, the create could also be implemented to resolve the Order object from the same container But, if the Order is an Entity you should be using a IOrderRepository to manipulate it, and this can include the factory method Create() The key is to not architect your layers with the DI container in mind, just use the right sort of services to get the job done, at the end of the day they *might* be implemented using a DI container, they might not... if you working with this sort of technology your probably trying to unit test too, so if you get this right, it will probably lead you down the right path anyway. Google sturcture map ASP.NET MVC implementation there are some good articles that demonstrate the idea behind a simple DI container and MVC. Good luck James

    James Simpson Web Solutions Developer www.methodworx.com

    ASP.NET tutorial question learning workspace

  • A proper DI implementation?
    J James Simpson

    In the example you provided you are not initializing the Order class via the container. uc.Resolve() creates an instance of the Order and then resolves its dependencies This is why you would end up with more specialized services to initialize the objects, that are typically implemented with the container. e.g Lets, say Order is an Entity in a domain model, you have several options about how you initialize a new one, a typical way is to have a factory, e.g IOrderFactory.Create(). Lets say for the sake of argument you are using ASP.NET and you are using dependency injection to initialize your controller paramerters via a custom controller factory (if you are unsure about that, basically a DI container is supplying dependencies to Controllers) You would have a dependency to IOrderFactory in your controller constructor which would implement create as: return uc.Resolve(); Your order factory would be injected to your controller, and you can call orderFactory.Create() to get a new instance. Or.. Inject the DI container into your controllers and just always call .Resolve. But I dont like to know about the DI container anywhere in my code, I prefer to have proper named services. e.g IOrderFactory is explicit, it is a Factory for creating Order objects, but by just handing a reference to your DI container everywhere you are actually hiding the dependencies. (e.g from the constructor parameters, it is not obvious what dependencies are going to be used and why) Also - (off topic), with the example you specified above, if Order is an entity in your domain model, and you are attempting to add logging functionality to it, it is better to use a Dynamic Proxy pattern to acheive this (or) Aspect Orientated programming. It is not a dependency of the Order object to have logging functionality, it is more likely a dependency of your infrasturcture. So rather than cluttering up your order object with stuff it does not need, you can inject a Logging mechanism transparently using something like Castle Dynamic Proxy (?) You will still need to get the object from some sort of factory, but it will make your classes much cleaner.

    James Simpson Web Solutions Developer www.methodworx.com

    ASP.NET tutorial question learning workspace

  • A proper DI implementation?
    J James Simpson

    The DI framework is usually a component of the application layer (in my experience) e.g If you had an ASP.NET MVC App and you were using structure map, its your front end application that would reference structure map, the rest of your code below that stack does not need to know about the DI container becuase its dependencies would be resovled by the main application (E.g MVC) Then the rest of your dependencies etc.. you could seperate the interfaces from the concrete classes, but I would only do that when its required. You could start with a simple MyCompany.MyDivision.Framework.Logging project that contains the ILogger and the SpecialLogger. Becuase the DI container is just references in the top of the stack (e.g the MVC app) it already has references to the components below it, so no circular reference is created. If you find yourself reference the DI container lower down the stack then you may run into problems, there are usually more specific services you can implement for resolving things the DI container could provide. e.g Lets Say you had the Logging assebly, a Domain Layer assembly, and a front end project, and the requirements where for the front end project to have references to the domain layer and logger, but you dont want interdependencies between the two: Then lets imagine you had a bunch of repositories that needed resolving in your domain data access layer, that could be a IRepositoryRegistry interface, but it could be implemented in the app up the stack to look at the DI container to return a repository. There would be no need for your logging assembly to ever use IRepositoryRegistry, so you don't end up with dependencies between those sort of assemblies. James

    James Simpson Web Solutions Developer www.methodworx.com

    ASP.NET tutorial question learning workspace

  • Guildines?
    J James Simpson

    Commercial is a tricky definition tho.. if its free to end users, does that make it non commercial. (there are other ways of generating revenue) There is not much activity on this board, and maybe thats becuase of the guildeines... I mean, the title clearly states collaboration / beta testing, so I would think it should be fair to allow projects wanting beta testers, to post here. I would also expect projects requiring beta testers to be free of cost or incentivise the testers, even though the nature of the product may become commercial. Wanting beta testers + getting your product exposure is being legit, obviously people would want the exposure offered by this sort of forum, becuase they want to attract beta testers (to help development).. and ultimatly gain a user base. Without the exposure both the forum and its purpose are pointless. James

    James Simpson Web Solutions Developer www.methodworx.com

    Collaboration / Beta Testing com beta-testing question

  • Guildines?
    J James Simpson

    If someone posted a message on here asking for people to come look at Website (/Product) XYZ because it needed beta testers, would that be classed as Advertising, or would that be fair play! :) Thanks, James

    James Simpson Web Solutions Developer www.methodworx.com

    Collaboration / Beta Testing com beta-testing question

  • A question of style: Inline code in .aspx pages.
    J James Simpson

    With ASP.NET MVC, when done properly the seperation is still there. Use a good view engine and stick to using display/editor templates, including display templates for lists and you end up with just standard Html.RenderMeSomethingOnThePage calls which pretty much represent the same magic as the blocks a designer would have to deal with. But, in response to your original question - yes, you should seperate (And keep view logic down to a minimum).. but does anyone ever do that? Nobody I have ever worked with did! (including myself)

    James Simpson Web Solutions Developer www.methodworx.com

    The Lounge html asp-net architecture question csharp

  • Contracting in Europe
    J James Simpson

    Yea, I understand that I will have to pay the tax somewhere! :) And my concern is not with the HMRC, I will be paying Corporation tax and PAYE as normal, but my query was wether I would be liable with the 180 day rule in Copenhagen, as per Danish tax law ;)

    James Simpson Web Solutions Developer www.methodworx.com

    The Lounge com tutorial question code-review

  • Contracting in Europe
    J James Simpson

    Its important I get the rate right I guess! Flats go for 500 to 800 euro per month so my rate should cover that. I guess I just need to make sure there are no hidden expenses that I wont know about until I arrive there. Im mainly concerned about the income tax rules, my investigation leads me to beleive becuase I will be working for 6 months I wont be liable for their income tax on top of my HMRC Corporation tax, and PAYE. James

    James Simpson Web Solutions Developer www.methodworx.com

    The Lounge com tutorial question code-review

  • Contracting in Europe
    J James Simpson

    Hi, I have a possibility of a 6 month contract in Copenhagen. Has anyone worked in Denmark and understand the tax liabilities? I think there is a 180 day rule which means I would only need to pay tax to HMRC. I'm Late 20's, I don't live with my better half, so it should'nt be too much of an adjustment, im just worried the excitement would wear of after 3 months, so any personal experiences on how to make improve working away from home?? Also, what sort of rate adjustment would you make for a temporary contract in Europe.. bearning in mind that I would need to rent an apartment (this looks like the cheapest way!) I've added about 30% on my basic rate for this... Thanks, James

    James Simpson Web Solutions Developer www.methodworx.com

    The Lounge com tutorial question code-review

  • What is your Visual Studio or IDE color scheme?
    J James Simpson

    Love it

    James Simpson Web Solutions Developer www.methodworx.com

    The Lounge visual-studio question csharp com

  • Biography on members page...
    J James Simpson

    Yea, I think your right.. maybe a spoofed account. James

    James Simpson Web Developer imebgo@gmail.com

    The Lounge question com adobe

  • Biography on members page...
    J James Simpson

    Thanks! I've been a member 7 years I don't ever recall using that form! Cheers, James

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge question com adobe

  • Biography on members page...
    J James Simpson

    how do you set it?

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge question com adobe

  • Biography on members page...
    J James Simpson

    Same line under "Technical Blogs" section on the profile... I must admit this is new functionality to me! :) Am I missing something?

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge question com adobe

  • Biography on members page...
    J James Simpson

    Why does mine say "The Starwood Preferred Guest Credit Card from American Express - Find competitive, low prices on air, hotel, car rental reservations."??? Im confused

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge question com adobe

  • Using visual studio on my laptop and at home.
    J James Simpson

    Use Subversion* to get a local copy onto your laptop? Good practice for projects to keep track of source code changes? * Or a another SCC provider your familiar with? You could also host the source code online, so you can get access to it anywhere? an example of this would be unfuddle.com[^] free, or www.projectlocker.com[^] for about $5 a month (i use the latter with no problem!)

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge

  • Preferred hardware for developers?
    J James Simpson

    I suppose if you get paid $700 an hour, the amount you save swapping ram out in a lifetime could pay for that mac :)

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge csharp asp-net design hardware testing

  • Preferred hardware for developers?
    J James Simpson

    And they probably still cost half as much

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge csharp asp-net design hardware testing

  • First article this year
    J James Simpson

    How about an article about a syntax highlighting editor (e.g html, xml) for the web? I doubt it would be the first article... I havent finished the control yet :)

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge

  • Movie recommendation
    J James Simpson

    Agreed, awesome film... But from your list you should definitly watch Requiem for a Dream James

    James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    The Lounge data-structures question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups