YouTube2Text

#31 1с с нуля. Препроцессор и его инструкции. Директивы компиляции. Часть №2 |#1С| #программирование — Transcript

by itCODE · 1,379 words · 223 segments · language en · Watch on YouTube

Full transcript

  1. 0:16So, let's, before we examine the
  2. 0:18compilation directives, which I've
  3. 0:20already opened in the Syntax Assistant,
  4. 0:23briefly recall how the code execution
  5. 0:25process works. That is, there are
  6. 0:29several stages involved. The first is
  7. 0:31preprocessor processing. The second is
  8. 0:35compilation into 1C internal bytecode.
  9. 0:39And the third is interpretation. What
  10. 0:42does that mean? The execution of
  11. 0:44bytecode within the 1C environment. At
  12. 0:49the same time, we must consider that
  13. 0:51the same module can be compiled both on
  14. 0:54the client and on the server. With the
  15. 0:59help of preprocessor instructions, we
  16. 1:01can specify whether our specific code
  17. 1:07or a part of it should be executed here
  18. 1:10or there. So, we make the choice using
  19. 1:14instructions. That's it. Now let's move
  20. 1:18on to compilation directives. Again, I
  21. 1:23have opened the compilation directives
  22. 1:25using the search in the Syntax
  23. 1:27Assistant. But it is important to note
  24. 1:31that, for example, in versions of the
  25. 1:341C platform 8.0, 8.1, programmers
  26. 1:38basically didn't think about separation
  27. 1:41into directives, because they simply
  28. 1:43didn't exist. That is, the same
  29. 1:46functionality was available both on the
  30. 1:49server and on the client. So we didn't
  31. 1:52have that concept at all. We didn't
  32. 1:54even have a separation; there was no
  33. 1:58need to somehow separate or analyze
  34. 2:01this. Starting from platform 8.2, the
  35. 2:05concept of a managed application
  36. 2:07appeared. And why did such a need arise
  37. 2:11at all? That is, what influenced it,
  38. 2:16its emergence. What happened? We saw
  39. 2:20the appearance of the thin client and
  40. 2:23the web client. And, accordingly, the
  41. 2:26thin client and web client can work
  42. 2:29over the Internet. Naturally, this
  43. 2:33imposes restrictions on data
  44. 2:35transmission. In this regard, this
  45. 2:37separation between client and server
  46. 2:39appeared. Now let's talk about what a
  47. 2:43compilation directive is. Look, every
  48. 2:47procedure and function of a module, say
  49. 2:49a command module or common module—you
  50. 2:51can even read the description—is
  51. 2:57accompanied by such a symbol, and what
  52. 2:59directives are available to us?
  53. 3:02AtClient, AtServer, AtServerNoContext,
  54. 3:06AtClientAtServer (shared), and
  55. 3:09AtClientAtServerNoContext. Well,
  56. 3:14naturally, we have seen these
  57. 3:15directives more than once; they are
  58. 3:17present in the text. I even opened the
  59. 3:20implementation, the form, the document
  60. 3:23form, "Goods". Accordingly, they are
  61. 3:26present here in huge numbers. All our
  62. 3:29procedures are equipped with these
  63. 3:31directives. So it is clear from them
  64. 3:33where the execution takes place. Let's
  65. 3:37briefly go through each of them. It
  66. 3:40will also be quite brief, because we
  67. 3:42will analyze them in more detail later.
  68. 3:45Well, judging by the name AtClient,
  69. 3:48AtClient means that our code will be
  70. 3:51executed in the context of the client
  71. 3:54application. What will be available
  72. 3:56here? Only elements, parameters, and
  73. 3:58form attributes will be available here.
  74. 4:02Briefly regarding the "at client" and "
  75. 4:05at server" directives, it's clear from
  76. 4:09the names that for our procedures and
  77. 4:14functions, not only form data—which
  78. 4:16we discussed for the client—will be
  79. 4:18available, but also the ability to
  80. 4:20access database data. That is, the code
  81. 4:24execution will take place on the server
  82. 4:27. Calling client-side procedures is no
  83. 4:31longer available here. How does that
  84. 4:34happen? When on the server, you cannot
  85. 4:37initiate calls to client-side
  86. 4:39procedures and functions. Well, there
  87. 4:42is an exception within the
  88. 4:44collaboration system, but I think we
  89. 4:47will look at it later, perhaps towards
  90. 4:50the very end, because the collaboration
  91. 4:53system is a mechanism that, for example
  92. 4:55, isn't that widely used. It is used,
  93. 4:59but it's a specific mechanism, so we
  94. 5:02aren't talking about it for now. This
  95. 5:06is what happens when we use the "at
  96. 5:10server" directive. When calling a
  97. 5:14procedure or function under this
  98. 5:18directive from a form, the client wraps
  99. 5:22the form context and sends it to the
  100. 5:26server. Then this entire package is
  101. 5:31returned back. So, in this way,
  102. 5:35interaction happens several times.
  103. 5:40Naturally, this is resource-intensive,
  104. 5:43because, look, we have directives like
  105. 5:47"at server without context." What do
  106. 5:51they mean? "At server without context"
  107. 5:55means our code will execute on the
  108. 5:58server, but there will be no access to
  109. 6:00the form context, attributes,
  110. 6:02parameters, or elements. Only
  111. 6:05non-contextual procedures and functions
  112. 6:07are available. So, with this call from
  113. 6:13the client side, only the data
  114. 6:15specified as our parameters is
  115. 6:20transferred to the server side. What is
  116. 6:26sent back is only the information we
  117. 6:29needed, already in a prepared format.
  118. 6:33This means that data transmission is
  119. 6:37significantly reduced, because instead
  120. 6:42of potentially passing all the data
  121. 6:46back and forth to the server, here it
  122. 6:51is limited. Yeah. Next, we have the "at
  123. 6:57client at server without context"
  124. 7:00directive. It is encountered rarely.
  125. 7:06Why is it needed? It is needed if you
  126. 7:08require the execution of a directive.
  127. 7:10Well, if a procedure or function needs
  128. 7:13to run on the server or client, but
  129. 7:17again, on the condition that it is
  130. 7:20without context. Next, we have "at
  131. 7:23client at server." Essentially, it is
  132. 7:27an analog of "at client at server
  133. 7:29without context," but it is only
  134. 7:31available in a command module. That is
  135. 7:35what can be said about these directives
  136. 7:38, very briefly. As we write code, we
  137. 7:42will be looking at all of this, because
  138. 7:45fitting everything into one video won't
  139. 7:48work. So, what else is possible, what
  140. 7:51limitations are there regarding these
  141. 7:55directives and recommendations? For
  142. 7:58example, look at compilation directives
  143. 8:01like "at client", "at server", "at
  144. 8:03server without context"; where should
  145. 8:06they be used? They should only be used
  146. 8:09in managed form module code and command
  147. 8:12module code. In other modules, 1C
  148. 8:16generally recommends using preprocessor
  149. 8:19instructions. Again, we will cover
  150. 8:22these points as we go and look at why
  151. 8:26this is advised in principle. So. What
  152. 8:33else can be noted is that when we
  153. 8:36execute code, we shouldn't mindlessly
  154. 8:40use the "at server" directive, because
  155. 8:44it causes heavy traffic and large data
  156. 8:48transfers, meaning large arrays of data
  157. 8:52are sent. Usually, this is overlooked
  158. 8:57when, for example, performance or speed
  159. 9:00is not a priority. But again, look at
  160. 9:04what can happen. In principle,
  161. 9:07suboptimal code will be written,
  162. 9:09because why, for instance, request and
  163. 9:12transfer all information if we could do
  164. 9:15it partially? What does this lead to?
  165. 9:21Again, this happens when there is no
  166. 9:24experience working with large volumes
  167. 9:27of data. Because if you have, for
  168. 9:31example, a database with 50 or 100
  169. 9:34users, that's one level of performance
  170. 9:36and reaction time, right? If you have,
  171. 9:41say, 1,000, 2,000, 5,000, or 10,000
  172. 9:43users in the database, then every
  173. 9:46suboptimal execution, every piece of
  174. 9:49inefficient code, leads to some loss of
  175. 9:52performance. With a large volume of
  176. 9:55data and a large number of users
  177. 9:57connected to the database, this becomes
  178. 10:00very apparent. So, you shouldn't forget
  179. 10:03about this and should take it seriously
  180. 10:06, because it's one thing if 10 people
  181. 10:08work in your database, and another if
  182. 10:10there are 10,000. Accordingly, the
  183. 10:14volume of data you process will be
  184. 10:16different. Either it will be 500,000
  185. 10:19documents, or it will be 100,000
  186. 10:22documents in a short interval of time.
  187. 10:27Therefore, you should not forget about
  188. 10:30this and, if possible, analyze which
  189. 10:32directive needs to be used. What else
  190. 10:36can be said? If you haven't specified
  191. 10:39any directive, it is considered to be
  192. 10:42executed "at server" by default. But
  193. 10:46it's better, of course, for clean code,
  194. 10:48or even just for visual clarity, to
  195. 10:51specify the compilation directive. When
  196. 10:54it's not specified, it doesn't look
  197. 10:57very good. You can immediately tell it
  198. 11:00was written carelessly. Yeah. Because
  199. 11:05it's one thing when we are writing test
  200. 11:07examples together, right? But it's
  201. 11:11another thing when you are writing code
  202. 11:14for a production database. So, even if
  203. 11:18you’re working alone, you still need
  204. 11:20to write in a way that, if someone else
  205. 11:22works with the code after you,
  206. 11:24everything will be fine. At least so it
  207. 11:28stays within some kind of framework. So
  208. 11:32, in short, we’ve covered the
  209. 11:35preprocessor, preprocessor instructions
  210. 11:39, and compilation directives today,
  211. 11:43knowing that they exist, how they work,
  212. 11:47what they're called, and where they're
  213. 11:51used. And, of course, we’ll dive
  214. 11:54deeper into this topic later because
  215. 11:57it’s used everywhere in code. We’ll
  216. 12:02go over and look at some other aspects
  217. 12:05with you. Well, that’s all I have
  218. 12:08regarding these topics for now. We’ll
  219. 12:11move on to a different topic in the
  220. 12:13next video. So, thanks to everyone for
  221. 12:16watching. Subscribe, leave comments,
  222. 12:19and hit the like button. See you later,
  223. 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.