DecompositionByLanguageIsProbablyAModularityMistake (ThoughtStorms)

Refactored from SpaceAndModularizingWebPages, these are thoughts I've been having since returning to programming web-sites.

Decomposing by language (ie. HTML, VBScript, JavaScript and SQL) is probably a ModularityMistake.

Separation by language is common in most allegedly "good" practice. Firstly, the code in each language is placed in different files; and in larger systems, in different sub-trees of the filing system. Secondly, there's an expectation that different people, with different skills, will work in each language : some will define XML config. files, others will write Java, others will write SQL and designers will create HTML. We try so hard to separate the different activities, that we even write special AbstractionLayers simply to hide one language from users of another.

But elements in different languages are tightly coupled (eg. the variables in the VBScript, which is executed server-side, handle fields which are declared in HTML and validated in JavaScript routines executed client-side.) So separating them is the classic error of not drawing the boundaries where modules are weakly coupled.

See also :

I suppose the natural outcome of this way of thinking would be a kind of SocialNetworkAnalysis on your code to establish which modules, objects and functions interact with which, most frequently. Is this something RefactoringBrowsers encourage?

On second thoughts, this is probably a famous technique which has been around since the 60s and which I should have been practicing all my life, but I'm just too ignorant to have heard of it :-(

Maybe SourceCodeAnalysis?, CyclomaticComplexity?

Semi-relevant :

Constructing large systems with a tower of LittleLanguages :


Sounds like the problems with decomposition by language are really down to the way it is done (e.g. expectation that different people will be developing in each language) rather than any actual fundamental problem in using different languages?

-- AdrianHoward

Yep, that's exactly what I'm saying. Of course you can / should use different languages in your project. But don't assume that the boundaries between languages are the natural module boundaries; or boundaries that can naturally be mapped onto personel differences or should be enforced by putting chunks of them in different files in different corners of the file-system.

-- PhilJones

Okay then! In that case "probably a mistake" is a bit strong. I use multiple languages in the majority of my projects and like to think that I do a reasonable job of it :-)

What Martin Fowler and others call LanguageOrientedProgramming is an interesting perspective.

-- AdrianHoward

See also MultiParadigmCoding