6 ms·
Circle my_circle = new Circle(); I have to type the word circle 3 times to define a circle. It gets boring. This gets worse if you are trying to do any kind of
by highwind81 15y ago
Circle my_circle = new Circle();
I have to type the word circle 3 times to define a circle. It gets boring. This gets worse if you are trying to do any kind of user input.
BufferedReader my_reader = new BufferedReader(new InputStreamReader(System.in));
Had to type reader 4 times. :(
- seasoup 15y agoPeople can argue with "boring", call it redundant instead and you'll get less harsh feedback.
- iaskwhy 15y agoBut is it something people actually type? I haven't played with Java for almost ten years now but I do C# for a living which is pretty similar and I can't remember the last time I had to type something that long, Visual Studio does it for me. I can see the point if you say it's longer to read but it's also much clearer, isn't it?
- Peaker 15y agoRedundancy is noise.. How is it any clearer to read?
- iaskwhy 15y agoHow's that redundant? In C# you would just "var something = new object()", so there wouldn't be any redundancy at all.
- Peaker 15y agoI was replying to: "Visual Studio does it for me. I can see the point if you say it's longer to read but it's also much clearer," So he's saying that: Circle circle = new Circle() is typed by Visual Studio for you, and clearer to read. I don't think it's clearer to read.
- justncase80 15y agoIt's kind of a misnomer too, because only the second circle is typed for you so you had to type Circle at least once... which is the same as if you were typing var. So it's not only not saving you much effort it's uglier. And with more complex types it's downright evil (to not use var).
- cromwellian 15y agoDart doesn't require the type. var c = new Circle();
- chc 15y agoBut then it appears to just turn off type checking. This would be the cakiest cake ever for even a shoddy type inference engine.
- deleted 15y ago[deleted]