📜 ⬆️ ⬇️

Platform "1C: Enterprise" - what's under the hood?

Hi, Habr!
In this article we will begin the story about how the 1C: Enterprise 8 platform is built inside and what technologies are used in its development.

image

Why do we think this is interesting? First, because the “1C: Enterprise 8” platform is a large (more than 10 million lines of code) application in C ++ (client, server, etc.), JavaScript (web client), and, more recently, and java . Large projects are interesting, if only by virtue of scale, because the issues invisible in a small code base in such projects stand in full growth. Secondly, “1C: Enterprise” is a replicable, “boxed” product, and there are very few articles about such developments on Habré. And it is always interesting to find out how they live in other teams and firms.

So let's get started. In this article we will give an overview of some technologies that are used in the platform, outline the landscape, without deep immersion in the implementation. After all, for many mechanisms a detailed story will pull on a separate article, and for some - on a whole book!
To begin with, it’s worth deciding on the basic things - what is the 1C: Enterprise platform and what components it consists of. The answer to this question is not so simple, because the term “Platform” (for brevity, we will call it that way) is understood both as a tool for developing business applications, and an execution environment, and means of administration. Conventionally, the following components can be identified:

All of these parts, with the exception of the web client, are written in C ++. In addition, there is a recently announced new generation Configurator written in Java.
')

Native applications


C ++ 03 is used to develop native applications. Under Windows, Microsoft Visual C ++ 12 (a profile compatible with Windows XP) is used as a compiler, and under Linux and Android - gcc 4.8, for iOS - clang 5.0. The standard library is used uniformly for all OS and compilers - STLPort. This solution reduces the likelihood of errors specific to the implementation of STL. Now we are planning to switch to the implementation of STL supplied with CLang, since STLPort has stopped its development and is incompatible with C ++ 11 support mode enabled in gcc.
At the same time, the code base of the server is 99% common, and the client's percentage is 95%. Moreover, even the mobile platform uses the same C ++ code as the “big” one, although there the percentage of unification is somewhat lower.
Like most C ++ users, we do not claim to use 100% of the capabilities of the language and its libraries. So, at us Boost is practically not used, and from language possibilities - dynamic type conversion. In this case, we actively use:

Due to the use of multiple inheritance of interfaces (completely abstract classes), the component model becomes possible, which will be discussed below.

Components


To ensure modularity, all functionality is divided into components, which are dynamic libraries (* .dll under Windows, * .so - under Linux). In total components more than one and a half hundreds, we will provide descriptions of some of them:
backendContains the "engine" platform metadata
accntObjects that application developers use to build accounting (charts of accounts and accounting registers)
bslIntegrated language performance engine
nukeOwn implementation of memory allocator
dbeng8File database engine. A simple file server-based database engine based on ISAM, which also includes a simple SQL processor.
wbaseContains the base classes and functions for implementing the Windows user interface — window classes, GDI access, and so on.

Separating into many components is useful from several points of view:

All the necessary components for this launch option are loaded when the program starts. This, in particular, is necessary for registering SCOM classes, which will be discussed below.

Scom


For decomposition at a lower level, the SCOM system is used - ideologically similar to ATL library. For those who did not work with ATL, briefly list the main features and features.
For the specially designed SCOM class:

For example, you can describe in the json.dll component a class for reading JSON (for example, JSONStreamReader).
Classes, instances can be created from other components you need to register in the SCOM machine:
SCOM_CLASS_ENTRY(JSONStreamReader)

-, .
:
IJSONStreamReaderPtr jsonReader = create_instance<IJSONStreamReader>(SCOM_CLSIDOF(JSONStreamReader));

SCOM , . SCOM-, (.. Service Locator), . SCOM . :
SCOM_Process* process = core::current_process();
if (process)
         return get_service<IMyService>(process);

, (SCOM) , , . , — SCOM-, , — . , , «» - . — , , .

SCOM - 1: .


, . Windows, Windows API. Linux- , wxWidgets.
«1:» .

1: , , 2009 , 8.2 « ». , — flow- . , , DTO (Data Transfer Objects).
- «1:», ++ JavaScript. . , , , - JavaScript API (, ), , C++. Internet Explorer Microsoft Edge (Windows), Google Chrome(Windows), Firefox (Windows Linux) Safari (MacOS).

, 1. «» , , «» «1:».

image
1 Linux

image
1

1
image
1 Windows

image
1 — -


Open source


++ Windows (MFC, WinAPI), . wxWidgets, :

.
, Google Test Google Mock -.
SCOM- .
1 . . . .
cURL libetpan pull-request, , , OpenSSL .


«1: ». , , .
.
?

1?
-?
, , , ?

!

Source: https://habr.com/ru/post/269611/


All Articles