DEV Community

Discussion on: Write Code That Writes Code

Collapse
 
val_baca profile image
Valentin Baca • Edited

Compilers, transpilers, macros, metaprogramming are all powerful and can be incredibly useful. I've seen thousands of lines of code reduced to hundreds or even just dozens of lines of code. However, they shouldn't be what one goes to first and can severely impact clarity if not used judiciously. I wouldn't go so far as to say to "always" write programs that write code. Avoid overengineering. Sometimes you do just need the one-off script or program.

Nit pick: "code" is already plural, so the "s" in "codes" is redundant. "Write Code That Writes Code" (Edit: this isn't 100% correct either. See replies)

Collapse
 
mak12776 profile image
Mohammad Amin Khakzadan

In new programming languages we always have a level of abstraction, we have written programming languages to pave the way for us. And that means some works automated by computers.
For example, in the past that we have no programming language except assembly language, for comparing strings, programmers have to write 5 or 6 lines of code, but now we can compare two strings in python or ruby just by putting some equal signs between them. And that is automating the process of writing codes.
We can have more advanced programming languages, or other approaches that short the way of writing programs. But they not invented, and they are not exist.

Thanks for mentioning mistake.
I do not have enough knowledge of English language, but I can understand programming languages very well. 😃

Collapse
 
jdknox profile image
Jeff

Just to nitpick the nitpick: "code" is technically uncountable, like "water." It can be both plural and singular. 😁

"Codes" can also be used properly, e.g., "She has two codes to crack," or "I have two different machine codes to deal with." So the distinction isn't merely pedantic. 😎

Collapse
 
val_baca profile image
Valentin Baca

You are correct. In referring to computer instructions, "code" is uncountable, not plural.

For others: english.stackexchange.com/question...