User Tools


Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
design_guide_projects [2020/05/27 07:28]
z3dev
design_guide_projects [2020/06/20 07:44] (current)
z3dev
Line 3: Line 3:
 As designs grow in complexity, the need for smaller, reusable parts becomes apparent. This is the time to consider using a “project”. As designs grow in complexity, the need for smaller, reusable parts becomes apparent. This is the time to consider using a “project”.
  
-Projects are simple directories,​ containing several files (parts) of the design. For example, a project for a RC car design would have the various parts. And the reusable parts can be separated out.+Projects are simple directories,​ containing several files (parts) of the design. For example, a project for a RC car design would have various parts. And the reusable parts can be separated out.
  
-rc-car +  * .../rc-car 
-  ​- ​chassis.js +    ​* ​chassis.js 
-  ​- ​tire.js +    * body.js 
-  ​body.js +    * tire.js 
-  ​- index.js+    * index.js 
 + 
 +The '​index'​ within the project is the entry point of the project. The main function of this piece is to create each of the pieces, move the pieces into position, and return the complete design. And by convention, exports the main function. 
 + 
 +<code javascript>​ 
 +const chassis = require('​./​chassis'​) 
 +const body = require('​./​body'​) 
 +const tire = require('​./​tire'​) 
 + 
 +const main = (params) => { 
 +  ​const partA = chassis(params) 
 +  const partB = body(params) 
 +  const tires = [ 
 +    ..
 +  ​
 +  return [partA, partB, tires] 
 +
 + 
 +module.exports = { main } 
 +</​code>​