Inferno #07
31 мая 2005

For Coderz - the discipline to create large projects.

<b>For Coderz</b> - the discipline to create large projects.
                    1.


        Programmed "on a grand scale"



            ... An indispensable attribute of the

            creation programs. The first "r"

            the last "y". Eight letters.

            - Hemorrhoids ...

           - Um ... coming! ..



           From the conversation of two programmers.


   Theme in the headline of this
article (title, not the motto!), at first
At first glance, not very clear and understandable. "What
mean on a grand scale? We detail more than once
menivaemsya! Do we have any project a masterpiece!
Diskette with source code will soon pickle! "
Well, later in the same spirit. It's about pain
large (literally) projects and masterpieces
koderskoy thoughts today will talk.

   How not to drown in a large source, as
not to lose the fruit of many months of labor
the fault of some kind can not read floppy disk as
to make their source code at least a little more
more understandable by other people - all
This will be discussed in this article. Set
Gia things may seem obvious and
elementary. But all else does not know
lzya, and experience comes with time. Therefore,
sincerely hope that everyone can gain for
yourself that something new and useful. Thus,
begin.


   How to start a process of learning ac
Sembler? First, from the books after a long
pant recruited some healthier
LIMITED source (its size is inversely proportional
tional to laziness and directly proportional to the desired
learn how to program). then do (for
frequent unsuccessful) attempts to understand
how did it work. Dismantled
just barely in the same procedure from
yuschy programmer then attending one of two
ways. First: "Oh it nafig. It is difficult
strongly. Not for me. "And the second:" Damn PAL
ki! Yes, there is nothing to do, I am better than I can
write, and even better! "Mentally simpler
emsya with the followers of the first path and
Again, mentally Slaughterhouse representatives
Lei second. And then what? And then our
hypothetical programmer begins to torment
this unfortunate process, it will gradually
navorachivaya, improving cutting. Finally,
it bothers him, and the procedure finds
solace in one of many diskettes and
then and now bumage.Postepenno such procedure
Dur accumulated quite a lot, and finally
Finally, accumulating a critical mass, after
which sets a moral commitment to
write real big project. Poyavivshe
seanmcsean was the desire to write everything from scratch ku
Yes, it evaporates quickly, and there is another
desire - to take their old procedures, which
some "not so bad." Remarkably,
programmer takes collects procedures
a pile of source code in one source, runs
compilation, and ... gets a bunch of messages
Type:

Label METKA is already used.


   Well, no one there thought that all these
Procedures will ever work
together, so do not take care of the UNIQA
lnosti metok.Nachinaem make "unique"
work - to correct tags so that they
differed in different procedures (as our
programmer did try and bend the fingers
on the keyboard, and happy users
Alasm make a feint with their ears, they write something like:

 Procedure1:

        LOCAL
 metka: ...

         ...

        ENDL

 Procedure2:

        LOCAL
metka: ...
 @ MyGlobalMetka:

         ...

        ENDL


   And calmly spit at the ceiling).


   Hooray! Program built into a single source,
all necessary procedures are collected, there is the backbone of
program, all even up and running. Here begins
is most interesting: a program fairly
swells, stop to get into one file
source code, and once again have to "sawing"
on a part (of course, this applies only to
those assemblers that support that
kuyu possibility). Here you can also go
in two ways - split into pieces on the principle
CESG "how much you want and in order to reserve and
separation by function -
file operations, device operations
input, graphics, and operation t.d.Ochevidno,
that the latter option is preferable as
in terms of writing, and in terms of accom
Denia code.


   In the process of program development time for
Thus the text is amended, the part of
which are quite risky (there were "good
Shaw, trying to do "even better", despite the
the rule of "best is the enemy of the good").

   I would like to be able to return
to the old version of the text, if something goes
not so. This brings us to the problem of storage
source and version control. For individual
GOVERNMENTAL texts can provide conservation
backups (usually 1-2 is quite
enough) with several distinctive
characters in file names that immediately determined
We define a more global pervoistochnik.Na
level, you can archive all
project source files. For storage ar
hivov take one or two discs on the project and
use the date as the file names.
You can also put in the text archive
file with a brief description of the project, changes
with respect to the previous version and t.d.Dlya emu
lyatorschikov submitted additional
Convenience - You can not fooling, and ap
hivirovat all floppy disk images without risking
forget to put in the archives of this or that nuzh
LIMITED fayl.Takzhe highly recommend regularly
distribute their files through the familiar and
sites (opensourcezx.narod.ru precisely
these goals and created) so that if something
not remain on the beans. The fact that after
loss of the latest version can stay with
old, which is not implemented many ve
ing, should not be problemoy.Kak govo
rit my teacher (and I'm with him completely CO
lasen), a good program is written twice, and
then thrice.


   If you plan to distribute the prog
Rummy open-source operating system or development
tanovilas, but planned to return to her
later, it is necessary to ensure the comfort of
reading the code, especially other people (although
I personally can not bear to understand chu
zhih source code and programs, its easier
write). On this subject, we can propose
 a few comments.

  1) Each source files prepend "hat" with a brief description 
of the file may list of features and history of changes 
(especially particularly important when the collective razrabot

 ke), other data (date, author).

  2) Use a possible single
style of the source - from a
dividing the operands by spaces or tabs
s (for example, my source code, typed on
Reale, separated by tabs, while
later by an emulator,
separated by a space, because until Break'a
 difficult to reach%)).

  3) Use visual feedback-just
dividers, for example:
;------- Similar in function block
;======= Less close
;******* Headline, description, etc.
 , \ \ And so on%)

  4) You can make the description of the functions -
what he does, what input parameters, which
weekend, which registers and memory spoils,
Other observations.

   On the question of registration marks. So word
life was that Spectrum caught on Unix-ovs
cue style tags - one register
and the words are separated by an underscore
(Людипомогитенеработаетпробелчтоделать? -
настоящие_кодеры_пробелом_не_пользуются!).
For those assemblers, which by default
use lower case letters, you can ISPO
lzovat write labels using
large letters. Here too there are two styles -
Pascal (every word in the phrase pi
be written together with a capital letter, a so-called "Two
humps of a camel ": OpenFile) and Java (all
word except the first, written together, and
with a capital "dromedary":
openFile). Also very convenient way
sometimes serves as a use of the "Hungarian
record. "It only applies to the transition
variables, in the beginning of the name which is added
small prefix that identifies the type of transition
variable: b - byte, w - word, sz - string,
p - pointer etc. Glancing once called on
tion variable, we can easily
to determine (predict?) its type.

   If the file consists of some restrictions
chennogo set of procedures, internal tags
in these procedures can be formed as
abbreviated procedure + ordinal
vy number, for example:

PRINTLINE

        ...
PL0 ...

        ...
 PL1 ...

        RET


   Thus, the less likely
come up with its lush fantasy label
which is already engaged.


   Here, perhaps, and everything that I wanted
tell you today, what would hearth
showering. If anyone has their own methods "on
legcheniya "difficult process of programming
tion, please report to any of the available photon
rme.

Vitamin


                    2.


       Discipline of Programming.


   It would be desirable, and with his hand to Nesco
lko time-tested advice.

   Convince yourself that any creativity
potrebleniya.Eto important will be the key to on
standing of the logic above and nizheskazannogo.Vse,
that you create, you, whoever you are not solid
Dil opposite. Responsibility for the statement
secondary, but it exists. It should be her only
feel - and with respect to the outright
careless, and to the program, which threatens long
tit men.

   Any program can be uluchshit.Boytes
temptation to "latest". Do not stop
project is just out of principle, and even more so -
do not wash the sources. Will better your
correction in a month than the correction
carelessly made a year later by a hacker.

   Protect the source code and always duplicate
them. Just think of the accompanying fi
Lamas. Do not trust the "hard drive". Box
Floppies lasts longer and does not
wont spoil a whole and without a chance
to recover. Even better copy
source friends. Do not be afraid that someone
release your program under a different name:)

   Keep the old version of the source - is
helps to correct bugs in the program.

   Optimization should be independent
In fact, do not blindly follow any method.
Most of these methods are not universally
and folds in half of cases to other
methods. (I will describe several methods in
another article.)

   Program of large size is optimal
mize size. Sometimes reduction
of the size of the program can greatly persuaded
tit its structure by releasing some
memory area.

   Program, speed or time to
Torah can be measured in seconds or ger
samples, it makes sense to accelerate. Typically, this
gradual process and the end he could not see that
Whatever claimed about ten percent of leads
rzhentsy high-level languages ​​(HLL).

   (Contrary to the above:)

   Program that would be good to release
in a certain period of time is time to release this
period. This often can be sacrificed
optimization and certainly - a pair of propane
generalized telefilms. It is advisable to leave behind
right after completion.

   If you can not do, except separated
lnyh procedures, and the bad, and you are
can not bring to build a single ass
manna major program, do not despair -
just write, write, write to the victorious
end! Programs not grow on trees, and
programmers from the sky did not fall - if not
lazy, then all will turn out, and, of course,
each time easier!

   You can program more effective,
what you're programming. You think
it is impossible?

A. Coder




Other articles:

Classics - Almanashnik. Alexander Pushkin.

For Coderz - Recognition and computation of arithmetic expressions on their character record.

Inferno - The authors of the magazine.

For Coderz - the discipline to create large projects.

Interview - Questions Konstantin Sviridov (Conan) on the site zxnext.narod.ru.

Likbez - The principles of converting graphics PC-ZX.

For Coderz - Programming disc changer / drive in Scorpio.

Softinka - DNA_OS v0.431 - package of utilities for working with hard drives, RAM-drives and floppy disks.

For Coderz - Programming under DNA_OS ZET-9, a package of tools to work with storage devices.

Softinka - The problems and shortcomings package of tools to work with storage devices DNA_OS.

Likbez - details about disk formats that are FAT.

Inferno - Entered from the editor.

Inferno - Errors in the previous numbers.

For Coderz - Small programmers' tricks.

Gameland - On the new games: Oneyroid, Dizzy forever, Dridlock.

For Coderz - Writing archive. Practical principles LZ packaging.

Gameland - Passage of new shipments for the game "Black Crow".

For Coderz - Programming for the video mode 384x304.

Inferno - Letters to the Editor.

Sound - Eden Megus'a about the tracker for the AY / YM.

Inferno - On the shell.

For Coderz - Fundamentals of optimization for the processor Z80.

Likbez - The location of partitions on your hard drive.

Gamedev - 3D projection of the floor / road in the games.

Sound - Wild ideas for AY trackers.

Advertising - Ads by Roman Chuunin.

Advertising - Ads by V. Bogdanovich

For Coderz - How a large Flexible Program.

Repair - Faults Pentagon 128 + and their repair.

Inferno - Content.

Miscellaneous - Thoughts on the contest for the best software.

Others - Transfer software on ZX Spectrum with a PC.

Video - On packaging for a video ZX Spectrum.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Raisin - The program of telecasts.
News - News from the Rostov Group Energy Group.
Unbel! Ever - an interview with Unbel! Ever / Extreme (MMA) on the Spectrum and the demoscene.
News - Alone Coder'a impression on CC'2004.
Miscellaneous - Trouble with AY (wrong clock frequency).

В этот день...   21 November