magic_lobster_party

  • 0 Posts
  • 16 Comments
Joined 1 month ago
cake
Cake day: August 15th, 2024

help-circle





  • In your example, the declaration of ArrayList look like:

    public class ArrayList extends AbstractList implements List {
    }
    

    The dependence on AbstractList is public. Any public method in AbstractList is also accessible from the outside. It opens up for tricky dependencies that can be difficult to unravel.

    Compare it with my solution:

    public class ArrayList implements List {
        private AbstractList = new AbstractList();
    }
    

    Nothing about the internals of ArrayList is exposed. You’re free to change the internals however you want. There’s no chance any outside code will depend on this implementation detail.







  • It doesn’t matter, why the present is garbage, it’s garbage and we should address that.

    The problem is fixing it without inadvertently breaking for someone else. Changing the default behavior isn’t easy.

    There’s probably some critical systems that relies on old outdated practices because that’s the way it worked when it was written 20 years ago. Why should they go back and fix their code when it has worked perfectly fine for the past two decades?



  • 0.02% means you’re saving a fraction of a second for every hour of runtime. A lot of adding up is required to make it significant enough for anyone to notice.

    Better to spend that time and effort on things that actually bring value. These kind of micro optimizations can also make the code unnecessarily complicated and difficult to work with, which is a hindrance for the optimizations that truly matter.