How to develop modules that hide complexity

When developing functionality in an app there are many design challenges for the developer. One of the most important ones that determines how easy / hard the entire solution architecture is to develop and maintain over time is how well each function / module / class that is created hides the complexity within.

The main purpose of a module in a larger system is to hide complexity

An example to illustrate this is when developing interactive CAD-configurators where the user can place components with the mouse, but a strict set of rules still need to be applied. Lets say the user can create a door on a wall section with the click of a mouse button. This requires both infomation about the click, the door and how this comes together in relation to existing components (like a wall).

The following four alternatives for the addDoor function illustrates how different approachers will impact how much complexity is hidden

1 – No complexity hidden

assembly.addDoor(doorObject, position)

An entire door object needs to be created outside the function and rules affecting position also needs to be handled outside the function – no complexity hidden

2 – Door complexity hidden

assembly.addDoor(doorType, size, position)

Only type and size is needed here but position rules still need to be outside the function – door complexity hidden

3 – Positioning complexity hidden

assembly.addDoor(doorComponent, requestedPosition)

The door object is created outside but the position is just a request and rules for actual position is computed inside – position rule complexity hidden

4 – Both door and position complexity hidden

assembly.addDoor(doorType, size, requestedPosition)

Combining 2 and 3 results in hiding of both door and placement rule complexities

There will always be trade-offs that keep you from hiding all complexity in the function. But becoming aware of this mechanism is the first step to designing good modules and well functioning architecture.

Strategies for CAD assemblies in visual configuration

With a class based definition of CAD assemblies in a web configurator there are two main strategies to choose from: Property driven or interaction driven assembly

Property driven CAD assembly

With the property driven approach there is a set of properties that are known in advance and can describe the entire assembly. The number of parts and layouts can vary but its all driven from changes in the same properties.

PRO: The benefit of this is that the entire assembly can be controlled with a single procedural sequence which can start from an empty assembly (see docs on how component handler and clearAll works).

CON: The weakness of the property driven approach is that it cannot store states in the different components (like changing a specific size).

Interaction driven CAD assembly

With the interaction based approach the assembly is generate through a set of predefined methods on the assembly class (eg. assembly.addDoor(…), assembly.configureSection(..). These methods needs to be created by the person implementing the class based configuration and carefully shaped to match the intended interactions.

PRO: This enables complex configuration guided with the mouse (drag and drop configuration) and gives a lot of freedom to the user.

CON: The drawback is the increased skill requirements and time needed for the person implementing the interaction based approach. The predefined methods need to hide complexity and handle all the edge cases of all potential mouse interactions, yet still produce a valid assembly.

Generating STEP-files from any geometry

Would you like to develop a DynaMaker application that includes static 3D files and exports STEP-files? With our Design Automation Service, you can now effortlessly generate and export STEP-files from your application regardless of if your app uses static models or not!

In our previous article on using your own static assets, we demonstrated how you can create an assembly that utilizes both static and parametric models. Here, we will expand on that concept by demonstrating how you can generate and export a STEP-File from the entire assembly. Before the Design Automation Service, it was only possible to create STEP-files from parametric models. However, with this service, you can effortlessly create them regardless.