I'm starting on programming, I have some difficulty reading even my codes after a while.
I was one of the researched readability and came across the term "gambiarra". this has raised me a question.
What exactly defines a gambiarra and how to avoid creating one?
Codes like the one I was writing in and I ended up losing can be considered gambiarras?
class Skeleton:
def __init__(self, names_list, delimiters=",. /*"):
self.deimiters = [char for char in delimiters]
self.__items = {}
for name in names_list:
replaced_name = name
for delimiter_char in self.deimiters:
replaced_name = replaced_name.replace(delimiter_char, " ")
tokens = replaced_name.split()
for i in range(len(tokens)):
key = " ".join(tokens[:i + 1])
if key in self.__items:
item = self.__items[key]
if name not in item["shapes"]:
item["shapes"].append(name)
else:
self.__items[key] = {}
item = self.__items[key]
item["shapes"] = []
item["shapes"].append(name)