I hate looking at dense code. You know, that kind of code that has blocks that look like bricks left randomly around the room, making it very easy for anyone to walk around the place.
Serioulsy, dense code is hard to read and understand. Let’s take this little bit of code as an example:
When I run into code that looks like that, this is sort of what I see:
It’s so easy to put that garbage out, like this:
The same happens with collections…
I like this much better:
I always favor using object/collection initializers whenever possible, if that makes the code more compact and easier, more calm to read.
#1 by Ant. Rui Nogueira on March 5, 2017 - 1:42 pm
Good explanation, about collection.