Components in J4 use a service-based approach which, in theory, should allow any naming convention. Although for that you'd have to write your own factories.
But if you want to follow same conventions as Joomla core components, start by declaring a namespace in the component's manifest file. The namespace should be in this form:
Component part really shouldn't be needed but, apparently, there is at least one place in core libraries where it's expected for some reason.
The resulting manifest XML would be like this:
Optionally, you could better organize your components by moving classes to a subdirectory. Core components use
src directory but that's irrelevant. In the manifest you'd have to add a
Namespaces declared in the manifest use PSR-4 autoloading. You can read about it here. This should answer most of questions about class/file structure. But there are some Joomla-specific things remaining.
From here, subnamespaces are created per application. Frontend classes are in
Site subnamespace, backend classes are in
Administrator subnamespace and API application (new in J4) classes are in
Api subnamespace. So, for example, classes in
administrator/components/com_mycomponent/ should have
Irata\Component\MyComponent\Administrator namespace declaration.
When using core MVC factory, model, controller and table classes should be split into subnamespaces by type (
Table) and class names should be composed of item type (article, item or whatever) and class type. For example:
The view is handled differently in that it adds item type as a subnamespace and classes consist of page format (e.g. Html or Feed) and class type (i.e.
Form field and rule class name should consist of field/rule type and class type suffix. E.g. if you have a field with
type="Dropdown", class name should be
DropdownField. There is no limitation to what namespace to use but you have to register it using
addruleprefix attribute. Also new in J4 are form filters which follow the same convention as fields and rules. Register them using