2

How to name a style of programming, which brings the results for given moment, but the code is written quickly, without any readability, considerations, recommended practices, without thinking of others maintaining it and where it is possible that also the author won't be able to maintain it as soon as the author forgets the details?

So if it can be said that the only positive thing on produced code was that it quickly delivered immediate result, nothing else. Everyone who will look or touch the code will require more than usual energy to understand what is it doingand easier that extending it may be to re-write everything from scratch.

In my non-English language, something as "to pig the code" can be used, like if the code was created by a pig, by its very own methods.

  • Spaghetti Code is the industry-wide standard term we all use. I've never heard bad code referred to as anything else. – Josh Campbell Aug 9 '18 at 15:59
  • 3
    I would call it throw-away code. It was written knowing that it wouldn’t be maintained past meeting the deadline, so we throw it away and start over. – ColleenV Aug 9 '18 at 16:02
  • 3
    I always used to include the word kludge in a comment associated with any such "quick and dirty" code. And very occasionally if I had a bit of free time I might do a global search for that term (and even more rarely, actually risk trying to "improve" it). But certainly if I found the word anywhere around code I was being asked to bugfix or otherwise enhance, I'd automatically think in terms of doubling my estimate for the new work. Same as any request to re-use anything I'd explicitly designated as "throwaway" code, per @Colleen's point. – FumbleFingers Aug 9 '18 at 16:05
  • 2
    @JoshCampbell- Spaghetti Code derives its name from the use of gotos such that when trying to trace the thread of execution through the code the trail gets all tangled up like a long strand of spaghetti. "Spaghetti Code" could easily be written carefully and with good documentation. Lots of kludged code or throw-away code might end up being spaghetti code as well but they aren't one and the same. – Jim Aug 9 '18 at 19:11
  • 1
    "Kludge" (with several spellings) and "hack" are probably the most common. The kludge is generally larger and messier than the hack, but is likely to fulfill a more complex set of requirements -- "quick" often precedes "hack" to suggest that the code was thrown together in a hurry. "Kludge", on the other hand suggests something that "grew" with repeated modifications, as more requirements were discovered and added. – Hot Licks Aug 9 '18 at 23:30
4

Being a programmer myself. I can say, Kludge and Spaghetti Code are most common terms.

Kludge 1 (also cludge, variant: kluge):

a haphazard or makeshift solution to a problem and especially to a computer or programming problem

"I've kludge around it for now, but I'll fix it up properly later."

Spaghetti Code 2:

Spaghetti Code appears as a program or system that contains very little software structure. Coding and progressive extensions compromise the software structure to such an extent that the structure lacks clarity.

A wonderful excerpt from the from Brown’s book:

“Ugh! What a mess!” “You do realize that the language supports more than one function, right?” “It’s easier to rewrite this code than to attempt to modify it.” “Software engineers don’t write spaghetti code.” “The quality of your software structure is an investment for future modification and extension.”

4

The verb I hear a lot is "hacked together". Another good term is what one makes when they hack together a program: "spaghetti code"

Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted.

  • +1 for spaghetti code. You put the first piece down without any consideration for what comes next, then add another layer, then realize the first layer needs to connect to a third layer, etc., and suddenly you have an architecture that doesn't make any sense, is hard to look at, is hard to debug, etc. – Chuck Aug 9 '18 at 15:58
  • @Zaya we could go further and all the code product a hack. – JoshG Aug 9 '18 at 16:36
  • I understand that from non-programmer's perspective these suggestions look appealing, but each of them already has its specific meaning within the industry, somewhat different from what I described in the question. Very briefly: "hack" is to put a "hook" into well-thought place in existing structure to get a benefit from that non-typical and unexpected addition; and "spaghetti code" means only one particular anti-pattern: tangled code flow – so the term is not wide enough to cover other bad practices. – miroxlav Aug 10 '18 at 15:11
2

A general term for anything that is made in the way you are describing is "slapdash".

slapdash (MW learner's dictionary)

quick and careless

So you can say of software:

This code is slapdash.

The contractor put it together overnight, so it's really slapdash.

Cutting-and-pasting from StackOverflow is a slapdash way to write software.

And you could use it in other cases, like:

They fixed the window, but it's really slapdash. I'm sure it'll start leaking again in a few months.

  • I don't think I've ever heard "slapdash" applied to software. – Hot Licks Aug 10 '18 at 12:03
2

Your title and the first part of your question ask for the name of a particular coding style (that is, a request for a noun), but your example at the end suggests a verb. This answer addresses the former.

I’ve come across the term write-only code, which matches the description in your question.

In computer humor, a write-only language is a pejorative term for a programming language alleged to have syntax or semantics sufficiently dense and bizarre that any routine of significant size is too difficult to understand by other programmers and cannot be safely edited. Similarly, write-only code is source code so arcane, complex, or ill-structured that it cannot be reliably modified or even comprehended by anyone with the possible exception of the author. Write-only code is also referred to as line noise, suggesting that the code looks like spurious characters from signal noise in the communication line. In such a language it would be more difficult to read, understand, and modify existing source code than to start over and rewrite it from scratch. - wikipedia; emphasis, mine

In the wider computing context, this carries shades of allusion to write-once media such as CDs, and contrasts with the more typical media that can be both written to and read from.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.