如何最好地将大应用程序分成模块? [英] How to best divide big app into modules?

查看:189
本文介绍了如何最好地将大应用程序分成模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建我正在处理的应用程序需要很长时间。它是我工作过的最大的一个。我试图调整gradle设置,这有助于,但仍然是构建速度很慢。



由于应用程序的构建没有模块,它只是一大堆的包,现在我想知道如何提取其中的一些并将它们放入单独的模块中。 AFAIK这些模块不应该对应用程序模块有依赖关系,所以我想知道是否有一种工具或技术可以让我分析代码并帮助我找到合适的包来提取,因为它有很多代码。



您如何解决我的问题? 您的问题是源代码模块化在软件工程。这是软件中的新主题,关于它的参考文献很少。源代码模块化正在重塑源代码中的聚类概念。

在此参考文献中(





您可以使用许多工具。您可以在模块化过程中使用它们:



  1. 静态源代码分析工具(获取ADG格式等) )请参阅


    Building the app I am working on takes a lot of time. Its the biggest one I worked on. I tried to tweak the gradle settings, which is helping, but still the build is quite slow.

    Since the app was built without modules in mind, its just a whole lot of packages and now I wonder how I could "extract" some of them and put them into separate modules. AFAIK the modules should not have dependencies to the app module, so I wondered if there is a tool or technique which would allow me to analyse code and help me to find the right packages to extract, since it's a lot of code.

    How would you approach my issue?

    解决方案

    Your question is Source Code Modularization in Software Engineering. It is new subject in software and there are few references about it. Source Code Modularization is recasting of Clustering concepts on Source Codes.

    in this reference from (see reference 1)

    The aim of the software modularization process is to partition a software system into subsystems to provide an abstract view of the architecture of the software system, where a subsystem is made up of a set of software artifacts which collaborate with each other to implement a high-level attribute or provide a high-level service for the rest of the software system.

    However, for large and complex software systems, the software modularization cannot be done manually, owing to the large number of interactions between different artifacts, and the large size of the source code. Hence, a fully automated or semiautomated tool is needed to perform software modularization.

    There are many techniques (Algorithms) to Source Code Modularization (see reference 1):

    1. Hierarchical Techniques:

      • Single Linkage, Complete Linkage, Average Linkage
      • Ward Method, Median Method, Centroid Method
      • Combined and Weighted Combined Methods
    2. Search-Based Techniques:

      • Hill Climbing, Multiple Hill Climbing (HC)
      • Simulated Annealing (SA)
      • Genetic Algorithm (GA)

    Notice that you can find other Clustering techniques with this names too. But Modularization is a little different. They are recast to source code modularization.

    The overall Source Code Modularization Process shown as below:


    There are many tools you can use. You can use them in Modularization Process:

    1. Static Source Code Analysis Tools (to get ADG format and etc.) see the reference here - (like Understand, NDepend and etc.)
    2. Visualization Tools - (Graph Visualization) see the list here (like Tom Sawyer Visualization)

    For example of little project, If your project structure (that generated from source code by use of Static Analysis Tools) are like this:

    the result can be like this (after applying Modularization Process):

    这篇关于如何最好地将大应用程序分成模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆