Question

Here's how I usually develop an application:

  • I start with having all the code in a single source file.
  • When it grows enough to be modularised, I break the code into several modules.
  • When the modules grow enough, I split them again. And so on, iteratively.
  • Over time, some modules get shrunk, deleted or merged with others.

This workflow implies the need to move source files between modules sometimes. And here comes the problem:

When I move a module to another location, it changes the module's name, so I have to walk through all the other files renaming imports by hand.

Is there some organisational technique to avoid that annoying procedure? Or is that the way it goes and I just have to look into some automation utilities instead?

Was it helpful?

Solution 2

You can override module name via module packagename.modulename; directive in the beginning of the module. It will need a help from the build system though as rdmd uses module names from import statements to form file system path to search for their sources. But if you will supply all source files project consists from by hand, it should resolve module names just fine.

OTHER TIPS

you can create a *.all module that public imports all modules in the package

then you only need to add/remove the module names from that module

It's better to define your entities before you start coding. You can use some modelling language to identify and write your entities. For example if you are using java to code your application then you can use UML to model this application.

Also, you have to separate buisness logic from data.

If you continue to do it like today you will lose a lot of time just dealing with filenames.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top