5

I'm building an Electron app using React. I'm coming from the C# and WPF world and I'm wondering, where should my domain classes go? I understand the concept of components, but what about a class with no UI, just a lot of methods in it?

For example, an application for managing software teams in the company. There is an object Team. It doesn't have any UI, just a few members (methods) on it, like AddMember etc.

Is there a place for such classes in react project? Or should I put it somehow into component?

Pete
  • 3,181
  • 1
  • 12
  • 18
Ish Thomas
  • 257
  • 3
  • 12

1 Answers1

3

Electron is a technology for bundling and packing app. They help in converting a web application as a desktop application. You can electronize your web application if you web application is build using node js and any javascript framework like React, Angular, Vue, etc...

Domain Driven Design is an approach to build complex software. There are 2 aspects of domain driven design. The first is strategic design, and other is tactical design.

The focus of strategic design is to separate the application is different parts (bounded contexts). The intention on separation is have smaller business problems with lower individual complexity that could described by its own lingo (ubiquitous language)

The focus of tactical design is to build the application by focusing on the business first. So we build software purely considering the business domain in core of the project. And on top of this core layer, we add Database access, UI, HTTP communication, Messaging communication.

Your question is about the tactical design of DDD as you are talking about where to place a code. I hope you have completed the strategic design of DDD which talks about splitting your application in to bounded contexts based on your business. There is also a possibility that is not so high and there is only one bounded context.

Option 1: Now if you are using React for building only your UI, and your are using Node Js for building you backend logic, ideally you should not have any model objects (core business code) in the React (UI Layer). The model objects should be in Node JS project.

Option 2: If you are building your electron application only using react and plain javascript with no back-end then you should build the first layer using plain java script that contains core domain logic. This layer has to be using in your UI part (which will be in react)

Nachiappan Kumarappan
  • 1,404
  • 1
  • 9
  • 19