How to Write Unmaintainable Code – Naming
11–20 of 43 posts
Re: How to Write Unmaintainable Code – Naming
#12When you need to prevent quick grepping in Java, you can also take advantage of the fact that unicode escapes can occur everywhere in a java file, not only within quotes. So you can declare an int by writing “\u0069\u006e\u0074 \u0069 = 1;” (equivalent to “int i = 1;”)
Re: How to Write Unmaintainable Code – Naming
#13Either with or without the underscore: Characters are for free, why don't you turn your variable name into a short story?
Re: How to Write Unmaintainable Code – Naming
#14"If anyone even hints at breaking the tradition honoured since FØRTRAN of using i, j and k for indexing variables, namely replacing them with ii, jj and kk, warn them about what the Spanish Inquisition did to heretics." Hold on, should we use i instead of ii, or not use it? I fucking hate these double-negative articles.
The article is saying not to mess with the "religious" tradition of i/j/k, which means that the author actually things that ii/jj/kk are better. I don't think it's hard to follow, really, unless maybe if English isn't your first language.
Actually later on in rule 20 he implies (with negative logic of course) that i is actually a good inner loop variable name. So that's an inconsistency right there.
Re: How to Write Unmaintainable Code – Naming
#15OP forgot an important tool: store as many variable as possible in one long array. When ever possible use predefined constants like "one," "first," and "superVar" to refer to the index of the desired value in the Array, make sure that all of the above mentioned constants have the same value and are defined in different parts of the code.
Re: How to Write Unmaintainable Code – Naming
#16OP forgot an important tool: store as many variable as possible in one long array. When ever possible use predefined constants like "one," "first," and "superVar" to refer to the index of the desired value in the Array, make sure that all of the above mentioned constants have the same value and are defined in different parts of the code.
Python: put everything in a list, then insert it into itself on multiple positions. Then go nuts using slice syntax. Occasionally use hex or octal numbers.
Re: How to Write Unmaintainable Code – Naming
#17We ended up scrapping that code and doing a ground-up rewrite.
Re: How to Write Unmaintainable Code – Naming
#18Re: How to Write Unmaintainable Code – Naming
#19Earlier quoted context omitted.
The article is saying not to mess with the "religious" tradition of i/j/k, which means that the author actually things that ii/jj/kk are better. I don't think it's hard to follow, really, unless maybe if English isn't your first language.
This is a weird one. Using i,j,k for loop values is fine, especially tight inner loops. I can't see that ii,jj,kk adds anything. And I don't see much point in using verbose names like innerLoopIterator or arrayIdx or whatnot for these type of variables either. Actually later on in rule 20 he implies (with negative logic of course) that i is actually a good inner loop variable name. So that's an inconsistency right th…
index, jndex, and kndex, are preferred, obviously.
Re: How to Write Unmaintainable Code – Naming
#20When you need to prevent quick grepping in Java, you can also take advantage of the fact that unicode escapes can occur everywhere in a java file, not only within quotes. So you can declare an int by writing “\u0069\u006e\u0074 \u0069 = 1;” (equivalent to “int i = 1;”)
On the other hand, if grep has a 95% success rate, the adversary may well never notice, and build his or her mental model of the program on flawed understanding. That's when the real fun begins.