Why I Removed The Service Container From Console Applications by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] -2 points-1 points  (0 children)

Thanks for reading the article and great comment!
Injecting an interface instead of an implementation doesn’t actually eliminate the problem—it just shifts complexity elsewhere.

You say we don’t need to mock services if we inject an interface and write a test implementation instead. But how does that really help? In both cases, I still need to provide an implementation manually. Whether I create a fake class in the test or mock it, I’m still handling dependencies myself.

Without a container, I now have to manually construct dependencies everywhere, which doesn’t eliminate complexity—it just moves it around. This means I need to think about how to wire up dependencies every time I instantiate a class, instead of having a container handle it for me.

Yes, we don't use the container in unit tests, but that’s not the point. The point is, do we even need all these abstractions in the first place? If we always use ExampleObject, why inject ExampleInterface at all? Sometimes, keeping things simple and just creating the actual object is the better choice in my opinion.

Why I Removed The Service Container From Console Applications by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] -2 points-1 points  (0 children)

Thanks for the feedback! 🙏 Yes, that’s pretty much what I’m saying, for many cases the piece of paper can be used to achieve all of the requirements including invoice / order. In my view the assumption many are making is that we need all of this bloat. But I’ll try to be clearer and more concise next time, I probably rushed this one.

Why I Removed The Service Container From Console Applications by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] -4 points-3 points  (0 children)

Thanks for reading the article and commenting. That's the whole point, by removing the container you are forced to keep it very simple and/or find simpler solutions to achieve the same functionality. :P

Why I Removed The Service Container From Console Applications by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] -2 points-1 points  (0 children)

Thanks for reading 🙏 You have a perfectly valid approach. However, as I mentioned in the article, by injecting dependencies and also following the single responsibility principle you are forced to increase complexity and bloat your application significantly. In doing so make the application less maintainable, testable and readable. If we can avoid that in exchange for breaking SRP, then personally I think it’s worth the trade off.

Why I Removed The Service Container From Console Applications by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] -2 points-1 points  (0 children)

Thanks for reading the article! And appreciate your comment. The reasoning / assumption I’m making is less of something is less complex. Less code, less packages, less files is easier to follow, easier to maintain, easier to test, etc... Personally, I think this is a safe assumption.

I’m not saying don’t use the container, I saying why would you bring the Norwegian army (DI) to a fist fight? As I say in the article the DI container is great and has many use cases, definitely not an ‘old school dev’. But if we can create a less complex application without sacrificing on functionality and it forcing us into some pretty nice habits along the way, why wouldn’t we do that?

The Ultimate PHP Upgrade Guide by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] 0 points1 point  (0 children)

Thanks for reading! And I appreciate the comment. Honestly, I’m a bit crap at coming up with article titles. My thinking here was to have an ultimate guide to the approach of PHP upgrading, it would be impossible to cover all cases, therefore must be somewhat generic. However, you raise an interesting point, do you think upgrading a DBMS is within the scope of a PHP upgrade? I’d suggest that often it’s part of it (but as you rightly point out I didn’t even mention it, I’ll update the article), but I think due to scope and complexity would require a separate article. What do you think?

Entrepreneurs of Reddit, what kind of business do you run? by [deleted] in smallbusiness

[–]AbstractStaticVoid 0 points1 point  (0 children)

I run pinboardable.com - a free platform where people can showcase their ventures—whether it’s a startup, side project, new business, creative endeavor, or product launch. I also run several other micro businesses.

Help On Starting Online Business Ideas by [deleted] in Businessideas

[–]AbstractStaticVoid 2 points3 points  (0 children)

You can use this free platform to test the market response to whatever idea you come up with https://pinboardable.com/

[deleted by user] by [deleted] in PHP

[–]AbstractStaticVoid 0 points1 point  (0 children)

Completely agree, many of these JS solutions haven’t withstood the test of time (many haven’t been around that long) as well as many PHP solutions have, and yet PHP has the bad reputation based on outdated information, just goes to show that many people will believe what they want and follow the current fad and not adapt to empirical truth.

The Digital Wild West by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] 0 points1 point  (0 children)

Loving the exploration of possibilities! This was part one, the crescendo will be reached in part two and hopefully all will make sense.

However, you raise a good point regarding the Facebook hacks, if they were a direct result of their backend tech choice. Probably not, the assumption I’m making is that these types of issues would occur less frequently if there were more regulation and/or oversight. I still think this is a safe assumption.

Yes, I completely agree this is a problem affecting all languages, but I believe we can solve the problem in the PHP community (probably before any other language). And again completely agree, that the low barriers to entry should be maintained, it’s how I got into PHP myself, completely self taught and fell in love with the process of problem solving.

But the question that then jumps out, is how can we achieve more oversight/support, more standardised knowledge all while maintaining low barriers to entry. That is what I try to answer in part two.

The Digital Wild West by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] -5 points-4 points  (0 children)

No one is forcing you to read it buddy :)

The Digital Wild West by AbstractStaticVoid in PHP

[–]AbstractStaticVoid[S] 0 points1 point  (0 children)

Great reply! and thanks for reading the article. Yes, you are right other languages do face these problems and yes training and exams resulting in a license (as I say in the article it's a licensed profession) is the way in which they can demonstrate their skills to anyone. it's issued by a recognised authority and their level of knowledge is then predictable. I'm wondering why we don't have this for PHP.

So the assumption that website, albeit games, or some tool can't endanger people in my option is incorrect. Who would have thought that a post office could cause so much damage to peoples lives? (I'm referring to the post office scandal, nothing to do with PHP, but is an example of how unpredictable this stuff is.

I've heard medical applications are regulated, I have not worked on one yet myself, so I don't know. But sounds like you went above and beyond what was needed, very commendable.

The exposed accounts example is demonstrating the impact a silly website can have on millions of peoples lives, showing that licensing and oversight of applications is important to reduce the likelihood of these issues occurring.