Daniel Wellman
2016-07-07 01:27:36 UTC
Hello,
I've discovered an object that has grown to be a bit large and I'd like to
reduce its size. It's largely a data object that exposes several fields
via Java getter methods -- that is, the client code largely uses it as a
read-only source of data to decide to do things. I'm looking to either
hide those fields and add behavior on that object or bundle up related
fields into bigger objects. Probably both, actually.
I'm currently looking for fields that are accessed together to see about
bundling those up into objects. I know I could do this in a manual
brute-force approach, but I wondered if there was some sort of way to have
the computer suggest a few places to start. That is, given a target
object, I wish a computer program would say "Hey, these two fields are
often accessed together over here in Foo, Bar, and Baz, and these three are
often accessed together over there in Blargh Bah and Bahumbug."
I was thinking I could use source code repository analysis to help me
figure out when two files are frequently changed together -- so I could
find out what other classes frequently change with the target object. That
would give me a starting point to figure out which source files might be
interesting to look at - but not which fields to check.
Does anyone know of any useful static analysis tools for Java source code
that could do something like that? Or of any other techniques for finding
these candidate objects to bundle up?
Thanks for your advice!
Cheers
Dan
I've discovered an object that has grown to be a bit large and I'd like to
reduce its size. It's largely a data object that exposes several fields
via Java getter methods -- that is, the client code largely uses it as a
read-only source of data to decide to do things. I'm looking to either
hide those fields and add behavior on that object or bundle up related
fields into bigger objects. Probably both, actually.
I'm currently looking for fields that are accessed together to see about
bundling those up into objects. I know I could do this in a manual
brute-force approach, but I wondered if there was some sort of way to have
the computer suggest a few places to start. That is, given a target
object, I wish a computer program would say "Hey, these two fields are
often accessed together over here in Foo, Bar, and Baz, and these three are
often accessed together over there in Blargh Bah and Bahumbug."
I was thinking I could use source code repository analysis to help me
figure out when two files are frequently changed together -- so I could
find out what other classes frequently change with the target object. That
would give me a starting point to figure out which source files might be
interesting to look at - but not which fields to check.
Does anyone know of any useful static analysis tools for Java source code
that could do something like that? Or of any other techniques for finding
these candidate objects to bundle up?
Thanks for your advice!
Cheers
Dan
--
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
---
You received this message because you are subscribed to the Google Groups "Growing Object-Oriented Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growing-object-oriented-software+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.