Aks HN: How did you improve the quality of your code base?
This might be difficult to do but can you explain your overall architecture design? What sorts of issues are you having? Where are the pain points?<p>Going from top to bottom:<p>&gt; Our company builds a java openGL CAD&#x2F;CAM application suite for windows desktops<p>If it&#x27;s an application suite then, from my understanding, you&#x27;ll be building a main set of libraries and then a set of tools that all use these libraries. Have you considered a hierarchical plugin design? Have a main application that starts and setups all of  your main rendering and CAD&#x2F;CAM magic. Then go from there to working out a simplest of APIs to what everything actually <i>needs</i> access too.<p>Your main application basically just manages UIs&#x2F;drawing to an OpenGL port. From there you can load modules to do other things. If you abstract what is needed then each module should only need to define How a functionality is executed, not where and what a functionality should look like in the UI. For instance refactor your code to follow such a structure:<p><pre><code>   Master UI System (Exposes: &quot;Options&quot;, &quot;Renderables&quot;, &quot;Views&quot;)
    -&gt; Drafting Plugin (Exposes: &quot;Models&quot;, &quot;Collision&quot;, &quot;Faces&quot;)
    -&gt; CAM Plugin (Exposes: &quot;Routing Paths&quot;)
</code></pre>
Master UI does not need to know anything about Design Plugin and CAM Plugin.<p>Drafting Plugin needs to know about Master UI but nothing about CAM Plugin.<p>CAM Plugin needs to know about Master UI and Drafting Plugin.<p>That&#x27;s what I would try and do if this was a new project but this isn&#x27;t one and uprooting your entire (or even any recognizable percentage of your code base) is unreasonable.<p>&gt; We have a couple tens of million LOCs, with ~50 projects and 1000s of packages<p>If you&#x27;ve got that many packages then you might want to find out what sort of abstractions are being used, not working correctly, and remove them&#x2F;replace them with simpler solutions. How much of these packages are filled with Interfaces&#x2F;Abstract Classes&#x2F;Implementations of interfaces<p>&gt; After ~10 years of neglection we need a strategy to increase the code quality (lots of dependencies, feature envying inheritance hierarchies, spaghetti code, similar problem are solved in myriad ways, all that jazz).<p>One at a time:<p>&gt; lots of dependencies<p>Slowly replace dependencies by either abstracting features further, replacing with new standard library features, or by implementing other solutions to the same problems. Every dependency is an added layer of complexity in my book so it&#x27;s best to avoid this as much as possible.<p>&gt; feature envying inheritance hierarchies<p>This comes as a side effect of not knowing what a level of abstraction is actually meant to be doing. Have a team meeting and ask what each team thinks the actual problems that are needing to be solved are. The people knee deep in crap will have a better idea of what&#x27;s the correct or natural abstraction for these cases if the ones currently being used are unnatural. It may just be that the code base has had too many large scale changes or even just have had too many features pushed in at once (which for a CAM&#x2F;CAD tool is definitely not unheard of, this is a very specialized and hard task)<p>&gt; spaghetti code<p>Get some sort of static analyzer. I remember one group I worked with used Sonar. Also remember that the best code quality tool is a good agreed upon set of standards. Somethings that have worked for me on some group projects I&#x27;ve worked on has been: Avoid complicated constructors, always default a variable to final, avoid complicated logic statements always exit early rather then filter before in a for loop, use all the up-to-date constructs to aid with code clarity (try(stream), for(var:set), and more).<p>&gt; similar problem are solved in myriad ways<p>If there is one problem that exists in two places this is an opportunity for you to pull the part out, abstract it, and use it as a library. This is a double edged sword since these two parts actually need to contain the same problems which some times is not the case.<p>Now to the nitty gritty:<p>&gt; How do you measure code quality? How do you interpret the metrics?<p>(How many times does the code result in an error) * (The time in hours that it takes to debug the code).<p>Larger number is worse. Keep a notebook&#x2F;log of these times, graph them, and use that as a map to decide what is worth refactoring. If a piece of code &quot;just works&quot; but looks ugly it can wait to be refactored if there is another piece of code that looks &quot;visually appealing&quot; while still causing daily side effects in the active development of the project.<p>&gt; What are good tools for a windows&#x2F;java&#x2F;eclipse dev environment?<p>I&#x27;ve always managed ANT scripts for my group projects since they are very very cross platform. Maven works great but I&#x27;m not a fan of the complexity of install for non-linux users. Also check out IntellJ for built-in maven support.<p>&gt; How do you act on the metrics and actually improve code quality?<p>Change your code by coming at it from a different perspective. If that perspective yielded a more promising piece of code (that is easier to understand, causes less side effects, and uses less external&#x2F;non-standard functionality) then you keep it. A lot of my code I write is code I throw away. This is much harder to justify to business people but it&#x27;s an important part of the process to sketch up what you think <i>might</i> work even if the attempts aren&#x27;t always fruitful.<p>&gt; Can you recommend any resources of success stories on how companies managed to increase code quality of a big, tangled system?<p>Check out the U.S. Digital Service for the only recent success story that comes to mind [1].<p>If anyone knew the secret sauce they wouldn&#x27;t give it out for free. The ability to &quot;Fix&quot; all the &quot;Broken&quot; projects isn&#x27;t an issue on the scales that we think they are. A large portion of all technology-related projects fail [0]. If anyone could prove they where able to reliably fix these issues they&#x27;d be billionaires over night.<p>[0] - <a href="http:&#x2F;&#x2F;www.zdnet.com&#x2F;article&#x2F;study-68-percent-of-it-projects-fail&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.zdnet.com&#x2F;article&#x2F;study-68-percent-of-it-projects...</a><p>[1] - <a href="http:&#x2F;&#x2F;www.theatlantic.com&#x2F;technology&#x2F;archive&#x2F;2015&#x2F;07&#x2F;the-secret-startup-saved-healthcare-gov-the-worst-website-in-america&#x2F;397784&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.theatlantic.com&#x2F;technology&#x2F;archive&#x2F;2015&#x2F;07&#x2F;the-se...</a><p>Edit: Removed &quot;What do you mean by thousands of packages?&quot;<p>Looking forward to what you think of all this.