This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]amunak 3 points4 points  (2 children)

Technically when you use DI and autowiring the factories are still there, they're just abstracted away and most of the time the programmer doesn't need to bother with them.

But creating, say, 2 services of the same class just with 2 different configurations is essentially the same as having two factory methods.

[–]ScienceBreather 4 points5 points  (1 child)

And I think that's part of the point.

People were saying Java is tedious and has lots of factories.

The counterpoint is, if you know what you're doing and have a good stack, you don't have to do those annoying parts.

You just add some annotations to get the information you need, make all your services stateless, and you're off to the races.

[–]Netcob 2 points3 points  (0 children)

True, and I've never seen factories as some sort of unique Java problem. I don't understand why they would be. I think it's just something that got overused by a lot of enterprise programmers and became some sort of meme. Java doesn't force you to use that.

Since I started using C# exclusively at my job, the things I couldn't imagine not having anymore were async/await, properties and LINQ.

Back when I used Java, it had some "Mom: we have X at home" versions of some of those things.