Hi

Hi,

I need some info concerning structure of projects , packages and tests, 

I have an application where delphi XE2 is used for the front-end and intersystems caché ( a database with an integrated object script language ) is the back-end,
for the moment the application is only a x86 with an exe and a dynamic loaded runtime packages.

Now I want to make it x64 and in the meantime i want to restructure my application, create more runtime packages ( don't know if i want to dymanic load them in the future - package maintenance cost) 

I need some advice concerning best practice in folder structure

I'm thinking about following folder structure : 

..\Source\Framework\FrameworkName\.dpk,.pas ( or *.dcu when missing *.pas ) - things like Spring4D, DelphiMocks.. ( many thanks to all the contributors )
..\Source\Libraries\Libraryxx\Libraryxxx\.dpr,.dproj,.cfg,.pas - common libraries , stringutils, fileutils... ( depends on framework, and other libraries )
..\Source\Modules\Modulexx\.dpr,.dproj,.cfg,.pas - modules used by one or more applications ( depends on framework, common libraries and other modules )
..\Source\Components\ComponentGroup\.dpk,.pas,*.dfm - 3rd party components and self created components ( depends on framework, common modules and libraries ) 
..\Source\Applications\.dpr,.dproj,.cfg,.dfm,*.pas - main application and app specific modules( depends on other app spec modules , framework , common modules , libraries and components)
each folder has his its own tests with following structure
 ..\Tests\Tests.dpr , xxxxx_UnitTests.pas , xxxxx_IntegrationTests.pas ,xxxxx_AcceptanceTests.pas and xxxxx_TestDoubles.pas ( dummy's , stubs , spies , mocks , fakes ) 
 
..\BuildGroups\Groupxx\*.bpg - so I can easy recompile parts or my entire codebase  
..\TestSuites\TestSuitexx\.dpr,.dproj - so I can easy combine tests

..\Compiled\$(config)\$(platform)\units\*.dcu
..\Compiled\$(config)\$(platform)\bin\.hpp,.drc,.lib,.map,*.dcp
..\Compiled\$(config)\$(platform)\packages\*.bpl
..\Applications\$(config)\$(platform)\applicationxx\*.exe

..\ is [DRIVE]\RAD Studio\[BDSVERSION]\

I only want to put the ..\Source\ folder under version control

Is this an good structure or not ?

Will it work so I can set for all my projects the search folder to $(BDSCOMPILED)\$(BDSVERSION)\$(CONFIG)\$(PLATFORM)\units and $(BDSCOMPILED)\$(BDSVERSION)\$(CONFIG)\$(PLATFORM)\bin
and what about the installed components in the IDE, is their a difference between the release/debug config and the x86/x64 platform ?
Is it best to include $LIBSUFFIX or not and how can I easy update when migrating to newer delphi version.

Is there an easy auto-update tool on the start of the application so the latest version or registered version of the bpl's is copied into the path of the application file.

Is it possible to auto-launch tests on compilation of a package, my current procedure is compile the package, compile the test and run the test manually ( using d-unit ) and I want to speed my TDD cycle
I know it a lot questions but I want to create a good structure so I can work efficient in the future.

Thanks in advance

Comments

  1. We have a similar folder structure to the one you propose where I work. We have the source for all third party dependencies (including the RTL/VCL) under source control. This allowed us to setup a build server by copying only the command line tools rather than needing to install the whole IDE. It also gives us the flexibility to patch 3rd party code or migrate to a new compiler version without waiting on the component vendor.

    We don't use environment variables for any of the paths. Instead we use relative paths for everything.

    As far as the structure of your application goes here's a bit of guidance: http://blog.8thlight.com/uncle-bob/2011/09/30/Screaming-Architecture.html

    Hope that helps.

    ReplyDelete
  2. Kenneth Cochran For my 32bit version I'm use this structure, i'm using Jenkins as build server. I have configured it so that when building the release version all the unittest generates an nunit compatible xml that can be parsed with the nunit jenkins plugin, building the debug version I use the gui, but i'm thinking in automating that using some post build scripts combined with a little app that uses wmi to monitor the directory with the test results and shows the results of the tests.

    My application structure is like that as big fan of Uncle Bob I have read the clean code & clean coder books and have seen all the cleancoders episodes.

    I'm also thinking of using relative paths because sometimes the delphi IDE decide to compile something in the default BDSUSERDIR even when no BDSUSERDIR is mentioned in my project options.

    Do you know any tool to easy update the packages options. I could use find/replace in notepad++ but i'm affraid to f*ck up the XML structure.

    ReplyDelete
  3. Nothing comes to mind. There was a package manager called OwlyCI that was kind of like nuget for Delphi but has been discontinued and I'm not sure it did what you're asking anyway.

    ReplyDelete

Post a Comment