#31 1с с нуля. Препроцессор и его инструкции. Директивы компиляции. Часть №2 |#1С| #программирование — Transcript
Full transcript
- 0:16So, let's, before we examine the
- 0:18compilation directives, which I've
- 0:20already opened in the Syntax Assistant,
- 0:23briefly recall how the code execution
- 0:25process works. That is, there are
- 0:29several stages involved. The first is
- 0:31preprocessor processing. The second is
- 0:35compilation into 1C internal bytecode.
- 0:39And the third is interpretation. What
- 0:42does that mean? The execution of
- 0:44bytecode within the 1C environment. At
- 0:49the same time, we must consider that
- 0:51the same module can be compiled both on
- 0:54the client and on the server. With the
- 0:59help of preprocessor instructions, we
- 1:01can specify whether our specific code
- 1:07or a part of it should be executed here
- 1:10or there. So, we make the choice using
- 1:14instructions. That's it. Now let's move
- 1:18on to compilation directives. Again, I
- 1:23have opened the compilation directives
- 1:25using the search in the Syntax
- 1:27Assistant. But it is important to note
- 1:31that, for example, in versions of the
- 1:341C platform 8.0, 8.1, programmers
- 1:38basically didn't think about separation
- 1:41into directives, because they simply
- 1:43didn't exist. That is, the same
- 1:46functionality was available both on the
- 1:49server and on the client. So we didn't
- 1:52have that concept at all. We didn't
- 1:54even have a separation; there was no
- 1:58need to somehow separate or analyze
- 2:01this. Starting from platform 8.2, the
- 2:05concept of a managed application
- 2:07appeared. And why did such a need arise
- 2:11at all? That is, what influenced it,
- 2:16its emergence. What happened? We saw
- 2:20the appearance of the thin client and
- 2:23the web client. And, accordingly, the
- 2:26thin client and web client can work
- 2:29over the Internet. Naturally, this
- 2:33imposes restrictions on data
- 2:35transmission. In this regard, this
- 2:37separation between client and server
- 2:39appeared. Now let's talk about what a
- 2:43compilation directive is. Look, every
- 2:47procedure and function of a module, say
- 2:49a command module or common module—you
- 2:51can even read the description—is
- 2:57accompanied by such a symbol, and what
- 2:59directives are available to us?
- 3:02AtClient, AtServer, AtServerNoContext,
- 3:06AtClientAtServer (shared), and
- 3:09AtClientAtServerNoContext. Well,
- 3:14naturally, we have seen these
- 3:15directives more than once; they are
- 3:17present in the text. I even opened the
- 3:20implementation, the form, the document
- 3:23form, "Goods". Accordingly, they are
- 3:26present here in huge numbers. All our
- 3:29procedures are equipped with these
- 3:31directives. So it is clear from them
- 3:33where the execution takes place. Let's
- 3:37briefly go through each of them. It
- 3:40will also be quite brief, because we
- 3:42will analyze them in more detail later.
- 3:45Well, judging by the name AtClient,
- 3:48AtClient means that our code will be
- 3:51executed in the context of the client
- 3:54application. What will be available
- 3:56here? Only elements, parameters, and
- 3:58form attributes will be available here.
- 4:02Briefly regarding the "at client" and "
- 4:05at server" directives, it's clear from
- 4:09the names that for our procedures and
- 4:14functions, not only form data—which
- 4:16we discussed for the client—will be
- 4:18available, but also the ability to
- 4:20access database data. That is, the code
- 4:24execution will take place on the server
- 4:27. Calling client-side procedures is no
- 4:31longer available here. How does that
- 4:34happen? When on the server, you cannot
- 4:37initiate calls to client-side
- 4:39procedures and functions. Well, there
- 4:42is an exception within the
- 4:44collaboration system, but I think we
- 4:47will look at it later, perhaps towards
- 4:50the very end, because the collaboration
- 4:53system is a mechanism that, for example
- 4:55, isn't that widely used. It is used,
- 4:59but it's a specific mechanism, so we
- 5:02aren't talking about it for now. This
- 5:06is what happens when we use the "at
- 5:10server" directive. When calling a
- 5:14procedure or function under this
- 5:18directive from a form, the client wraps
- 5:22the form context and sends it to the
- 5:26server. Then this entire package is
- 5:31returned back. So, in this way,
- 5:35interaction happens several times.
- 5:40Naturally, this is resource-intensive,
- 5:43because, look, we have directives like
- 5:47"at server without context." What do
- 5:51they mean? "At server without context"
- 5:55means our code will execute on the
- 5:58server, but there will be no access to
- 6:00the form context, attributes,
- 6:02parameters, or elements. Only
- 6:05non-contextual procedures and functions
- 6:07are available. So, with this call from
- 6:13the client side, only the data
- 6:15specified as our parameters is
- 6:20transferred to the server side. What is
- 6:26sent back is only the information we
- 6:29needed, already in a prepared format.
- 6:33This means that data transmission is
- 6:37significantly reduced, because instead
- 6:42of potentially passing all the data
- 6:46back and forth to the server, here it
- 6:51is limited. Yeah. Next, we have the "at
- 6:57client at server without context"
- 7:00directive. It is encountered rarely.
- 7:06Why is it needed? It is needed if you
- 7:08require the execution of a directive.
- 7:10Well, if a procedure or function needs
- 7:13to run on the server or client, but
- 7:17again, on the condition that it is
- 7:20without context. Next, we have "at
- 7:23client at server." Essentially, it is
- 7:27an analog of "at client at server
- 7:29without context," but it is only
- 7:31available in a command module. That is
- 7:35what can be said about these directives
- 7:38, very briefly. As we write code, we
- 7:42will be looking at all of this, because
- 7:45fitting everything into one video won't
- 7:48work. So, what else is possible, what
- 7:51limitations are there regarding these
- 7:55directives and recommendations? For
- 7:58example, look at compilation directives
- 8:01like "at client", "at server", "at
- 8:03server without context"; where should
- 8:06they be used? They should only be used
- 8:09in managed form module code and command
- 8:12module code. In other modules, 1C
- 8:16generally recommends using preprocessor
- 8:19instructions. Again, we will cover
- 8:22these points as we go and look at why
- 8:26this is advised in principle. So. What
- 8:33else can be noted is that when we
- 8:36execute code, we shouldn't mindlessly
- 8:40use the "at server" directive, because
- 8:44it causes heavy traffic and large data
- 8:48transfers, meaning large arrays of data
- 8:52are sent. Usually, this is overlooked
- 8:57when, for example, performance or speed
- 9:00is not a priority. But again, look at
- 9:04what can happen. In principle,
- 9:07suboptimal code will be written,
- 9:09because why, for instance, request and
- 9:12transfer all information if we could do
- 9:15it partially? What does this lead to?
- 9:21Again, this happens when there is no
- 9:24experience working with large volumes
- 9:27of data. Because if you have, for
- 9:31example, a database with 50 or 100
- 9:34users, that's one level of performance
- 9:36and reaction time, right? If you have,
- 9:41say, 1,000, 2,000, 5,000, or 10,000
- 9:43users in the database, then every
- 9:46suboptimal execution, every piece of
- 9:49inefficient code, leads to some loss of
- 9:52performance. With a large volume of
- 9:55data and a large number of users
- 9:57connected to the database, this becomes
- 10:00very apparent. So, you shouldn't forget
- 10:03about this and should take it seriously
- 10:06, because it's one thing if 10 people
- 10:08work in your database, and another if
- 10:10there are 10,000. Accordingly, the
- 10:14volume of data you process will be
- 10:16different. Either it will be 500,000
- 10:19documents, or it will be 100,000
- 10:22documents in a short interval of time.
- 10:27Therefore, you should not forget about
- 10:30this and, if possible, analyze which
- 10:32directive needs to be used. What else
- 10:36can be said? If you haven't specified
- 10:39any directive, it is considered to be
- 10:42executed "at server" by default. But
- 10:46it's better, of course, for clean code,
- 10:48or even just for visual clarity, to
- 10:51specify the compilation directive. When
- 10:54it's not specified, it doesn't look
- 10:57very good. You can immediately tell it
- 11:00was written carelessly. Yeah. Because
- 11:05it's one thing when we are writing test
- 11:07examples together, right? But it's
- 11:11another thing when you are writing code
- 11:14for a production database. So, even if
- 11:18you’re working alone, you still need
- 11:20to write in a way that, if someone else
- 11:22works with the code after you,
- 11:24everything will be fine. At least so it
- 11:28stays within some kind of framework. So
- 11:32, in short, we’ve covered the
- 11:35preprocessor, preprocessor instructions
- 11:39, and compilation directives today,
- 11:43knowing that they exist, how they work,
- 11:47what they're called, and where they're
- 11:51used. And, of course, we’ll dive
- 11:54deeper into this topic later because
- 11:57it’s used everywhere in code. We’ll
- 12:02go over and look at some other aspects
- 12:05with you. Well, that’s all I have
- 12:08regarding these topics for now. We’ll
- 12:11move on to a different topic in the
- 12:13next video. So, thanks to everyone for
- 12:16watching. Subscribe, leave comments,
- 12:19and hit the like button. See you later,
- 12:21everyone.
About this transcript
This page contains the full transcript of #31 1с с нуля. Препроцессор и его инструкции. Директивы компиляции. Часть №2 |#1С| #программирование by itCODE, generated from the public captions YouTube serves with the video. The transcript has 1,379 words across 223 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.