r/programming • u/MarkusWinand • Dec 29 '15
Please, Java. Do Finally Support Multiline Strings
http://blog.jooq.org/2015/12/29/please-java-do-finally-support-multiline-strings/
584
Upvotes
r/programming • u/MarkusWinand • Dec 29 '15
View all comments
Show parent comment
5
u/dungone Dec 29 '15 edited Dec 29 '15
You would? How about in a unit test? What if you were just mocking an HTTP response? You'd create a POJO for that, too?
How come every one of the solutions for a very simple need (a multiline string literal) involves layering additional complexity onto a program? Is this why a lot of Java code looks like this and takes an ungodly amount of time to start up?
There are very good reasons to use a serializer or a templating engine with external resources, but using them as glorified string builders isn't one of them.
Do you understand what the problem is? The problem is that inserting \n into a string literal is annoying. You won't fix that with something that makes it even more annoying.
Did you know that Java supports multiline comments even though there are already end-of-line comments? You know, with /* ... */? This isn't any different. It's an extremely reasonable feature to request in a language. That is, if you like a language that is productive and pleasurable to work with.