4 ms·
> You need depth if you want to build something that scales in the enterprise This feels like "Mongodb is webscale". What specifically does Spring do better th
by Tarq0n 5y ago
> You need depth if you want to build something that scales in the enterprise
This feels like "Mongodb is webscale". What specifically does Spring do better than its competitors?
- invalidname 5y agoSpring works with everything and scales horizontally really well. It can play with every framework and has many engineers/knowledge around it. Specially it has builtin caching, transaction management, DB access etc. But it connects to many external services for all of those seamlessly. It abstracts all the layers so you can easily replace everything under the hood with full compatibility as your business grows.
- davedx 5y ago> caching, transaction management, DB access etc Aren't these mostly features of your data layer e.g. Hibernate? > It abstracts all the layers so you can easily replace everything under the hood with full compatibility as your business grows. Java is a perfectly capable language for implementing abstractions. What does Spring offer you there that you can't do with plain old Java?
- invalidname 5y agoYes it uses Hibernate. The integration through Spring Data is seamless. Also caching isn't just L2 Hibernate cache. It's external caching layer, integrations with Redis/memcached etc. It provides encapsulation for all of these elements that you don't have to do on your own.
- rad_gruchalski 5y ago> Java is a perfectly capable language for implementing abstractions. What does Spring offer you there that you can't do with plain old Java? A concise framework where all components talk the same language across the full stack.
- signal11 5y ago> A concise framework where all components talk the same language across the full stack. Spring is many things, but it's not a "concise" framework by any means.
- rad_gruchalski 5y agoStill better than writing everything by hand.
- signal11 5y agoSpring vs “writing everything by hand” is a false dichotomy.
- xboxnolifes 5y agoConsidering this conversation branched from "What does Spring offer you there that you can't do with plain old Java?", I'm not so sure that's the case.
- pritambarhate 5y ago>> What does Spring offer you there that you can't do with plain old Java? Well nothing. Since Spring it written in Java, anyone else using Java can do all of those things. The things is Spring already does all these things and it does them well. It's well tested and well supported. Most people don't want to do all of this from scratch. So they need a framework anyways. So they choose Spring because it's the leading framework in Java world. There are a lot of people who already know Spring and can become productive in a Spring codebase fairly quickly.
- stefan_ 5y agoYou went from "Spring isn't a framework for frameworks" to "[the Spring framework] can play with every framework". I think OP got it right.
- invalidname 5y agoLOL totally got me there ;-) Yes. I was talking about Spring Boot there. Yes, that wasn't clear. Spring is a framework and some of the elements within it abstract other tools some of which are frameworks in their own right (e.g. JPA/Hibernate). There are many abstractions but Spring sort of unifies them to a single "story" you can work with. JPA under Spring makes a lot more sense with the JPA Repository etc.
- MathCodeLove 5y agoI mean you do realize that many complex web apps use multiple frameworks for different things, right? Personally I don't like Java and haven't used spring, but take a modern web app and you could be using something like express/fastify, react + next, an ORM, a schema validator, and quite a bit of other domain specific pieces of functionality. Ofc these aren't all "frameworks" in the traditional sense, but that line is often arbitrary and I think this interpretation of OP's usage of the word is the most generous one.
- stefan_ 5y agoSure, you use a lot of frameworks - in parallel. But that's not what happens in Spring land. Instead, you get one framework (Spring) offering you an abstraction behind which another framework lurks, for things as large as say an ORM. Something that complex can of course not be hidden behind mere 1000s of Java interfaces, it all leaks horrendously and you find yourself "reaching through" the layers.
- Tsarbomb 5y agoJust from my experience, its flexibility and feature set. Some points I find relevant (specific to Spring Boot): - If I'm building a web service I can choose if I'm using a thread based sync approach or a reactive non blocking approach. - Extremely opinionated and well thought out configuration management. Think of Viper from Go, or config with Pydantic from Python, just turned to 11. - I can add support for many different data stores directly with the framework. Psql, Elasticsearch, Cassandra... the list goes on. - Making critical sections of code, especially around data stores can usually be made transactional with a single annotation and managing the lifecycle of that transaction is similarly convenient. - Robust caching solutions that are brain dead easy to add. I stress the robust adjective. - Built in health metrics and ability to refresh configuration while running and rewire itself. - Can speak OAuth2.0 out of the box. - You can connect the logger with a little bit extra configuration to additionally spit logs out to something like Kafka with no extra code on your part. This list alone doesn't seem super impressive but having built on things like Python+FastAPI, Node+Express/Hapi/Apollo, and Rust+Actix, while you can do all of these things, they are not generally just there, ready to use, and suitable for production. My bread and butter used to be Spring-Boot w/ Lombok and I could take a service from inception to running in prod with fewer lines of code than I currently can with Python and FastAPI. Extra Note: There will always come a time when developing with spring where you will shout to the high heavens about something the framework does a particular way or something you misunderstood. That is part of the pain of when the framework does so much for you.
- markoman 5y agoGiven your comments about your Spring Boot 'bread and butter', it looks like you changed to Python & FastAPI. If so, why? Was it due to a reduction in overall complexity (despite the apparent rise in line of code)? Curious, thanks.