About programming on 1C Enterprise 8

If you write in SI
Be at least three times lamer
About this they say:
"He is a cool programmer!"
(Fidoshnye songs - "What is Suxxx and What is Rulezzz")


The reason for writing this article was the negative attitude of the professional community to the specified platform and programmers.

As a programmer who chose 1C, I think this opinion is unfounded. The 1C platform is far from ideal, but, in my opinion, it is the best, and most importantly, a domestic product!

And even more so, it is inadequate to judge the abilities of a programmer by the language in which he writes.

In this article I will describe the advantages that I found for myself in the program. The article will turn out almost advertising, therefore immediately the disclaimer:
  • I have no direct relation to 1C;
  • This article is not custom-made, and written solely on a voluntary basis;
  • In some cases, a personal opinion is expressed, which may not coincide ...;
  • The entire article, with the exception of the prologue, is the author's; any coincidence is an accident;
  • It will be about the 1C Enterprise 8.2 platform (currently version 8.3 is relevant, but I have not studied it yet - a lot of work on 1C 8.2). However, most of the above applies both to platform 8.3 and to earlier versions, and part to version 7.7.

So let's get started.

What are you talking about?

The 1C Enterprise 8 platform is:
  • It works in two versions - file and server (three-link) - each has its own advantages and disadvantages;
  • Independent accounting system that is easy to install and configure;
  • A powerful ecosystem for programmers with all the necessary objects and tools;
  • Nice ergonomic interface;
  • A relatively inexpensive solution for business;
  • Franchisee network, elementary education;
  • A powerful base of know-how and knowledge accumulated over the years;
  • At times a problematic platform for system administrators;
  • Not the fastest execution of the algorithms (although not the slowest) is a tribute to informational content (with errors, the line number and its contents are indicated);
  • There are no classes in the programming language (inheritance, encapsulation, polymorphism), there are no anonymous functions and other modern features. But to solve most problems - this is not necessary!

For the organization of accounting - one platform is not enough. A platform is a kind of “engine”, an intermediate link between a program and a database. Programs for this "engine" are called configurations. The configuration describes the database structure in the form of objects, the texts of the procedures stored in separate modules (there are many modules, both each object and the system as a whole have them, as well as common modules). The platform represents a level of abstraction at which direct access to the database is not required, and also allows you to abstract from the operating system and type of database.

File and Server Databases

The platform consists of several parts and can work in a file or server version.

In the file version, the entire database is contained in one file (with the extension "1cd") - the platform is installed on each computer and directly reads / writes to the database.

The advantages of the file option are the low price and ease of deployment.

Cons - the 1cd file structure is closed, there is no single system interacting with the database. As a result, it is difficult to use with a large number of users (tried for 20+ users - you can work). In addition, with a database size of approximately 15 GB (or more), dynamic update failures occur. Solving such failures is a difficult task, and the utility for repairing the database does not always repair, and sometimes cripples, the database.

There is a solution - this is, first of all, setting up a daily database backup. In addition, craftsmen not only publish the 1cd file format, but also developed utilities for working with such files and a number of methods to solve such problems.

In the server version, the database storage platform uses a SQL server (usually it is MS SQL, but starting from 8.2.14, you can use some others, for example, Firebird PostgreSQL, IBM DB2, Oracle Database), and the platform itself uses a three-tier architecture:

Part of the code is executed on the client, part on the server. In this case, only the server interacts with the database. Moreover, starting from version 8.2, in addition to the standard operating mode, which was called the “thick client” mode, two new operating modes appeared - “thin client” and “web client”; “managed forms” also appeared, the appearance of which is built in the form of an abstract tree of elements. Programming for managed forms and a three-tier architecture is more difficult, but this allows you to transfer almost all the load to the server (i.e. you can buy one powerful server and hundreds of the cheapest office computers).

Advantages of the platform: “three-link” - load balancing, openness of the database (officially, 1C company disclaims responsibility for any data corruption if changes were made to the SQL database except by the means of their platform or server, but this doesn’t stop anyone), the lack of restrictions.

Cons - price: you will have to buy separately client licenses for each client computer, separately - one license for 1C server, separately a license for SQL server, if you do not use a free one. Also, sometimes there are difficulties in the database. They are solved much faster due to the availability of data and the availability of external tools for working with the database. In addition, in this case, you should backup the database.

A common plus is the versatility of the configuration code: with some exceptions, the configuration developed for the file database will work on the server database, and vice versa. An example of an exception is the transfer of a mutable value to a server or from server to client (in the file version this will not cause exceptions, but in the client-server version it is prohibited).

Another plus: the platform is installed very simply, something like this: "Next-Next-Next-OK", you do not need to fine-tune and install any components.

For the server version, there are several more settings, but everything is done in the installation dialog and does not require to write something in separate files. Installing a SQL server can be a little tricky because in this case, the settings are much larger (and to fine-tune it requires the study of additional instructions). But this does not apply to problems of the 1C platform. Moreover, if you install, for example, MS SQL server with all the default settings, then 1C will be able to work with it.

This is more than bookkeeping.

When it comes to the 1C platform, it seems, first of all, as a program for accounting. Indeed, this is the most popular area for using the 1C platform. But 1C does not live by single accounting!
Those who are familiar with the platform say that this is a system of accounting (automation of accounting). This is closer to the truth - there are many configurations, both from 1C and from third-party developers. Some are only indirectly related to accounting, some are not related at all.

In general, it is more correct to represent the 1C platform as a shell for object modeling of a database, interface, and programming in 1C language. The only limitation is that each configuration has its own database, and only one (however, it is possible to connect external data sources, i.e. other databases as part of the configuration).

Ecosystem for programmers

Now consider the 1C language and the platform from the point of view of the developer:
The database object model. Firstly, we do not work directly with databases. It's not needed. For our convenience, all data is presented in the form of interconnected objects (directories, documents, information registers, accumulation registers, ...), and the platform is automatically “pulled out” of this data from the database.
For example, provided that the variable “Item of Nomenclature” contains a reference to an element of the reference book “Nomenclature”, the reference book “Nomenclature” has the attribute “Main Supplier”, such as the reference book “Contractors”, and the reference book “Counterparties” has the attribute “Full Name”, then the code:


... will lead to the fact that the 1C platform, using internal mechanisms, will find an entry in the table corresponding to the “Contractors” directory by identifier from the “Main Supplier” field of the item and return the value of the field corresponding to the “Full Name” field in the object model of the “Contractors” directory.

There can be many such dereferences - the system will cope. The only caveat - the system does not know how to optimize dereferencing, so you should strive to take them out of every possible cycle.

In addition to the objects that describe the data, there is a huge number of system objects - for a variety of functions. I will highlight some of them:

Value stores

An array is an object that stores a data set, in contrast to the classical concept of arrays. It can be data of various types (number, string, link, other object). It has minimal functionality and is used mainly as a temporary container for transferring values ​​between other repositories.

List of Values - an object, mainly for working with the user interface. In addition to the data, for each element it may also contain a view, a flag attribute, and a picture (icon). It also has the methods "Select Element ()" and "Mark Elements ()" - when called, the user is shown the interface dialog (which is convenient - you do not need to create this dialog in the configuration).

Structure and Compliance- storage of paired values ​​"KeyValue". In the “Key” structure, this is a line that obeys the rules for naming variables in 1C (without spaces, do not start with a number, consists only of letters, numbers and the underscore). In accordance - “Key” is any value. The fastest search for objects is in accordance (faster than in an array and indexed value table).

The Value Table is a very convenient, and rather fast, object for storing and processing data. Columns in the table of values ​​can be added and deleted, regardless of the number of records. In this case, the data in the rows is not lost (or only data from the cells corresponding to the deleted columns is deleted). Also, it has the “SelectString ()” method, which brings up the row selection dialog. There are indexes.

Value Tree- An object representing hierarchical data. It contains columns, the set of columns is the same for all records at all levels. Removing / adding columns in the value tree is just as easy as in the value table. Also, it has the “Select Line ()” method.

Interface objects and objects for working with various data Text Document, Tabular Document, Web browser, Read File, Write File, Read ZIP File, Write ZIP File, Read XML, Write XML, HTTP Request and many more objects, and there is a built-in help in the configurator. The purpose of the listed objects is evident from their names and all this is immediately in the platform.

Separately, it should be noted that there is an object “Metadata” - with the help of which it is possible to study the data structure in a programming language, as well as with each link or object for a reference, document, chart of accounts, etc. there is a method “Metadata ()” - providing a description of this directory / document / chart of accounts / etc. in the database (what details, tabular parts are available, code / number length, etc.). It is often very convenient.

And separately, it should be mentioned about the objects: “Request”, “Request Builder”, “Request Builder”, “Report Builder”, “Data Layout Scheme”. This family implements a set of objects for working with the powerful 1C query language.

Query language.Requests in 1C are used only to obtain a data sample with convenient selection, sorting, grouping. In a first approximation, this is a SELECT statement from SQL translated into Russian, however, in the 1C query language there is also a functionality that is not available in SQL, namely:

  • Work with 1C configuration objects, instead of SQL tables;
  • Work with links, instead of SQL identifier fields;
  • Dereferencing support, similar to how it is done in code;
  • Selection for joining the group (for reference);
  • Hierarchical results;
  • Temporary tables and nested queries (SELECT * FROM (SELECT ...)));
  • The query designer is a convenient, object-based, automatically optimizing query text for quick reading, which can parse the query text (parse the query text and build an object model from it);
  • Report Builder - an add-on over the query mechanism, which adds functionality for automatic processing of results, as well as flexible configuration of the query itself in the "Enterprise" mode (ie, by the user). As a result, a universal report appeared in standard 1C platforms in which the user can configure what data and in what order he wants to see what is in the rows, in the columns, and the report itself generates an output table;
  • SKD (Data Composition System) is the next model that incorporates the functionality of a universal report and adds some results processing functions to it.

language 1C syntax is similar to “Russian Pascal”, but differs from “Pascal” in less rigor and lack of some constructions:

  • There is no need to declare variables - you can initialize directly in the module text;
  • There is no hard typing of variables. There are value types in the system, but there are no strict typing rules for variables. The variable that stored the link can already store a number or a string in a couple of lines of code;
  • You can add variables with values ​​of different types, while the type of the result will be the same as the type of the first variable, for example:
    к = “25”+1; // к = “251”, не 26
  • Variables with values ​​of different types can be compared for equality or inequality (but not more or less, this will throw an exception) - naturally, such variables are not equal;
  • There are functions and procedures, it is permissible to use recursion (with a restriction on the depth of the recursion);
  • When specifying a function or procedure without parameters - anyway, be sure to specify empty brackets at the end: here_so ();
  • There are modules: each directory and document have several, in addition, registers, reports and processings have modules, and each form, as well as in the configuration, has the ability to create general modules;
  • No classes, inheritance, encapsulation, polymorphism;
  • A function cannot be passed as a link; there are no anonymous functions;
  • There is no reverse loop (for i: = 5 downto 1 do), but it is really needed when deleting records. We get around a slightly longer record through the “Bye” cycle.

  • In the 1C platform, it is possible to upload and download configurations, compare configurations with other configurations and partially upload changes;
  • It is possible to unload texts of modules for their batch processing and load them back into the configuration;
  • If the configuration is supported (all configurations from 1C were initially supported), then you can always make a comparison and see what has been changed by third-party developers or local experts;
  • It is also possible to upload / download the entire database (along with data);
  • For collective work on one configuration, the configuration repository is used;
  • There are also a number of rules for making changes to standard configurations, there is even a document from 1C that describes the methods and standards for changing standard configurations (and any other).

General impression
1C language combines the clarity of the texts of the Pascal language with the frivolity of working with variables of the BASIC language. It lacks a number of features inherent in modern programming languages, but without them it is quite possible to do. In addition, the 1C platform has a powerful garbage collector, i.e. it is not necessary, for example, to clean tables after use or to delete them.

Interface 1C Enterprise 8.2

1C company paid special attention to the interface of its program. First of all, it is a color palette. She is gorgeous! The windows of the program are recognizable even from afar, while over many years of work - they do not cause hostile feelings, on the contrary - I want all the programs to be just as cool.
At the same time, the style of the platform is very strict, without frills and other frills. At the same time, there are very useful functions, for example, storing window sizes (the sizes are remembered only when they are changed by the user, and at the same time, you can always reset the user settings - to the sizes and positions by default by pressing Alt + Shift + R).
The interface of the Web client 8.2 raises a number of complaints, but, it seems, the 8.3 platform brings with it a new redesigned interface - “Taxi”.

Prices, supply and demand, franchising

The most “tasty” advantage of the 1C platform is its price. Especially, this is relevant now, during the crisis. After all, 1C is completely our domestic product. And it is sold for our wooden ones. Such solutions from a foreign manufacturer will cost a lot of money. And licenses for 1C are quite acceptable.

In addition, 1C has an interesting licensing policy. Licenses and configurations themselves are bought once. At the same time, licenses are bought on the workstation and on the server, but not on the database, and not even on connections, i.e. under one license, the same user can start an unlimited number of 1C sessions, working with any number of databases. The same applies to configurations: by purchasing one license for a configuration, an organization can use it to create any number of databases, moreover, it is officially allowed to use parts of the code and objects of this configuration when developing their own configurations (while you can sell / transfer your own configurations, stipulating that to use them you need to buy a configuration from 1C).

After this one-time purchase, you only need to sign up for updates and once a year pay for a subscription renewal, the so-called. ITS. By the way, a subscription is very inexpensive, approximately like two client licenses.

In general, all this looks very profitable.

The second "tasty", but with a fly in the ointment, plus, is the presence of fairly universal configurations from 1C itself and from partners.
About versatility
The concept of “universality” was defined by one school teacher on NVP by the example of gas masks: there are universal ones that protect against many damaging factors, but the degree of protection is medium or lower than average, and there are also specialized gas masks that protect against one exposure, but with a high degree of protection. So far, I have not come across a more precise definition.
And configurations from 1C are exactly universal. In practice, there are no tasks where they could be fully used without modifications. Nevertheless, 1C managed to create a universal set of tools covering the needs of most sectors of modern business.

The third plus (and also with a fly in the ointment) is a network of franchisees and training centers, both for users and beginner programmers and administrators. Good idea, but very mediocre quality of its implementation. Nevertheless, prevalence and aggressive marketing is one of the reasons for the widespread popularity of 1C in our country (and this is also the reason for negativity, envy and hatred).

A spoon of tar

Having painted 1C in all colors, it would be unfair not to say about its shortcomings, and they really are:

Unstable releases - both in the platform and in the configurations, there are a huge number of errors and glitches. And this is in official releases. Before releasing the official version, the "Version for review" is released. There is also feedback for sending error descriptions to be accepted for correction. However, either the versions for review are not very popular, or the 1C company itself does not have time to process all the letters by the release date, but a fact. Each time updating the platform or configuration, you can stumble upon the most unexpected “surprises”. The company 1C has repeatedly been called on to test their developments more thoroughly.

Franchisees (hereinafter referred to as franchisees). Ideally, as planned, these were companies with qualified specialists who knew the basic principles of configurations and platforms. These same companies would have to sell the platform, configuration and support, slightly "finish" universal configurations to customer requirements (and at times - adjust these requirements), trying to modify the standard configuration minimally. So as not to complicate future updates much. But in reality the opposite is true.

When selling new licenses to a client, franchis receive 50% of their value (minus income tax 13% of these 50%). At the same time, we do not need to produce anything ourselves, we just need to transfer the keys from 1C to the buyer.

In providing the same services, franchises do not pay 1C anything (except for membership fees), but they need to pay a salary to the employee. You also have to spend money on taxes to the state - the FIU and income tax.

It turns out that both 1C and the franchises are profitable to sell licenses and it is not profitable to carry out further support. At the same time, for the client to buy the program, it is necessary to tailor it to his requirements from the beginning. And you have to pay for the work. And here, for the purpose of saving, students, pupils, non-specialists are attracted, to whom they can pay a little, and sometimes not pay at all, they can even not be registered for the state (they will work informally, since there is something to pay for). The result is a huge number of sales with very low quality. Improvements, as a rule, affect important mechanisms and complicate future updates. But at the sale stage this is neither 1C nor the franchisee is interested.

I note that this is not so much the fault of businessmen from franchises as the 1C company. Focusing on sales, she did not care about support at all (I'm not talking about schools now, but that it should be beneficial for the franchisee company and 1C to provide support).

Tech support.In the understanding of 1C, technical support is the provision of access to the “update” section for the platform and configurations, as well as to information sections containing a description of some mechanisms and features of 1C operation. In addition, a disc with the indicated materials is provided upon subscription. There is also a forum (very scarce in comparison with folk). There is still the opportunity to send an email to 1C - but not even hoping that they will answer it (or the robot “The letter has been sent to the development department” will respond.) In terms of development, Yandex.Search and the help built into the configurator provide much more support.


In this block, the author talks about himself
I switched to 1C in 2008, and before that I worked in a company developing its accounting program (Delphi 5, then Delphi 7). At first I got acquainted with the 1C Enterprise 7.7 platform and I was struck by the simplicity of developing reports. At the same time, it was clear that reports were generated much longer than in similar mechanisms on Delphi, but accountants were not particularly concerned about this. To wait a few minutes instead of a few seconds is not a problem. On the contrary, you can make up nails there, have a drink of tea or discuss the latest news without interrupting work. Indeed, the vast majority of accountants in our time are women.
However, the 7.7 interface was very limited, and the set of objects was very scarce. I was looking for alternatives. I got acquainted with external components, but they didn’t get to practical use, because the boss decided that it was time for us to switch to 8.1 (yes, 8.2 wasn’t there yet), and in this platform, as a programmer, I found everything that I had previously lacked.
Currently, I have authority among colleagues, as well as clients who have come to me from franchises. They will probably never contact the Franks again.

In general, I am quite satisfied with the work in the 1C Enterprise 8 platform. It is suitable for solving most accounting tasks and tasks using a database.

Also popular now: