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
  1. Home
  2. The Lounge
  3. When to use dependency injection?

When to use dependency injection?

Scheduled Pinned Locked Moved The Lounge
csharprubycomgraphicsgame-dev
23 Posts 14 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Super Lloyd

    Dominic Burford wrote:

    First off, stop wanting to be an ass kisser. No good ever came from wanting to kiss someone else's ass.

    Well in "The Economist" they boasted the virtue of networking, which can be expediently describes as ass kisser... Clearly I need to work on my networking too, as I suffered greatly last year from expressing my opinion (main customer doesn't want me anymore) and nothing came out of it anyway! Further it appeared to me that skill and work will only take you so far...

    Dominic Burford wrote:

    Second, I'm always suspicious whenever I see a technology being used everywhere throughout an application. It makes me think that they don't really know how to use it properly.

    I think so too! But it's obvious unless I can win the battle I better leave the boat or join the bandwagon. Arguing left me in a bad spot.. I'm tired of arguing... It only cause me trouble and people don't listen... Further I'm quite contended now, so I don't have a pressing need to find the best tool, I think I already played with it! ;P and I am ready to go on board financially with people who still resist them! :rolleyes: :laugh:

    All in one Menu-Ribbon Bar DirectX for WinRT/C# since 2013! Taking over the world since 1371!

    J Offline
    J Offline
    jschell
    wrote on last edited by
    #21

    Super Lloyd wrote:

    Further it appeared to me that skill and work will only take you so far...

    All that matters is whether someone can sell it. Doesn't need to work well. Doesn't even need to run. But absolutely must sell. Unless of course you like working for free.

    Super Lloyd wrote:

    and people don't listen.

    Yep. Realistically the idiom that you are using now is unlikely to adversely impact the running of the product. Costs more in maintenance and adds complexity. And in my experience over time it tends to make the code more like structured code and less like OO code. But none of that can be quantified as a real cost. Or at least it is a good bet that your company can't actually measure maintenance costs and never will. So just do it.

    1 Reply Last reply
    0
    • E Ed K

      Regarding your INowResolver which as stated below it's understandable especially for testing. There are better ways to handle that. From ayende.com[^].

      public static class SystemTime
      {
      public static Func Now = () => new SqlDateTime(DateTime.Now).Value;
      }

      Then in tests

      SystemTime.Now = () => new DateTime(2000,1,1);

      ed ~"Watch your thoughts; they become your words. Watch your words they become your actions. Watch your actions; they become your habits. Watch your habits; they become your character. Watch your character; it becomes your destiny." -Frank Outlaw.

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #22

      Yeah, it's what I adopted in my own home made project! I want my home made library of utilities to work out of the box! I don't want to write lines of (obscure) initialization! :-D

      All in one Menu-Ribbon Bar DirectX for WinRT/C# since 2013! Taking over the world since 1371!

      1 Reply Last reply
      0
      • A al13n

        While INowResolver seems like overkill, sometimes tests need to fix the time to get reproducible behavior. I find using the registry is similar, as are really any external data stores or sources of info, ie random numbers too. Unit tests should never rely on external input to work correctly. MUCH easier said than done. So I get it, and I also get where you're coming from. It's certainly a shock to the system when you're used to the ease of static methods. Good luck with it!

        C Offline
        C Offline
        Chad3F
        wrote on last edited by
        #23

        Has everyone written their Y2.038K unit tests yet? We don't want to wait till the last minute, like Y2K, when the legacy 32-bit time_t range is about to run out. :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

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