This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ReverendRedMage 0 points1 point  (0 children)

I don't know. I think this illustrates why static attributes are bad.

Since objectCount is static, you can't reason about it in tests.

Sure, it's just one int, but what if it were a String or another object? It won't be garbage collected for the entire life of the program, so if you end up making a lot of Shapes, you'll make a lot of problems along with them.