• bvs23bkv33 (unregistered)

    yeah, and s41 became customer_name1 because only s4 is replaced

  • LCrawford (unregistered) in reply to bvs23bkv33

    But then he'd have seen something like customer_name1 - zip_code instead of the actual "account_balance = account_balance - zip_code" from the article.

  • Little Bobby Tables (unregistered)

    Hmm. Given this situation, I would start by extracting whatever utility routines somewhere "safe", and de-globalising the globals, and ...

    ... but no, because you can never guarantee that the global in such a supposed encapsulation is not used anywhere else subsequently. Oh good grief ...

  • nate (unregistered)

    Reminds me of my own Turbo Pascal code from the early 90's. Each program began with something like

    var i,j,k:integer; w:word; b:byte; c:char, s,q:string; p:pointer;

    (For the record, I'm no longer doing that today :)

  • El Dorko (unregistered)

    I'm (K17 + J8)% sure I've worked in that company. Jeez, there was a "rule" of naming all method scope variables "I", "ii", "iii", "iiii", "iiiii" and so on. Nested loops, holy shite that was fun. Not.

  • El Dorko (unregistered)

    I'm (K17 + J8)% sure I've worked in that company. Jeez, there was a "rule" of naming all method scope variables "I", "ii", "iii", "iiii", "iiiii" and so on. Nested loops, holy shite that was fun. Not.

  • (nodebb)

    People gave me all kinds of crap for proposing we start adding GUIDs, while these people are subtracting zip codes from account balances!

  • (nodebb)

    Now i know why people say Californians pay more tax. Their 99999 zip codes are subtracted from their account balances which gives us new englanders a huge advantage with our 01800 zip codes.

  • TheDaveG (unregistered)

    It was at this point that Jay began his job search.

    FTFY

    P.S. Some of the devs I work with still think s for string variables and i for integers is perfectly okay.

  • (nodebb)

    The only time i is acceptable for a variable is if it's in a simple for loop. I have seen the occasional use of like s for a string that's something like only the concatenation of two strings and immediately gets written out or otherwise used, but even that's rare.

  • Obfuscator (unregistered)

    Unfortunately we don't get to know which programming language the boss used. In case it was C, maybe he should submit those code snippets to the IOCCC?

  • Leonid Cooper Noll (unregistered)

    Sounds like a perfect candidate for the IOCCC: https://ioccc.org/

  • Zach (unregistered)

    This sounds less like obfuscation and more like optimization. These are exactly the sort of things a compiler will do for you. Is it possible that the boss lost the source code and, rather than admitting it, shamefully ran it through a decompiler that uses these variable name conventions? :-P

  • Zach (unregistered)

    How bad does it have to be for someone to say "Fuck this" and just walk away or quit?

  • Quirkafleeg (unregistered)

    I'd love to meet a "cow orker" (hyphen removed)!

  • Thomas Brodersen (google)

    Ah, treating your high-level programming language as if it was assembly language with direct register access...

  • bvs23bkv33 (unregistered)

    i forgot another cool variable naming rule: _, __, ___, ____, _____, ______, _______, ________, __________ and so on, i think you got the point

  • Klaus (unregistered) in reply to Zach

    How bad does it have to be for someone to say "Fuck this" and just walk away or quit?

    Probably depends on their zip code.

  • Duston (unregistered)

    Back in 1979, that's what you had to do. And just like Ancient Chinese Medicine, just because it's old must mean it's good, right?

  • Jim (unregistered) in reply to Duston

    In the old days we didn't have variables, you put values in registrars or uses memory addresses directly or indexed or indirect, or indirect indexed.

  • groz (unregistered)

    Jay seems to have dodged a bullet: as shitty as this is, at least it gave a result that was immediately recognised as obviously invalid. Imagine what would have happened if the search/replace yielded something more subtly wrong like

    account_balance = account_balance - customer_tax_rate_previous_year

    Nothing immediately obviously wrong about that unless you were looking closely. Hopefully this whole mess is in a language with sensible scoping rules... (ha ha, who am I kidding?)

    As a side note, if Jay's boss was consistent in his System Hungarian variable naming, why the bloody hell is he adding a string value (zip_code) to a currency value (account_balance)?

  • (nodebb) in reply to DocMonster

    Sadly, in many higher-level languages (MATLAB, R, etc), "i" and "j" are already assigned to sqrt(-1) . Use them for indexing and you may have broken some arithmetic statements elsewhere.

  • get off my lawn (unregistered)

    It's programmers like Jay who are causing simple applications to require huge amounts of space and memory. Just treat it as if everyone has a top of the line machine and time to spare, because his software is going to need it.

  • ScienceGoneBad (unregistered)

    One of the 1st programs I worked on ~2 million lines of FORTRAN (yes my neckbeard is that long). 10-15 years of development for doing hydrodynamic studies in pipes connected to nuclear reactors. It worked pretty well, and the group had a competition to add a subroutine to solve a specific edge case of the simulation. The winning code solved the problem best, and I was tasked w/ adding it into the grand temple of code. All of the variables were a2, b4, c7, etc. No comments, No documentation, just ~400 lines of code. Many of the variables got values once and were never used again ... anywhere. It took me 3 months to hand trace that code to find the THREE variables that were needed to be passed in, and the TWO variables that came out the back end. I vowed then & there to NEVER write code like that ... EVER

  • Bubba (unregistered)

    Working on that codebase will separate the men from the boys, for sure...

  • DK (unregistered) in reply to get off my lawn

    Nope. A good compiler will perform a lot of these optimizations if they are safe. You do not need to make the code unreadable for that. In fact, some of these "optimizations" would hinder the compiler's ability to optimize the code. Using global variables means that the compiler has to write out those values to memory across function calls. If they were local variables, the compiler could eliminate the memory access entirely by storing the values in registers.

    Also, when a program is really slow, the right thing to do is to profile it to understand what the CPU is spending its time on. There is no point in optimizing code that runs rarely. I've never seen an application where these types of micro-optimizations made sense. Most of the time, you find that the CPU is spending 90%+ of its time on one operation. You just need to focus on that.

  • Object delete. (unregistered) in reply to Duston

    Unless you were using COBOL or FORTRAN: No, you didn't.

  • Zach (unregistered) in reply to Zach

    (that's a different person - same name) That actually could be a plausible answer. And if I don't actually give a shit what the code looks like, this would be just code for someone to take care of, and I won't have to give a crap if it looks pretty or not

  • Mr Flibble (unregistered) in reply to Quirkafleeg

    I tried orking cows once. It didn't go well.

  • (nodebb) in reply to Mr Flibble
    I tried orking cows once. It didn't go well.
    You were holding them wrong.
  • ZZartin (unregistered)

    I'd stab you but I forget if my knife is in drawer K1 or shelf B5

  • Bubba (unregistered) in reply to Mr Flibble

    Not enough lube

  • David C. (unregistered)

    Sounds like this boss was not only self-taught, but was self-taught using a language that only supported global variables with really short names. Like 1970's and 1980's dialects of BASIC.

  • Miles Archer (unregistered)

    Looks like this guy learned to program using Fortran 66. All you had was two letter variable names. People stuck with Fortran 66 style coding well into the 1980s, particularly when writing in later versions of Fortran.

  • (nodebb)

    I'm still trying to persuade people that naming a variable the same as its data type (bar case) doesn't actually help people understand what the variable is used for. Yes, "FormattedData formattedData;" statements about in our code.

  • DCL (unregistered)

    This story reminds me of an IT manager back in the old COBOL on mainframes days who would, when putting a program into production, remove all the comments 'to reduce the executable program size'.

  • Barf4Eva (unregistered)

    "cow-orkers"

    hmmm, cows? I must be missing something here.

  • Barf4Eva (unregistered)

    haaa! This article made me think of this Dilbert comic:

    https://cdn.auth0.com/blog/modernize-legacy-system/legacy-systems-dilbert.png

  • Brian (unregistered)

    nods head

    Ah, so it's like Fanuc Macro B.

    For those unfamiliar, Macro B is a sort of minimal 'language' that is used on some industrial CNC machines, as part of standard "G-code". Local variables are #1-#33, global volatile variables are #100-#199 (optionally -#499), global nonvolatiles are #500-#999. Flow control consists of if-then, loop, and goto statements.

    A macro is called from a higher-level program with G65 (rarely G66), where arguments are passed as letters corresponding to the numeric value of the variable, e.g. G65P8001A180.C3. would call macro 8001 and place 180. into #1 and 3. into #3 - the decimal point is critical. Letters P, L, O, N, and G are special and cannot be used. This also means that passing values into any variable above #26 becomes interesting, though it is possible with Argument Assignment Type 2, in the form of G65PxxxxABCIJKIJKIJKIJKIJKIJKIJKIJKIJKIJK.

    Oh, and since it's an interpreted language and machines often inexplicably have tiny amounts of storage, comments are often removed from production macros. Fun stuff.

  • Rudov Mischoya (unregistered)

    Single-static-assignment is your friend. Running that code through a compiler, decompiling it with an SSA-form decompiler, and then doing the renaming would probably have yielded a better outcome.

  • I dunno LOL ¯\(°_o)/¯ (unregistered) in reply to bvs23bkv33

    I've used a set of 256 C macros like "#define XX__XX_X 0xCD" for making fonts that would be visible in the source code of a monster const array. Does that count?

  • chris (unregistered)

    Oh, sounds familiar. In a previous company, I ran into this situation in a C program, but they made a more "interesting" way of reusing the local variables

    foo() int a #define length a <do a lot of stuff with "length"> #undef length #define address a <do a lot of stuff with "address">

    repeat further down in the 20k line method. So they saved the "precious" stack space and still got descriptive variables names when reusing them. Me? I wanted to kill someone.

    And of course, this code was "optimized" despite the fact that they had no customers for it lined up, no requirements on performance or any other reason why the code looked as it did.

  • Decius (unregistered) in reply to cellocgw

    If your language is using 'i' to refer to sqrt(-1), you're going to hit trouble as soon as you declare it to be an int.

  • (nodebb) in reply to Decius

    Decius, you won't believe this, but in MATLAB,

    int8(i) ans = 0 + 1i

  • (nodebb)

    Oh, yeah, I worked on one of those programs. Understanding it is just as easy as described. Been a long long time. Didn't miss it.

  • (nodebb) in reply to groz

    As a side note, if Jay's boss was consistent in his System Hungarian variable naming, why the bloody hell is he adding a string value (zip_code) to a currency value (account_balance)?

    Some programmers (AKA idiots) assume that any world string that every example they've seen consists of all digits will always consist of all digits. Things like social security number, zip code, street address, etc. Similar to the crowd of people that thinks social security number will always be nine digits, postal code will always be 5 digits, and street addresses will always be four digits (max).

    This is the same crowd that believes all swans are white.

  • WTFGuy (unregistered)

    Back in the early 1970s I worked on converting a full scale business accounting, sales, and inventory control app from one minicomputer brand's proprietary dialect of BASIC to another minicomputer brand's proprietary dialect of BASIC. And along the way converting all the permanent IO from proprietary sorta-kinda-ISAM files in the old dialect to a proprietary SQL-hasn't-been-invented-yet v1.0 non-relational database storage system on the new brand.

    Per the rules of BASIC at the time, every variable was global to the source file level and all were named <UppercaseLetter> or <UppercaseLetter><Digit> if type numeric or <UppercaseLetter>$ or <UppercaseLetter><Digit>$ if type string.

    We had some pretty thorough conventions to impress some mnemonic-ness onto the insanity. But it didn't help much. I still remember that W$ represented the new system database password and I3$ was an invoice number (AKA invoice "table" "primary key" in modern parlance).

    You young'uns got it easy. :)

  • (nodebb)

    Jay needs to move somewhere that has a large negative zip code, then he'll be rich enough to quit his job.

  • (nodebb)

    This looks like the Fortran habit. Most scientists who get their programming training from scientists of the previous generations learn Fortran (and nothing else). The habits are passed on. The old Fortran does not even have declarations. If you misspell a variable, it's a new variable. The type of variables beginning with the letters I,J,K,L,M,N is integer, the rest are of the type real. (Later you could add a declaration if you wanted a string, or a variable not following this naming convention.)

    The habits include: variable names like i, ii, m, mm, etc., all variables being global, and everything in the main program---no subroutines/functions. Of course there is no point in scoping variables if there is not more than one scope to begin with.

    These programs grow from less than a hundred lines to million lines. Some of them are still living, in the scientific or engineering areas. Who knows, the atomic reactor that gives power to your house may depend on such a fortran program whose one of the crucial variable is named x42. On a different note, your bank account may be managed by a set of ten thousand old cobol programs, all looking like each other, whose ancestor was born in 1970s, and they stopped updating it in 1990s, because nobody understood them anymore. Now they just "wrap" around that mainframe.

    Try not to think about it. GOD is real unless declared an integer.

  • Loob (unregistered) in reply to Barf4Eva

    Many questions about the use of "cow-orkers": for those not aware, it's a Dilbertism, intentionally mis-spelt as a dig at "co-workers".

Leave a comment on “Temporal Obfuscation”

Log In or post as a guest

Replying to comment #502873:

« Return to Article