How to decompose a system into modules? - modularity

The effectiveness of a "modularization" is dependent upon the criteria used in dividing the system into modules.
What I want is, suggest some criteria which can be used in decomposing a system into modules.

Cohesion: the functionality in a module is related.
Low coupling: you have minimum dependencies between modules.
Coordinated lifecycle: changes to functionality within a module tends to occur at the same time. Usually a consequence of high cohesion.

I think the Single Responsibility Principle would be a good guide. Try to define responsibilities for each modules, and make each module be responsible for its own thing.
See http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod

Interesting reading too: http://www.cs.umd.edu/class/spring2003/cmsc838p/Design/criteria.pdf

It is a very old question.
Module is a work assignment to a programmer or group of programmers. This also is the unit of change.
Coupling and cohesion are metrics for estimation quality of relationships between modules but they are not useful for decomposition.
The decomposition should be made using "information hiding" as a criterion.
Introduction with examples and description of process based on "information hiding" principle: http://www.sqrl.ul.ie/Downloads/Lecture2.pdf.
State of art of this question is the software product line topic.

Related

Calculation of modularity from sonarqube

Is there a way to calculate modularity metric from the preexisting metrics in SonarQube? I want to calculate modularity so that I can use it for my technical debt calculation.
The Modularity of software is a composite metric. Thus, first you need to define the modularity and participating metrics. The paper you mentioned (http://arxiv.org/ftp/arxiv/papers/1309/1309.5689.pdf) offers one of the ways.
An alternative way is to detect modularity design smells and form a modularity metric formula (that uses the number of detected instances of modularity design smells). The modularity design smells are: Insufficient Modularization, Broken Modularization, Cyclically-dependent Modularization, and Hub-like Modularization (refer "Refactoring for software design smells").

General: how to validate a proposed system architecture?

Good day,
I´m taking over a guy who started defining the architecture of a HW/SW communication tool. I´m in charge now to validate his progress so far, before writing all the specifications and implement it.
How can I formally proceed? Is there a methodology to validate a HW/SW architecture against intial top-level requirements?
Cheers,
Funky24
In general, your architecture is "valid" if it meets the set of top-level requirements that are architecturally significant to your stakeholders.
With that I mean that:
It's better not to assume that your list of requirements is complete or that they have been written correctly.
You need to make a selection of the most important requirements and focus on those.
In general the list from point 2 will generally include a majority of non-functional requirements (performance, usability, etc). Functional requirements are of course important, but they don't drive the architecture of a system.
A good formal methodology for architecture evaluation is ATAM (for Architecture tradeoff analysis method) from SEI. You could have a look at their technical report and tailor it to your needs and to the size of the project. Since you have not designed the design, you may end up doing some reverse-engineering to figure out why certain choices were made.

Where to start for Tech Specs of an IT project.. more specifically functional specifications

Hi I'm wonderingif someone knows some good resources on writing project specs.
I'm a freelance developer more focused on actual development and less focused
on tech specs.
I'm involved in a proj where have to write technical
specs (& functional req specs) and have absolutely no idea where to
start.. any good site or sample or book you would advise ?
Strongly recommend User Stories Applied by Mike Cohn
Any non-trivial project requires Tech Spec. By non-trivial I mean more than about 1 week of coding or more than 1 programmer.
Although there no much resources online which may help to realize how to make good Tech Specs. So Let me share my vision in this field.
Every spec should contain:
List item
Title
Overview (general words what about the project is)
Operational purpose (what for the project is, the goal)
Functional purpose (the ways and technical methods/resources attained for fulfilling Operational purpose)
Definitions (to avoid polysemy and for clarification purposes)
DATA AND LISTS (the most important and the biggest part of Tech Spec. The section where described data structures, relational database models, choice of programming languages and tools, algorithms, etc)
Wireframes and pages descriptions
Technical requirements (hosting conditions, system requirements, etc)
Сommissioning and acceptance conditions (all criteria which make your job completed)

Suggestions for a business application using logic based system like prolog

I need to develop any business application which includes a logic-based system like prolog. Basically I need to develop a business application and we show that the logic-based system is feasible for that.
This is an academic exercise.
I could think of only puzzles which can be solved using prolog. But I need a business application where I can use prolog.
Can any one please give some suggestions on simple business applications where I can use prolog logic based system?
Thanks & Regards.
How about some kind of resource scheduling like, say, conference rooms, labs, classrooms, etc.? You'd have to keep track of locations, available facilities, events, event priorities, times, what facilities are required for which events, etc. and try to balance these "fairly" in some way. That would be a major challenge for a conventional programming environment and would be immediately useful to boot.
Edited to add:
I found the paper I wanted to reference earlier. You'll have to pay for a copy, but it's worth it if you decide to go this route: School time table scheduling in Prolog
Abstract:
The school Time-Table Scheduling task is a very hard operations research and engineering problem, especially when-implemented in a conventional language. That is due to the imperative, deterministic nature of most conventional languages, such as BASIC and PASCAL and to the long series of constraints and goals inside the problem. The descriptive, logic-based and nondeterministic nature of Prolog language, and its ability to backtrack allows one to easily obtain a deductive data base, mixing the facts, rules, and constraints of the Time-table. Two systems, one nonmonotonic, and one monotonic with a non-monotonic reasoning structure are compared and their performances in a significant test are discussed. The approach may be easily generalized to other analogous engineering, scheduling and operations research problems.
How about a business "contact management" application? I'm thinking it could be prototyped around a couple of features, sending notes to thank customers for recent purchases and perhaps a birthday recognition of some kind.

Have you ever used a genetic algorithm in real-world applications?

I was wondering how common it is to find genetic algorithm approaches in commercial code.
It always seemed to me that some kinds of schedulers could benefit from a GA engine, as a supplement to the main algorithm.
Genetic Algorithms have been widely used commercially. Optimizing train routing was an early application. More recently fighter planes have used GAs to optimize wing designs. I have used GAs extensively at work to generate solutions to problems that have an extremely large search space.
Many problems are unlikely to benefit from GAs. I disagree with Thomas that they are too hard to understand. A GA is actually very simple. We found that there is a huge amount of knowledge to be gained from optimizing the GA to a particular problem that might be difficult and as always managing large amounts of parallel computation continue to be a problem for many programmers.
A problem that would benefit from a GA is going to have the following characteristics:
A good way to encode potential solutions
A way to compute an a numerical score to evaluate the quality of the solution
A large multi-dimensional search space where the answer is non-obvious
A good solution is good enough and a perfect solution is not required
There are many problems that could probably benefit from GAs and in the future they will probably be more widely deployed. I believe that GAs are used in cutting edge engineering more than people think however most people (like my company does) guards those secrets extremely closely. It is only long after the fact that it is revealed that GAs were used.
Most people that deal with "normal" applications probably don't have much use for them though.
If you want to find an example, look at Postgres's Query Planner. It uses many techniques, and one just so happens to be genetic.
http://developer.postgresql.org/pgdocs/postgres/geqo-pg-intro.html
I used GA in my Master's thesis, but after that I haven't found anything in my daily work a GA could solve that I couldn't solve faster with some other Algorithm.
I don't think it is particularly common to find genetic algorithms in everyday-commercial code. They are more commonly found in academic/research code where the need to find the "best algorithm" is less important than the need to just find a good solution to a problem.
Nonetheless, I have consulted on a couple of commercial projects that do use GAs (chiefly as a result of my involvement with GAUL). I think the most interesting example was at a Biotech company. They used the GA to optimise scoring functions that were used for virtual screening, as part of their drug discovery application.
Earlier this year, with my current company, I added a new feature to one of our products that uses another GA. I think we might be marketing this from next month. Basically, the GA is used to explore molecules that have the potential for binding to a protein, and could therefore be further investigated as drugs targeting that protein. A competing product that also uses a GA is EA inventor.
As part of my thesis I wrote a generic java framework for the multi-objective optimisation algorithm mPOEMS (Multiobjective prototype optimization with evolved improvement steps), which is a GA using evolutionary concepts. It is generic in a way that all problem-independent parts have been separated from the problem-dependent parts, and an interface is povided to use the framework with only adding the problem-dependent parts. Thus one who wants to use the algorithm does not have to begin from zero, and it facilitates work a lot.
You can find the code here.
The solutions which you can find with this algorithm have been compared in a scientific work with state-of-the-art algorithms SPEA-2 and NSGA, and it has been proven that
the algorithm performes comparable or even better, depending on the metrics you take to measure the performance, and especially depending on the optimization-problem you are looking on.
You can find it here.
Also as part of my thesis and proof of work I applied this framework to the project selection problem found in portfolio management. It is about selecting the projects which add the most value to the company, support most the strategy of the company or support any other arbitrary goal. E.g. selection of a certain number of projects from a specific category, or maximization of project synergies, ...
My thesis which applies this framework to the project selection problem:
http://www.ub.tuwien.ac.at/dipl/2008/AC05038968.pdf
After that I worked in a portfolio management department in one of the fortune 500, where they used a commercial software which also applied a GA to the project selection problem / portfolio optimization.
Further resources:
The documentation of the framework:
http://thomaskremmel.com/mpoems/mpoems_in_java_documentation.pdf
mPOEMS presentation paper:
http://portal.acm.org/citation.cfm?id=1792634.1792653
Actually with a bit of enthusiasm everybody could easily adapt the code of the generic framework to an arbitrary multi-objective optimisation problem.
I haven't but I've heard of this company (can't remember their name) which uses mutating, genetic algos to calculate placements and lengths of antennas (or something) from a friend of mine. And they're supposed to (according to my friend) have huge success with this. I guess GA is just too complex for "average Joe developer" to become mainstream. Kind of like Map Reduce - spectacularly cool, but WAY too advanced to hit the "mainstream"...
LibreOffice Calc uses it in its Solver module.

Resources