DEV Community

Jules
Jules

Posted on

2 1

Type-Safety, it's pretty nice

Okay, short one.
I'm used to programming in Ruby where anything goes and you fix stuff later. The ultimate procrastination.

That said, it's surprising how useful I'm finding strongly-typed methods and variables; it's like having comments everywhere saying what my program's doing and makes me think about design more. When I can see that this method returns a string, but the one it calls is boolean-y, I'm encouraged to consider how they interact more.

Even if it doesn't change what I do now, it saves a lot of time when refactoring, and the tests don't even have to run for me to find out that square pegs don't go in round holes.

Long and short, restrictions keep things structured, and Java's working out well (enough).

Done.

Top comments (1)

Collapse
 
xanderyzwich profile image
Corey McCarty

There are tricks for playing boolean-y stuff in reserved values. Like you can return "-". It would actually help more to return a string and for that negative case throw an exception and handle it explicitly on the calling code.

Great read:

Is it Time to go Back to the Monolith?

History repeats itself. Everything old is new again and I’ve been around long enough to see ideas discarded, rediscovered and return triumphantly to overtake the fad. In recent years SQL has made a tremendous comeback from the dead. We love relational databases all over again. I think the Monolith will have its space odyssey moment again. Microservices and serverless are trends pushed by the cloud vendors, designed to sell us more cloud computing resources.

Microservices make very little sense financially for most use cases. Yes, they can ramp down. But when they scale up, they pay the costs in dividends. The increased observability costs alone line the pockets of the “big cloud” vendors.

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay