📜 ⬆️ ⬇️

Almost correct development on 1C, without revolutions

Do you know why it is so fashionable to implement Agile / Scrum / Kanban in development teams? If to be completely honest to the end, the introduction of flexible development methods pursues only one goal - to bring the team closer to the users of the product. Every two weeks, the developers should not think about design patterns, not whether to choose a new, interesting LinkedList algorithm for implementation, or ArrayList will be enough, and not about how cool protobuf technology will be or not in the project ZeroMQ ; But about what benefit from this will be the operators working at the enterprise in the warehouse, the loaders and drivers, the turners in the shop and the cashiers-sellers in the store . In SCRUM, this is usually called the two terms Minimal Valuable Product and Bussiness Value . By and large, the point is not in fashion, but in efficiency, without prejudice to the comfort of both parties - the business and the IT team.

Theoretical introductory


Before you begin to tell your "failure stories with 1C", I will try to tell a little about DSL languages. Or rather, about the concept of "problem-oriented languages."

Domain Specific Language, DSL - "subject-specific language") - a programming language specialized for a specific application, is the key concept of language-oriented programming.
There is no problem, there is a subject
In fact, I'm a little sly, giving you the definition of the Russian-language Wikipedia. Since adding the word “problem” I try to send you to the original source, where the author Martin Ward formulated the basics of language-oriented programming.


Any new language in the world (be it PHP, ruby, python, Erlang, LISP, Closure or 1C) was originally created as a response to the problem. That is, if you are seriously going to learn any language or “framework”, you need to remember “for what” the author created it, remember that the author did not like it in other platforms. In this sense, for example, the story is interesting, as the same Node.JS appeared . Initially, I wanted to make an easy way to create scalable network servers, to which it degenerated as a result, I think, I already know, the respected habrasoobschestvo.
')
Therefore, I will talk about the problem of "automating business processes" and the emergence of Business DSL .

Enterprise DSL (eDSL) or Business DSL (bDSL)


The main problem that had to be solved in the language of the developer from the 90s was something like this:

Many people who form a multitude of wishes - everyone wants automation
select * from * as requirements 
. You leave to write in C | C ++ for three months, but they always require something and do not allow to work quietly. At the same time, most of the business requirements are, firstly, known for a long time, and secondly, they operate on a finite number of objects: “Enter introductory reference information, fix something, calculate something, display a report on the results of calculating something” and more not necessary.


If, according to TRIZ , the ideal system is a system that does not exist, but its functions are performed , then the ideal DSL language for this seemed like this:





Why in Russian, you ask? Yes, because the user formulates this way (and most of our users live on exUSSR territory). As a result, we do not waste time on the formulation of requirements and their transformation to design standards, where the development is conducted in English. A single dictionary - little adaptation costs. Effectively?

You can by the way, and in Ukrainian, if the user wants

// offhand, could be mistaken in writing
System = Install System Automation ();

Sistema.ZapustitVvedennyaDovіdkovoІІnformatsії ();
Sistema.ZapustitiOblŃ–k Attributkovyh Akkladnyh ();
Sistema.SvoritiHiDovKhDanikhDlyaRosrahunku ();
Sistema.SvoritiZvŃ–tiFor Forte ();

Sistema.ZapustitiOperator_vNaSkladŃ– ();



As you understand, as a result, even the user himself can automate a little if he studied Basic at school. With such a message, the platform under discussion was created, although as it was in reality, only its authors know. Further in the text I will call this platform, sometimes 1C, and sometimes eDSL. so that you get used to both concepts and understand that what I mean is the platform, not legal entities.

Improving the quality of development and developer level


But as you already understood, you have to pay for everything - having a fast platform for business automation leads us to the fact that from the phrase “fast, cheap, good - choose any two” , the eDSL platform makes us choose the side quickly and cheaply. That is its competitive advantage. And if you play “short,” it gives a quick effect, or, on the contrary, a quick understanding of the fallacy of the process (something was automated, it didn't work, it was done differently). But in any case, further development will be needed - and it is almost NOT possible to develop good products.

In order not to lose the speed of development of the final business systems, and to make it better (it became good), the only thing we can do is to start doing it NOT cheap. And as you understand, there is no money, more precisely, no one will allocate them for the improvement of the quality of a “certain” platform, which somehow implies that everything is qualitatively in it (according to marketing materials). Therefore, the only place where we can increase costs is either in the development zone of tools for the 1C platform, or in the development zone of the skills of 1C specialists. Actually, as soon as we start thinking about the quality of solutions, we begin, like all IT specialists, to try to speed up / simplify our development process, without losing efficiency for the business. As you understand, this functionality in the platform for business will not exist - it is also a platform for business, and not for the developer.
To the question that the functional will not be
And again, I'm cunning. In fact, we can say that "not yet." And the movement in this direction is. Usually I advise everyone interested to read Notes from the coolers at my leisure (read the order “from last to first”)


Well, now in more detail about the toolkit, the one that was created and published, and the one that will be presented in the future.

A collection of helpers in working with source codes.


v83unpack (v8unpack-console) - upload in a convenient format the current configuration under development

When you have more than one 1C developer and more than one repository of source configuration files for a business , the first 2 quality problems you want to solve:


about task management systems
It is foolish to assume that in 1C specialists there are no task management systems. At the moment, I know that there are precedents for industrial use:
1. Jira (Stash, Confluence), TFS2013
2. OpenProject, Redmine
3. Bitbucket, Github, Taiga.io
even DevProm, and more.


How it works?

 C:\Program Files\1cv82\8.2.15.319\bin\1cv8.exe ENTERPRISE /F"C:\Users\admin\.jenkins\workspace\runTest1C\build\ibService" /Nadmin /P1 /DisableStartupMessages /Execute"C:\Users\admin\temp\.epf" /C"decompile;pathToCF;C:\1cv8.cf;pathOut;C:\repo\git\src;auto;out;C:\Users\admin\.jenkins\workspace\runTest1C\outExport.txt;" 


Using the Jenkins build server plugin as a monitoring tool for the source code file, we get a complete replica of the development history of the configuration in the form of a git repository.

Now the "older comrades" always see poor-quality code or not taking into account the approaches to the correct development



why by the way git
first, only Git maintains the volume of ERP 2.0 source codes
and secondly, only Git has a convenient concept of collective work on a variety of “contexts” of GitFlow tasks, which is critical for 1C specialist as it allows you to manage the “chaos of demands from the user” without causing chaos in the code.


precommit1c - fixing external tools in git repositories as source files

It is wrong to assume that the work of a regular developer goes only with the 1C storage, the quality problem, including arises from the fact that most developers write a very large number of small utilities in the form of external files intended to run in the platform environment. When you have one developer, then Dropbox / YandexDisk / GoogleDrive / etc saves you for versioning, but when you work in a team, git and the internal or external git repository save us again.

The work goes through the git client "hooks" and "suddenly" requires Python (although you can also on bash):

 git clone ssh://git@dev.example.org/operational-managment/goods-trade ./my-goods-trade git submodule add https://github.com/xDrivenDevelopment/precommit1c ./my-goods-trade/vendors/precommit1c cd ./my-goods-trade/vendors/precommit1c exec copy-to-hook.cmd cd ../../ mkdir utils && cp /cygdrive/d/epfs/.epf ./utils git commit .epf -m '   ' git push --all 

what's going on here
By default, I believe that the habrasoobschestvo can read the command line, for the rest I will explain:
0. We get the current configuration source “to automate the sale of goods” from our git source code server (obtained using v83unpack);
1. We take the tool from the project on github where its development is conducted and connect it as an additional git module;
2. Copy the necessary utilities to the service directory .git / hooks ;
3. Copy developed in 1C: Configurator processing in the directory with utilities;
4. We place in the repository and send it to the server;
5. The utility source code is also automatically placed in the repository .


Using this tool from the usual utility for 1C, it can become a whole project on github

Tool1CD - utility for working with platform storage without the platform itself

One of the most popular utilities in the 1C world, along with v8unpack-console , allows you to work with data warehouses as a database, without a platform, including in console mode. On HabreDlya1Snikov - this development is included in the Top-20

The range of application of this utility is wide:


Wow - their bases are crumbling.
Destruction and problem situations are most often not associated with platform problems, but with an attempt not to invest in hardware resources. That is, when, instead of setting up the infrastructure for a solution on 1C, the database continues to be located on the computer under the table of the developer. I usually try to give an example from the world of sqlite for analogy - imagine how many problems you will encounter if you start using sqlite as a means of storing data in a system with the number of simultaneously working users, say 10 and the size of the database is from 1 Gb. For those who want to learn this useful but painful experience, one should begin with the fact that competitive access in this case is extremely desirable in the format of "many readers - one writer . "


With regard to improving the quality of development and developer, then there is a synergy effect , due to the fact that the source code repository 1C platform is also a data repository, it is with the help of Tool1CD that the git repository is replicated.

So, now we have a complete history of all 1C developers in the git repository, and note, without negatively affecting the actual process of “coding” on the platform.

We process the development process, without losing the speed of release of new functionality


Further need only in the following cases:



DevOps engineers are very fond of Chef, puppet , but they absolutely do not like 1C, so we start automating our own activities.

1Script - already known project on Habré. In order not to repeat the article EvilBeaver , I will only say that the current result in the form of a DSL language for automating the work of “ordinary” 1C specialists looks like this:



xUnitFor1C - development through testing for 1C. The most interesting project in terms of quality improvement is that it gives the maximum effect. In fact, it is the implementation of the xUnit specification with the specifics of 1C, and requires a separate publication (which will be next after the current one). The key thing to note here is that the introduction of development through testing (TDD on 1C) requires the highest costs in the first stage: the effect is observed no earlier than 1.5 months later.

Snegopat - your ReShaper and not only.
subtleties of the project
Here I have to say that at the moment “temporarily” the development of the project has stopped. So to say "stopped" in anticipation - also because of the architectural problems of the first version .


But in order to start the practice of using the above tools, most 1C specialists start with simpler projects:

v8Reader - the assistant of association when resolving conflicts in collective development
v8Viewer - an assistant that is embedded, including in TortoiseGIT, for comparing versions 1C of the configuration located in the git repository

This is it, “the world of eDSL”, where the main thing is the automation of business processes, and everything else is microservices and microutilities , produced under the Apache License 2.0 license

To life "raspberries did not seem"


Let's expand our horizons in terms of heterogeneous development:

1C + OpenStack - relation to 1C as a “package” for a cloud platform


1C + Docker - related to 1C as a “collection of containers” .


And of course, 1C + logstash / kibana / elasticsearch - besides just journaling, is also used for BI.


where is php
I draw your attention that I have a bias towards PHP, so I can’t give you links to products that work with PHP in the same style considering the possibilities of both 1C and PHP, combining the advantages of both platforms: my personal opinion is that PHP is P ersonal H ome P age tools and do not assure me of the opposite.


As a conclusion


In the world of 1C developers - I really ask you to pay attention to the word “development”, as an alternative to the words “consultation and implementation” - there have long been no clean 1C specialists. This is, let's say, a myth from the 2000s. Most programmers who professionally create solutions on the 1C platform already have one of the older languages ​​“in their base”: Java, C # or ruby, python is a business requirement and cannot get away from it, including through the huge domestic market of projects CIS countries. And, of course, due to the very dynamic development of the platform itself. On the other hand, the problems of non-quality developers are present everywhere, regardless of language / platform, and this already leads us to the field of psychology and the answer to the question “why people do not develop and why people for the most part do not understand their place in the IT world” . But this is the topic of another article and other methods / tools.

At the same time, as usual, given the openness of licenses, the github.com/xDrivenDevelopment community is open to new ideas and utilities as part of the concept of a weighted approach to eDSL platforms - just without the very revolutions mentioned in the title.

FAQ


Q: And here Agile?
A: eDSL due to the concept in principle of “Agile itself” (RAD platform), its concept does not contain anything about QA (product quality management) - therefore, when introducing flexibility on 1C, you should pay key attention not to “customer demonstration” , and more on the introduction of engineering practices.

Q: How does all this start to use? And then "our 1C" experts @ cencored @
A: Download, install the build server (Jenkins | Teamcity), run the compilation of the solution at night (“syntax control of the code”) using 1Script scripts. Share with the team practices. Configure the replication of source code 1C in git. Come to AgileDays2015 - see how to use static code analyzers .

Q: How much money does it cost?
A: Better think how much it saves on 1C long projects.

Q: But it does not meet the standards of 1C?
A: These tools automate standards and extend them. In most projects on github, you will find direct links to information technology support and the 1C knowledge base .

Q: Why is all this necessary?
A: Fast, cheap and good - select any two and second thesis. Life is too short to do something manually .

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


All Articles