User Tools

Site Tools


code-organisation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
code-organisation [2017/06/23 09:36]
barryfp
code-organisation [2017/06/29 06:42]
barryfp
Line 1: Line 1:
-The previous ​section ​discussed some elements of source code organisation to create multi-component systems. This section describes the complete model behind this idea.+In this section ​we introduce the way in which source code is organised for projects that use multiple components, particularly how we separate **interfaces** from **implementations** ​a key feature of Dana's code re-use and runtime adaptation capabilities.
  
 Programs that you build in Dana are a mixture of your own components and components from Dana's central source tree, or CST (which is a bit like a standard library). All components in the CST are open-source so you can browse them yourself. You can also add your own components to the CST to make them available to multiple different programs. Programs that you build in Dana are a mixture of your own components and components from Dana's central source tree, or CST (which is a bit like a standard library). All components in the CST are open-source so you can browse them yourself. You can also add your own components to the CST to make them available to multiple different programs.
Line 13: Line 13:
 The green lines in this diagram indicate "​in-directory"​ relationships;​ the projectx directory therefore contains four items (two directories and two files) while the resources directory contains two items (one directory and one file) and so on. The green lines in this diagram indicate "​in-directory"​ relationships;​ the projectx directory therefore contains four items (two directories and two files) while the resources directory contains two items (one directory and one file) and so on.
  
-The resources directory, and its sub-directories,​ is used to contain source files that describe **interface** and **data types**. ​Generally speaking ​a source file that contains a type definition (such as an interface) should have the same file name as the type name that it defines.+The resources directory, and its sub-directories,​ is used to contain source files that describe **interface** and **data types**. ​In general, ​a source file that contains a type definition (such as an interface) should have the same file name as the type name that it defines.
  
-The projectx directory ​meanwhile, and each of its sub-directories (except for the resources sub-directory),​ contains source files of **components that implement interfaces**. The general convention for these source files is to name them with the same name as the main interface type that the component provides.+The projectx directory, and each of its sub-directories (except for the resources sub-directory),​ contains source files of **components that implement interfaces**. The general convention for these source files is to name them with the same name as the main interface type that the component provides.
  
 In the above example, the file ''​Road.dn''​ in the projectx directory therefore contains the source code for a component that provides the Road interface as defined in the resources directory. In the above example, the file ''​Road.dn''​ in the projectx directory therefore contains the source code for a component that provides the Road interface as defined in the resources directory.
code-organisation.txt ยท Last modified: 2018/06/07 09:10 by barryfp