The Twelve-Factor App sagt:Was ist ein "deklaratives Format"?
Verwenden deklarative Formate für das Setup Automatisierung, Zeit und Kosten für neue Entwickler zu minimieren das Projekt verbindet
Was bedeutet „deklarative Formate“ bedeuten?
The Twelve-Factor App sagt:Was ist ein "deklaratives Format"?
Verwenden deklarative Formate für das Setup Automatisierung, Zeit und Kosten für neue Entwickler zu minimieren das Projekt verbindet
Was bedeutet „deklarative Formate“ bedeuten?
Ein deklaratives Format ist ein Format, in dem Sie die Absicht/das Endergebnis des Programms deklarieren, anstatt wie es erwartet werden soll. Im Wesentlichen ist es die Unterscheidung zwischen einer Konfigurationsdatei und einem Stück Code. Vergleichen:
CC=gcc
CFLAGS=-I.
DEPS = hellomake.h
%.o: %.c $(DEPS)
$(CC) -c -o [email protected] $< $(CFLAGS)
hellomake: hellomake.o hellofunc.o
gcc -o hellomake hellomake.o hellofunc.o -I.
gegen so etwas wie (Python-Pseudo-Code):
CC = "gcc"
CFLAGS = "-I."
DEPS = ["hellomake.h"]
def make_o_file(o_file, deps):
#don't recompile if it exists & is current
c_file = "%s.c" % os.path.splitext(o_file)[0]
if (os.path.exists(o_file)
and is_newer(o_file, c_file)
and all(is_newer(o_file, dep) for dep in deps)):
return
#else actually compile it
compile_c_file(CC, code_file, o_file, CFLAGS)
if target == "hellomake":
make_o_file("hellomake.o", DEPS)
make_o_file("hellofunc.o", DEPS)
link_o_files("hellomake", ["hellomake.o", "hellofunc.o"])
Erstere können viel einfacher für die Menschen, wenn das Format zu verarbeiten ist gut gestaltet. Die Wikipedia auf declarative programming könnte nützlich sein.
Ein paar tausend Dollar für die Autoren. –