Evaluation of Prototype Identifying Unnecessary Code


(Roman Haas) #1

Dear Elasticsearch developers,

you are working on an amazing project and I am sure you are investing a lot of time to keep it up and running!

I am researching in the field of software maintenance and I implemented a tool to identify unnecessary code in code bases using a static code analysis. The aim of my work is to support developers like you in deleting parts of the system that are not needed anymore, resulting in less wasted maintenance time due to maintaining irrelevant code. The hypothesis of my work is that stable and decentral classes are good candidates for unnecessary code and could be taken care of in a future clean-up of the software system.

I evaluated my work on the history of some open source systems and the results are promising. Nevertheless, I would like to extend my evaluation using the feedback of developers. It would be great if you could help me with your expert knowledge about your system.

Using my tool, I generated some candidates for unnecessary code for your software system, i.e. classes or even whole packages that may be unnecessary and therefore could be deleted. Unfortunately, I am not able to classify whether the recommendations are helpful. You could help me a lot by taking a look at the suggestions (I generated ten of them for you) and answering one simple question for each of them ("Do you consider the suggested file(s) or package(s) as unnecessary?"). I estimate that you do not need to invest more than 10-15 minutes into this evaluation. In addition, I hope that the 10-15 minutes also pay off for you when my work supports you in maintaining and maybe even cleaning up your project.

Below, you find a file that lists ten suggestions for unnecessary code in your code base. Each suggestion consists of one or more files or packages; if there are several elements they are part of the same package. Please use the link to the evaluation form below to provide your feedback.

Please do not hesitate to ask me if there are any questions regarding my research, the prototype in general or the suggestions for your project.

I am looking forward to your feedback! Thank you very much for your help and interest in my work.

Best regards,

Roman Haas
Master's Student at the Technical University of Munich
E-Mail: roman.haas@tum.de

PS: Due to the character limit, I will post my suggestions in another comment


(Roman Haas) #2
Each suggestion consists of at least one file or package identifier. If several elements are part of a suggestion, all of them will have the same parent directory.

The following TOKEN is needed for the evaluation form:
	elasticsearch

Please copy the TOKEN above and enter it on the feedback form that is available at 
	https://goo.gl/forms/QqcIm2VeixAWuxKO2

Thank you very much for your interest in and support of my research :)

+++ Suggestion #01 (2055 LoC) +++
modules/lang-painless/src/main/java/org/elasticsearch/painless/SimpleChecksAdapter.java (60 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/Constant.java (48 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/FunctionRef.java (199 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/api (506 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/DefMath.java (1242 LoC)

+++ Suggestion #02 (1486 LoC) +++
core/src/main/java/org/elasticsearch/common/inject/ConstructionProxyFactory.java (30 LoC)
core/src/main/java/org/elasticsearch/common/inject/Scopes.java (141 LoC)
core/src/main/java/org/elasticsearch/common/inject/MembersInjector.java (41 LoC)
core/src/main/java/org/elasticsearch/common/inject/ExposedKeyFactory.java (62 LoC)
core/src/main/java/org/elasticsearch/common/inject/BindingAnnotation.java (41 LoC)
core/src/main/java/org/elasticsearch/common/inject/ConstantFactory.java (49 LoC)
core/src/main/java/org/elasticsearch/common/inject/WeakKeySet.java (45 LoC)
core/src/main/java/org/elasticsearch/common/inject/ConstructionProxy.java (47 LoC)
core/src/main/java/org/elasticsearch/common/inject/ContextualCallable.java (27 LoC)
core/src/main/java/org/elasticsearch/common/inject/LookupProcessor.java (61 LoC)
core/src/main/java/org/elasticsearch/common/inject/PrivateBinder.java (54 LoC)
core/src/main/java/org/elasticsearch/common/inject/Stage.java (44 LoC)
core/src/main/java/org/elasticsearch/common/inject/Binding.java (91 LoC)
core/src/main/java/org/elasticsearch/common/inject/Initializable.java (33 LoC)
core/src/main/java/org/elasticsearch/common/inject/SingleParameterInjector.java (75 LoC)
core/src/main/java/org/elasticsearch/common/inject/Lookups.java (30 LoC)
core/src/main/java/org/elasticsearch/common/inject/Provides.java (37 LoC)
core/src/main/java/org/elasticsearch/common/inject/ImplementedBy.java (38 LoC)
core/src/main/java/org/elasticsearch/common/inject/Initializables.java (43 LoC)
core/src/main/java/org/elasticsearch/common/inject/Exposed.java (37 LoC)
core/src/main/java/org/elasticsearch/common/inject/MessageProcessor.java (54 LoC)
core/src/main/java/org/elasticsearch/common/inject/ConstructorInjectorStore.java (77 LoC)
core/src/main/java/org/elasticsearch/common/inject/SingleMemberInjector.java (30 LoC)
core/src/main/java/org/elasticsearch/common/inject/FactoryProxy.java (68 LoC)
core/src/main/java/org/elasticsearch/common/inject/Singleton.java (35 LoC)
core/src/main/java/org/elasticsearch/common/inject/Guice.java (98 LoC)
core/src/main/java/org/elasticsearch/common/inject/Scope.java (60 LoC)
core/src/main/java/org/elasticsearch/common/inject/ProvidedBy.java (38 LoC)

+++ Suggestion #03 (1297 LoC) +++
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ECallLocal.java (96 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EAssignment.java (347 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/PBrace.java (125 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ECapturingFunctionRef.java (144 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ERegex.java (126 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ILambda.java (40 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EElvis.java (113 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/ENewObj.java (118 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/AStoreable.java (123 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EString.java (65 LoC)

+++ Suggestion #04 (946 LoC) +++
core/src/main/java/org/elasticsearch/common/inject/spi/PrivateElements.java (61 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/TypeListener.java (47 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/ProviderWithDependencies.java (28 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/ExposedBinding.java (40 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/DefaultBindingTargetVisitor.java (85 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/BindingScopingVisitor.java (57 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/ConvertedConstantBinding.java (48 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/ProviderKeyBinding.java (37 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/TypeConverterBinding.java (69 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/TypeConverter.java (33 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/BindingTargetVisitor.java (83 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/InjectionListener.java (35 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/TypeEncounter.java (101 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/DefaultBindingScopingVisitor.java (60 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/ProviderBinding.java (36 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/ConstructorBinding.java (45 LoC)
core/src/main/java/org/elasticsearch/common/inject/spi/ElementVisitor.java (81 LoC)

+++ Suggestion #05 (554 LoC) +++
modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/StashingTokenFactory.java (62 LoC)
modules/lang-painless/src/main/java/org/elasticsearch/painless/antlr/PainlessParserVisitor.java (492 LoC)

... 5 to go, please see the next reply :slight_smile:


(Roman Haas) #3
+++ Suggestion #06 (535 LoC) +++
core/src/main/java/org/elasticsearch/common/inject/internal/ErrorHandler.java (37 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/Strings.java (58 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/ErrorsException.java (38 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/InternalFactory.java (61 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/UniqueAnnotations.java (79 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/AsynchronousComputationException.java (29 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/ToStringBuilder.java (53 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/NullOutputException.java (30 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/ComputationException.java (27 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/Stopwatch.java (51 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/ExpirationTimer.java (26 LoC)
core/src/main/java/org/elasticsearch/common/inject/internal/Nullability.java (46 LoC)

+++ Suggestion #07 (328 LoC) +++
core/src/main/java/org/elasticsearch/index/shard/FilterDocValuesProducer.java (157 LoC)
core/src/main/java/org/elasticsearch/index/shard/IndexShardComponent.java (29 LoC)
core/src/main/java/org/elasticsearch/index/shard/SnapshotStatus.java (142 LoC)

+++ Suggestion #08 (326 LoC) +++
modules/lang-expression/src/main/java/org/elasticsearch/script/expression/GeoLatitudeValueSource.java (81 LoC)
modules/lang-expression/src/main/java/org/elasticsearch/script/expression/GeoEmptyValueSource.java (81 LoC)
modules/lang-expression/src/main/java/org/elasticsearch/script/expression/EmptyMemberValueSource.java (83 LoC)
modules/lang-expression/src/main/java/org/elasticsearch/script/expression/GeoLongitudeValueSource.java (81 LoC)

+++ Suggestion #09 (318 LoC) +++
core/src/main/java/org/elasticsearch/index/fielddata/SortableLongBitsSortedNumericDocValues.java (57 LoC)
core/src/main/java/org/elasticsearch/index/fielddata/SortableLongBitsToSortedNumericDoubleValues.java (58 LoC)
core/src/main/java/org/elasticsearch/index/fielddata/SingletonSortedBinaryDocValues.java (68 LoC)
core/src/main/java/org/elasticsearch/index/fielddata/SortableLongBitsToNumericDoubleValues.java (48 LoC)
core/src/main/java/org/elasticsearch/index/fielddata/SortingBinaryDocValues.java (87 LoC)

+++ Suggestion #10 (296 LoC) +++
core/src/main/java/org/elasticsearch/index/analysis/DutchStemTokenFilterFactory.java (45 LoC)
core/src/main/java/org/elasticsearch/index/analysis/WhitespaceAnalyzerProvider.java (41 LoC)
core/src/main/java/org/elasticsearch/index/analysis/SimpleAnalyzerProvider.java (41 LoC)
core/src/main/java/org/elasticsearch/index/analysis/RussianStemTokenFilterFactory.java (38 LoC)
core/src/main/java/org/elasticsearch/index/analysis/KeywordAnalyzerProvider.java (40 LoC)
core/src/main/java/org/elasticsearch/index/analysis/ChineseAnalyzerProvider.java (46 LoC)
core/src/main/java/org/elasticsearch/index/analysis/FrenchStemTokenFilterFactory.java (45 LoC)

(Simon Willnauer) #4

I looked at all those files and non of they lines in there are unnecessary. I am not sure how you define unnecessary but I think those results are not very promising to me.

simon


(Roman Haas) #5

Thank you for your feedback, Simon!
I assume you had a look on suggestions 9 and 10, right?

For those files I think one can easily see that not all stable and decentral classes of a software systems are good candidates for unnecessary code and for some systems it is hard to identify the "right" classes that are actually unnecessary (if there are any at all).


(Simon Willnauer) #6

can you give me a concrete example where you think your tool has a promising result? Make sure it's not in core/src/main/java/org/elasticsearch/common/inject since this is a fork or another project


(Roman Haas) #7

The "promising results" of my first post refered to results that I obtained from evaluation sessions with other developers of other projects (and obviously: other recommendations).

However, I had already received feedback from another Elasticsearch developer on Friday, who stated that exactly those suggestions (#2, #4, #6) contain unnecessary code (comment: "We have a forked copy of Guice in Elasticsearch and we aren't likely using all of its features. We are removing the need for it, but very slowly.")

I interprete this as follows: Currently, Elasticsearch depends on the code and its functionality, but it is likely that it will be replaced such that it is eventually not needed anymore. Is this correct?


(Simon Willnauer) #8

correct


(Roman Haas) #9

Thank you very much for your help and your quick answers!


(system) #10

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.