Transcript of talk: "Common Code Patterns"

KDE Contributor and Developer Conference

Notes taken by: Jonathan Riddell (these are not official material)

More information on the talk can be found here

To share code it can be moved to a core shared library, to a system library or a separate library (but may be too small for a separate library). However code is sometimes duplicated e.g. to allow improvements.

If code is already duplicated there are problems when fixing incorrect code because it's not synchronized. Can't reflect system changes in all implementations. Code can be duplicated inside an application, take it from one application and put it in another.

So proposal is for a common code patterns repository. Have a repository of common functions guarded by a namespace. Use is simple by just including the CCP, Common Code Pattern, file.

This is an example template, and a problem that they had which had duplicated code.

namespace CCP{
int GetProcNumber() {
/*get number of processors*/
}
}

Use by:

include

Advantages are multiplatform, easy to fix, less build system problems.

This is a new proposal based on mature concepts, other projects may adopt this concept.