Pricefield | Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
@[email protected] to Programmer [email protected] • 2 years ago

Everyone should have a tool-building factory factory factory

i.ibb.co

message-square
59
fedilink
568

Everyone should have a tool-building factory factory factory

i.ibb.co

@[email protected] to Programmer [email protected] • 2 years ago
message-square
59
fedilink
  • @[email protected]
    link
    fedilink
    2•2 years ago

    Do you write unit tests with objects mocked via interfaces? Or polymorphism via interfaces? Those are the main reasons to use DI.

    • Ethan
      link
      fedilink
      1•2 years ago

      I use various strategies depending on what seems appropriate, including the two you mention. I’ve never felt the lack of DI.

    • @[email protected]OP
      link
      fedilink
      1•2 years ago

      I guess I have to start calling function invocation with generic parameters, fancy names (like “dependency injection” ^^)

      • @[email protected]
        link
        fedilink
        1•2 years ago

        Yea that works too.

      • @[email protected]
        link
        fedilink
        2•2 years ago

        Relevant:

        I also prefer the simpler explanation.

        https://www.jamesshore.com/v2/blog/2006/dependency-injection-demystified

      • @[email protected]
        link
        fedilink
        2•
        edit-2
        2 years ago

        As I read somewhere:

        Dependency Injection is a 25-dollar term for a 5-cent concept.

Programmer [email protected]

[email protected]
Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
  • 43 users / day
  • 307 users / week
  • 1.13K users / month
  • 4.42K users / 6 months
  • 3 subscribers
  • 1.57K Posts
  • 55.9K Comments
  • Modlog
  • mods:
  • Feyter
  • adr1an
  • @[email protected]
  • Pierre-Yves Lapersonne
  • UI: 0.18.4
  • BE: 0.18.2
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org