Signs your code is unmaintainable



  • @ScholRLEA Going back to the Bad Code page, I've mentioned some of the beauts from it before, but that it was quite some time ago. Here are some favorites of mine:

    Kris Johnson:

    I saw the following in production code, written by someone with a few years of experience who bragged about his ability to write efficient code:

     switch (number)
     {
     case 0: printf("0"); break;
     case 1: printf("1"); break;
     case 2: printf("2"); break;
     case 3: printf("3"); break;
     case 4: printf("4"); break;
     case 5: printf("5"); break;
     case 6: printf("6"); break;
     case 7: printf("7"); break;
     case 8: printf("8"); break;
     case 9: printf("9"); break;
     }
    

    And yes, that apparently was the original indentation style, too.

    Edouard:

    The C command line parser for user input that consisted of a 5000 line nested if-then-else statement. It was a good thing that tabs were set to 2 spaces, since some of the lines started in column 70.

    The same Edouard posted the signature for a Fortran function he'd found that took 292 parameters:

    SUBROUTINE FEMA(IBT,IDISP,IDO,ILPIN,ILTIN,INP,ISC_GD,ISC_GK,
    '  ISC_GKK,ISC2_GKK,ISC_GM,ISC_GMM,ISC_GQ,ISR_GD,ISR_GK,ISR_GKK,
    '  ISR2_GKK,ISR_GM,ISR_GMM,ISR_GQ,ISALIG,
    '  ISAXES,ISBASE,ISCLOC,ISCONO,ISCONT,ISCROS,ISDANO,ISDAPR,
    '  ISDATA,ISDATR,ISDIPO,ISDIPA,ISELEC,ISELNO,ISFACE,ISFANO,
    '  ISFIBR,ISFIEL,ISGAUS,ISGRID,ISGRAD,ISHIST,ISIMAG,ISINCR,
    '  ISISOC,ISIZE_TBH,ISLEAD,ISLINE,
    '  ISLINO,ISL2BE,ISL3BE,ISMAP,ISMATE,ISNONO,ISN2BE,ISN3BE,ISOBJE,
    '  ISPLIN,ISPLOT,ISPMAR,ISPROF,ISREAC,ISRESI,ISRULE,ISSCAL,ISSECT,
    '  ISSHEE,ISSIGN,ISSTRA,ISSTRE,ISSTRM,ISSURF,ISTEXT,ISTRAC,ISVELO,
    '  ITHRES,LD,LDR,LIST,LGE,LN,MXI,NAN,NBH,NBJ,NBJ_face,NCO,NDDATA,
    '  NDDL,NDET,NDLT,NDP,NEELEM,NEL,NELIST,NENP,NEP,NFF,NFLIST,NGAP,
    '  NGLIST,NHE,NHP,NJE,NJP,NKE,NKF,NKH,NKJ,NLCHOR,NLF,NLL,NLLINE,
    '  NLLIST,NLNO,NLS_ICON_ELEM,NLS_ICON_X,NLS_ISURF_ELEM,
    '  NLS_NDATA_CONT,NLS_NDATA_IMAG,NMBIN,NMNO,NNF,NNL,NONL,NONM,NONY,
    '  NP1OPT,NP2OPT,NP3OPT,NPB,NPF,NPINTER,NP_INTERFACE,NPL,
    '  NPLIST1,NPLIST2,NPNE,NPNODE,NPNY,NPQ,NQE,NQGE,NQLIST,NRE,
    '  NRLIST,NTCOVA,NVHE,NVHP,
    '  NVJE,NVJP,NVQ,NW,NWQ,NXI,NXQ,NYNE,NYNO,NYNP,NYNR,N_OLD_ORDER,
    '  N_TEMP_ORDER,NP_OLD,NP_TEMP,PAOPTY,IPIVOT,IWK1,IWK2,
    '  IWK_ITERATIVE,POTNOUT,CE,CG,CIN,CONY,COVA,CP,CQ,CYNO,DET,DF,
    '  DL,DLL,DRDN,DRDNO,D_RE,D_RI3,D_RP,D_TG,D_ZG,DXDXIQ,DNUDXQ,ED,
    '  EDD,EIGVAL,EIGVEC,EM,ER,ES,FEXT,GCHQ,GD,GK,GKK,GM,GMM,GQ,GRR,
    '  GR,GUQ,
    '  NLS_CON_PSI,NLS_CON_XI,NLS_SURF_XI,NLS_SURF_PSI,PE,PF,PG,
    '  PROPQ,RAD,RD,RE1,RE2,RG,SE,SQ,T_BH,T_BH_INV,THRES,
    '  VE,VOL,VOLT,WD,WDL,
    '  WG,WK1,WK2,WK3,WK4,WK1_INV,WK2_INV,WK3_INV,WK4_INV,
    '  WK_ITERATIVE,WU,XA,XB,XE,XF,XG,XG1,XGRC,XID,XIDL,XIG,XIP,XN,
    '  XN_GRAD,XO,XP,XR,XR_GRAD,YD,XQ,YG,YP,YQ,ZA,ZA1,ZC,ZD,ZD2,ZDD,
    '  ZDL,ZE,ZE1,ZF,ZG,ZG1,ZP,ZP1,ZEC,ZFC,
    '  FIX,FIXP,FNY,ISEG,CSEG,END,STRING,INTWORK,REALWORK,ERROR,*)
    

    Someone else mentioned:

    I once saw the code of a relatively green programmer's first attempt at C: a editor for the Unix environment. The code consisted of six functions, five of which were about ten lines long, while the sixth was well over 1500 lines, had 24 (!) levels of indentation, and used every two character long variable name you can make (well, the last point is an exaggeration). Moreover, the coder insisted on indenting with tabs consistently, resulting in the worst case in two empty lines of indentation for every line of code (for a 80-char display). Read that, sucker!

    Another anonymous poster said (I've only posted part of it here, the full list is even longer):

    This is in an allegedly MVC web application. A typical file (of over three thousand) has 6000 lines with more than a third (2258 lines) taken up by a single method. That method features (again as is typical):

    • Concatenated strings of SQL (with no escaping of user data);
    • Three different ways of connecting to and querying the database;
    • Sometimes direct reference to request parameters, bypassing the framework's mechanisms;
    • Directly modifying request parameters;
    • magic numbers ("if(expiry_type == 2)") and strings ("if(cost_type == 'O')");
    • Booleans are often implemented as variables that contain either the empty string or the integer 1;
    • Three different mechanisms for resolving class references;
    • Every edit since the year dot is helpfully commented with the author's username and the date (and nothing else). Hand-written, of course, so the formatting of the name, the date, and the comment syntax used varies from line to line;
    • This method doesn't have the deepest if/else nesting I've seen in this project - it only goes up to eight - but some of the tests span four lines;
    • Homebaked date and time functions of varying reliability, and a battery of conversion functions to and from the language's native functionality;
    • Massive chunks of code are executed and their results are discarded - unless there are side-effects buried five or six levels down in the call stack;
    • Hundreds of variables are created, given values, and never used (often because the code that used them was commented out);
    • All the usual "if (something) { foo = true; } else { foo = false;}" idioms (in pretty much any variant you can imagine - including those that involve empty strings and integers as above));
    • Spelling and grammatical mistakes (other parts it ask users for their "brithday", two (of many) lists of days of the week have a "Wedbnesday", and the most-common (hardcoded inline) message to the user when no search results are found is 'Have no record'; another message informs users that the file they uploaded was the wrong type - as long as they're fluent in Vietnamese);

    Thomas Eyde:

    I was recently hired by a client to try to optimize a huge VB6 application. A windows explorer search on all VB source files which can contain code gave me 20MB! One of the VB projects contains 13 classes. A rather small project would you think? The file sizes are 2k x 5, 4k x 4, 5k, 6k, 40k and (hold your breath) 1,474k!!! Aivosto has a nice VB project analyzer, the various reports reveals the following of that giant class:

    • There are 309 dead code related problems, most of them are dead variables or variables only written to (how is it even possible?)
    • total logical line count is 29,251 - 8,449 of them are comments - 4,252 are white space. You would think well, at least this beast is well documented. Dream on! Most of the comments are out-commented code which should be removed. The rest is empty function headers, wrong function headers, meaningless function headers and uninforming block descriptions.
    • 20 public and 303 private procedures. Average size is 92 lines, the largest has 501 lines
    • Half of it has a Cyclomatic Complexity Metric from 1 - 5, which isn't bad (I guess), but a third of it ranges from 6 - 15, while the rest lies between 16 to 51+. This is bad.
    • Max depth of conditional nesting is 16! I am not even attempting to guess what this one does, or should do.
    • 73% has a structural fan-in of 0 - 1, which indicates almost no reuse. This is an achievement in itself.

    More anonymous stuff:

    The programmer of this Perl snippet asked me for help. I got back at him by rewriting this and the surrounding code as a loop, and then proceeding to rewrite the loop using only closures and HOFs.

    if($INPUT{like1} ne "="){$INPUT{op1}= lc $INPUT{op1};$value="LOWER($INPUT{get1})";$input="'\%$INPUT{op1}%'"}else{$value="$INPUT{get1}";$input="'$INPUT{op1}'"}$qin= "$value $INPUT{like1} $input";if($qin=~s/\*|\%/\%/g){$qin=~s/=/ LIKE /};$query =$qin;
    if($INPUT{plus1}){if($INPUT{like2} ne "="){$INPUT{op2}= lc $INPUT{op2};$value="LOWER($INPUT{get2})";$input="'\%$INPUT{op2}%'"}else{$value="$INPUT{get2}";$input="'$INPUT{op2}'"}$qin=" $INPUT{plus1} $value $INPUT{like2} $input";if($qin=~s/\*|\%/\%/g){$qin=~s/=/ LIKE /};$query.=$qin}
    if($INPUT{plus2}){if($INPUT{like3} ne "="){$INPUT{op3}= lc $INPUT{op3};$value="LOWER($INPUT{get3})";$input="'\%$INPUT{op3}%'"}else{$value="$INPUT{get3}";$input="'$INPUT{op3}'"}$qin=" $INPUT{plus2} $value $INPUT{like3} $input";if($qin=~s/\*|\%/\%/g){$qin=~s/=/ LIKE /};$query.=$qin}
    if($INPUT{plus3}){if($INPUT{like4} ne "="){$INPUT{op4}= lc $INPUT{op4};$value="LOWER($INPUT{get4})";$input="'\%$INPUT{op4}%'"}else{$value="$INPUT{get4}";$input="'$INPUT{op4}'"}$qin=" $INPUT{plus3} $value $INPUT{like4} $input";if($qin=~s/\*|\%/\%/g){$qin=~s/=/ LIKE /};$query.=$qin}

  • FoxDev

    @cabrito said in Signs your code is unmaintainable:

    @accalia Ah, I can understand the appeal of the challenge. Codethulhu vs accalia.

    yeah, i'll be the next snoofle witht eh stories i'll have about my battle



  • @accalia The fixing is fun. The six months of drudging through without a guide, trying to figure out what all the undocumented shit does? Not so much.

    Sorry, flashing back to the start of my current job.


  • FoxDev

    @abarker said in Signs your code is unmaintainable:

    @accalia The fixing is fun.

    true, true.

    @abarker said in Signs your code is unmaintainable:

    The six months of drudging through without a guide, trying to figure out what all the undocumented shit does? Not so much.

    eeeh.... it has its own challenge.... it's not fun, but at least it's interesting



  • @accalia said in Signs your code is unmaintainable:

    "cute" server names. i'm sorry but i have limited head space.... is carnation our database server or is that rose?! just name the fucking servers sensibly! it's not professional to have "cute" names because i never can fucking remember what server is which, and that old argument about security through layers is shit. having a cutsey name isn't going to hide where your database server is from someone who has compromized the webserver.... the name's right there in the fucking connection strings! GAH!

    This. Fuck, this. I'm tempted to create a dozen sockpuppet accounts just so I can upvote this more.



  • @abarker said in Signs your code is unmaintainable:

    @accalia The deletingfixing is fun.

    I deleted in one sprint (when left alone):

    • 25 C-Sharp projects
    • 30 gigs of un-used code
    • Fixed the deployment build scripts
    • Removed 30 implementations of opening a popup window in JavaScript

    This was all achieved with the delete key and ctrl + v. Greatest 2 working weeks of my entire life. A pull down from TFS used to take 30 minutes, now took 2. The best thing is that it passed a full manual regression test, a full automated test and deployed into production with one click.



  • @accalia said in Signs your code is unmaintainable:

    far to many comments where the entirety of the comment is //BUGBUG

    I can't help but read that as an old Warcraft orc responding to commands with "Bug bug!"


  • Trolleybus Mechanic

    @Dragnslcr said in Signs your code is unmaintainable:

    @accalia said in Signs your code is unmaintainable:

    far to many comments where the entirety of the comment is //BUGBUG

    I can't help but read that as an old Warcraft orc responding to commands with "Bug bug!"

    I always thought it was "zug zug".



  • @mikehurley said in Signs your code is unmaintainable:

    @Dragnslcr said in Signs your code is unmaintainable:

    @accalia said in Signs your code is unmaintainable:

    far to many comments where the entirety of the comment is //BUGBUG

    I can't help but read that as an old Warcraft orc responding to commands with "Bug bug!"

    I always thought it was "zug zug".

    Yes, it was.



  • Fucknuts, it looks like DevShed deleted everything from before 2010 when they updated their forum software. I was going to post a true :wtf: of a thread where I got in way too deep while trying to help some poor schmuck of a grad student who was himself drowning in some terrible C++ bioinformatics code, and was trying to convert it to some even worse Java code - a line at a time, because he didn't know either language and had never done any programming before. I think I still have the code, but... ugh, no, it's pure torture. I can attach the zip file from this if I can find it, but trust me, this stuff was cthulic.

    There was also some obnoxious little tweenage jackass who claimed to have written an OS, which turned out to be a 1700 line C program consisting of a single main() function, that was basically just a shell processor (sort of). If I recall correctly, he got bounced for a few months for violating the TOS age minimum, then came back when he was older only to rage-quit when SizeableGrin told him off.

    EDIT: Nope, looks like I didn't hold on to the code, though it could be in some of my old backup DVDs. CBA to check, though.



  • ThisBooleanStringIsAHotMess



  • @Dragnslcr said in Signs your code is unmaintainable:

    @mikehurley said in Signs your code is unmaintainable:

    @Dragnslcr said in Signs your code is unmaintainable:

    @accalia said in Signs your code is unmaintainable:

    far to many comments where the entirety of the comment is //BUGBUG

    I can't help but read that as an old Warcraft orc responding to commands with "Bug bug!"

    I always thought it was "zug zug".

    Yes, it was.

    Me not that kind of orc.


  • Impossible Mission - B

    @DCRoss What kind of orc you then?


  • Notification Spam Recipient

    @xaade said in Signs your code is unmaintainable:

    limitation on method names

    0_1470248015295_upload-0e05ce15-967d-42a9-aed7-0581ecd93047

    Can you tell when we upgraded to a version that started having the ability to specify two names for objects?

    I'll give you a hint: A certain video game came out around the same time...



  • @mikehurley said in Signs your code is unmaintainable:

    I always thought it was "zug zug".

    Next thing you'll tell me the protoss weren't really saying, "we need more lesbian ass!"


  • Notification Spam Recipient

    @aliceif said in Signs your code is unmaintainable:

    Having code that was only ever worked on by one specific person. Especially bad if it's an entire library or application.

    👋 I'm pretty sure my ILQA application is full of WTFs, but the business users haven't tore it down from the Dev server yet (one year it will make it to Prod)....



  • @accalia said in Signs your code is unmaintainable:

    @cabrito said in Signs your code is unmaintainable:

    @accalia

    1. We have aproximately eleventy billion CLR methods in our code base.... each an d every one of which breaks every time a new .net patch is made because CLR is SUPER sensitive to the patch level of the .net framework that is installed and will refuse to execute CLR methods when the version of .net that the function was registered with differs from the one it would be running under.
    1. When trying to produce a dependency map for our database stored procedures and views all automated tools attempted so far have failed.... probably because we have views that select from views that usea function to format data using a CLR method which in turn selects data from the same views that the original view selects data from which...... oww.... my head hurts.
    1. we have another system that has different versions installed in dev, test, and prod because we lack the licensing to install teh same version in three environments and the vendor refuses to sell us more licenses for the version of the software we have.... we need to upgrade, but we can't because we decompiled their DLLs and made so many changes to them that literally we can't upgrade without trashing out enture workflow..... the vendor knows this, and that's why they won't licnce us for the old version anymore.....

    WAT

    Oh, girl... RUN!!!!!

    just when i finally got the budget to fix all this shit? and a PM office that supports me, and a manager that's sane?

    hell no! this is going to be too much fun to fix!

    because not only do i have to fix it, i gotta do it without breaking anything as i roll through the systems fixing shit

    SQUEEEEEEEEE!

    so excited!

    I like to refactor crap and make it beautiful. I can relate.


  • Notification Spam Recipient

    @Groaner said in Signs your code is unmaintainable:

    making tables with extra varchar columns (think UserDefined01, UserDefined02, ... UserDefined20),

    Oh, you mean like this?

    0_1470248617163_upload-72750b28-c88e-4be2-b789-d74ffd7e8fc4


  • Impossible Mission - B

    @Karla said in Signs your code is unmaintainable:

    I like to refactor crap and make it beautiful. I can relate.

    I've heard that called "refactoring with a chainsaw."



  • @Tsaukpaetra said in Signs your code is unmaintainable:

    @Groaner said in Signs your code is unmaintainable:

    making tables with extra varchar columns (think UserDefined01, UserDefined02, ... UserDefined20),

    Oh, you mean like this?

    0_1470248617163_upload-72750b28-c88e-4be2-b789-d74ffd7e8fc4

    Yes, except it was in several tables, and those tables also had some properly-named columns.

    Also, to implement the intent of what's in your screenshot, I'd probably use something like XML or EAV.


  • Winner of the 2016 Presidential Election Banned

    @Yamikuronue Variable names follow the pattern

    u734, u1243-2, u623, etc.

    And they're different in every file, even if they refer to the exact same thing.

    ETA: And the concept of libraries to simplify that "referring to the exact same thing" issue is nearly nonexistent.



  • @lucas1 said in Signs your code is unmaintainable:

    I've worked in most of the major bookies now

    Did a small stint at one of those in the UK. If you're very unlucky, you might've even worked with my code from back when I had no idea how to write Javascript or CSS properly.

    I think I left a lot of "I'm so sorry" comments in there.



  • @Fox Each one is a German submarine!


  • Winner of the 2016 Presidential Election Banned

    @blakeyrat I don't think the webserver I found that gem on had the storage space for thousands upon thousands of entire german submarines.



  • @Karla said in Signs your code is unmaintainable:

    I like to refactor crap and make it beautiful

    Oh, just did that to my project recently. Problem is, it involved changing the folder structure, and work kept going on separate branches before getting merged into develop.

    And as it turned out, git is really, really awful at handling edit-rename / edit-move merge conflicts.

    Shit broke. Badly. Thought it serves them right for failing to integrate those story branches despite me warning them multiple times to merge changes to develop before I deploy mine...



  • @masonwheeler said in Signs your code is unmaintainable:

    @Karla said in Signs your code is unmaintainable:

    I like to refactor crap and make it beautiful. I can relate.

    I've heard that called "refactoring with a chainsaw."

    In my case it was five 1-2K line stored procedures with many time duplicated where clauses (that had many filters and exceptions) that also created large dynamic SQL strings storing intermediate data in work tables. There were so many edge cases.

    The five sprocs produced 8 report variations of the same/similar (summary/detail, projections vs actuals, etc) report.

    I could not follow them and after trying to tweak them I gave up and just said I am rewriting it.

    Besides being correct after optimizing them for performance my versions were significantly faster. The performance was also causing overall performance for all users because of the amount of data across the network and the reports joined on several other databases even one on another server (I put in an overnight processes that updates all the join data locally so the daily running of reports will never cross another database).

    One of the summary reports had a not insignificant number (31%) of runs take longer than a minute and as long as 24 minutes.

    My optimized version 3% over 1 minute (none over 2).



  • I found an old link to the bioinformatics project I mentioned, in a thread on Nightstar Zoo on the topic of terrible code from the same period; apparently the problem was that the search tool doesn't cover older threads even though they are still in the database. Have fun. 😈



  • @ScholRLEA said in Signs your code is unmaintainable:

    C++ bioinformatics code, and was trying to convert it to some even worse Java code - a line at a time, because he didn't know either language and had never done any programming before.

    That gives me a cold sweat.



  • @error said in Signs your code is unmaintainable:

    I remember an old job writing ASP.NET 1.1 apps, that had no source control, and changes were deployed by copying the bin folder directly. I had maybe a year of experience under my belt.

    that's exactly my first job. except copying out the new bin contents wouldn't set the permissions correctly, so you had to remote desktop into the server and tell the folder to cascade permissions down on the contents.

    we eventually put our projects into visual source safe. one time a developer quit with his last round of changes deployed but left his project checked out.


  • Considered Harmful

    @fwd You didn't work at a web design agency in Dallas, TX by chance...?



  • @error no, apparently that was just SOP in the early days of .net web apps.



  • @Yamikuronue said in Signs your code is unmaintainable:

    Anyone got anything handy?

    Ancestry tree of our codebase in SVN? I can sanitise it for slot-in to an article without edits if required.

    4 (disparate) branches are still active and, as the document I'm working on to address this issue alludes to, look more like - and continues to be as of today - :

    0_1470254513583_7259167_f520.jpg

    than

    0_1470254524038_10492970244_5ecdaff743_b.jpg



  • I also found the stuff involving SphinxCorp, the kiddie I mentioned earlier (though I guess my memory was off - he wasn't the one bounced for being under 13 nor the one who ragequit after calling everyone on the forum a faggot, the 'operating system' was in C++, and the main() function wasn't quite as big as I remembered). It's pretty amazing stuff, between the Goon Project/help vampire crap and his insufferable egotism. I really hope he didn't keep programming for very long but experience says he's probably a CTO by now.

    WAP1x 'Programming language'
    Stupid debugger, stupid variables, stupid programmer :p
    %$^%ing piece of %$^ debugger!! >:(
    Windows... You fail again (at interupts this time)
    Very simple question about user input in c
    Paging mode initialization



  • @masonwheeler said in Signs your code is unmaintainable:

    @DCRoss What kind of orc you then?

    Me so horned. Me hurt you long time.


  • Trolleybus Mechanic

    I enjoy "refactoring" that results in enough deleted code that you probably have a negative LOC for the year. :)



  • @AyGeePlus As I said, I did find a link to that thread, so if you want you can see the true horror of it all.

    Not that the 'improved' code I wrote was much better... ☹ My advice was poor, I didn't ask questions I should have, I kept making careless mistakes in the code, and overall, I let the whole thing go on far past the point it should have. Live and learn.



  • @ScholRLEA Holy shit that forum is full of dicks.

    And I mean real genuine dicks, not the fake kind you get here. Why the shit did you post there?

    EDIT: sizablegrin for example, every sentence of his I read I want to kick him in the back of the knees.



  • @blakeyrat said in Signs your code is unmaintainable:

    @ScholRLEA Holy shit that forum is full of dicks.

    And I mean real genuine dicks, not the fake kind you get here.

    Why yes, yes it is. Though at the time, OSdev.org (which he'd also tried posting to) was even worse. Also, the worst dickery was committed by a handful of people, with SizeableGrin being by far the worst offender among them. AFAIK, he's still there, and still a dick.

    @blakeyrat said in Signs your code is unmaintainable:

    Why the shit did you post there?

    Because I was an even bigger idiot then than I am now.

    EDIT: also, I was considered the voice of reason there in comparison, which stroked my ego. In retrospect, that should have been a warning sign.


  • Winner of the 2016 Presidential Election Banned

    @mikehurley -Actually me this year, so far.

    My refactor-by-chainsaw of our website in February or so eliminated around forty thousand lines of code. Since then, I've only written maybe ten thousand lines of code. (Jesus, most of my job is Microsoft Office and GIMP, this year)


  • Trolleybus Mechanic

    1. open the solution
    2. do a global search
    3. Look for a function name

    The code is unmaintainable if only ONE of the following is true:

    • You only get back the function definition itself
    • You only get calls to the function

  • Garbage Person

    From start of build to automated test results takes about five hours.


  • Notification Spam Recipient

    @Greybeard said in Signs your code is unmaintainable:

    From start of build to automated test results takes about five hours.

    Sounds like a standard OS build...



  • A lot of Source Engine stuff is basically copy-pasted hacks. Why make a function to get the position of the target a marine wants to shoot grenades at when you can copy-paste the same incorrect code that causes bot allies of a medic to shoot the medic's target when they want to attack with a grenade launcher?

    Or how about how Hammer's set of known properties of things that can be in Source Engine maps is completely separate from the actual set of properties or their types? For example, the slavename property of asw_door is defined as string instead of target_destination, so double doors inside a func_instance are completely broken.

    And GameInfo.txt contains a GameData field, which gives the location on the hard drive of the Hammer FGD. Relative to the bin folder of the game engine, not the folder containing the GameInfo.txt file. Which means Source Engine mods need to know not only where the mod is installed but also where the game engine is installed.

    But wait! That field of the GameInfo.txt file isn't read by Hammer under any circumstances! Hammer uses another file, located in the bin folder of the game engine (yes, a configuration file inside Program Files) to store the location of every FGD for every mod for that game. And that file uses absolute paths. So you can have three different versions of the game's list of properties of things.



  • @accalia said in Signs your code is unmaintainable:

    you cannot replace an aging and failing server because it runs critical business processes that no one at the company has source code for nor can they or the HPCs that wrote the thing in the first place figure out how to move it to a different server.

    Immediate P2V on that box should buy you enough time to let you supersede it one careful piece at a time.





    • Baklava Code (leaky abstraction)
      At my former employer, the codebase was so heavily layered, with no real benefit for most of them. These layers are there for "separation of concern", but if separation doesn't exist, then it's pointless. If even the simplest change to code requires going to 3+ layers, then I fear for the maintainability.

    • Not Testable
      Now, I'm not asking for full-blown unit tests, but if I can't stick a console application in the mix and add a few references to projects to run through methods in a debugger, then I start worrying.

    • Sweeping statements
      This is more of a "people in charge" sort of problem (although I would argue us developers should have the backbone to debate this more often. Very rarely is a practice "all or nothing". And quoting "Best Practice" shows that you only have an academic knowledge of a problem / topic. Some real world experience helps change that from a binary choice to fuzzy logic.

    • Inventing your own language
      The last place had a portion of the system which would serve as the content of pages (even though this wasn't a CMS), and they needed some bits of logic. Now, the content manager was by no means a developer, but needed stuff like conditions, showing / hiding, enabling / disabling etc. Long story short, instead of having a few blocks of standard JS code to select and store, the lead developer built his own parser for XQL. This wasn't a query language, but rather a slightly more lay person readable of basic JS functions. Of course, typos and incorrect use of punctuation lead to more user frustration than it attempted to solve. And naturally, the documentation for this language lies within X's head...

    • Saying "That's how we do it here"
      ^^ is NOT the way you explain things if you expect your resources to learn and build initiative.


  • BINNED

    @accalia said in Signs your code is unmaintainable:

    i get to fix things!

    typos? 😁


  • Winner of the 2016 Presidential Election

    @blakeyrat said in Signs your code is unmaintainable:

    Your dependency graph is unreadable if printed on a single piece of 8.5x11 paper.

    Do transitive dependencies count? Because we're forced to integrate with frameworks that depend on half of Maven central.


  • Discourse touched me in a no-no place

    It was mentioned earlier, but Ravioli Code is a great example of what can go wrong. The tendency when someone goes down that road is to put lots of objects in and have each call off to others for virtually everything. Which appears at the time to be a great way of operating, but when it comes to maintenance it's a disaster because it's virtually impossible to figure out where anything actually happens since every object is just delegating to some other object with tiny perhaps-non-obvious tweaks. In short, it's like spaghetti programming except the complexity is now in the call graph where it is singularly invisible and not written out explicitly.

    IME, Java, Javascript and Ruby all tend to wander very far down this path. :( There may be other languages that hit this (I would suspect that C# and Python would be inclined to it) but I really don't know for sure.


  • Discourse touched me in a no-no place

    @asdf said in Signs your code is unmaintainable:

    we're forced to integrate with frameworks that depend on half of Maven central

    Oh, you use Hibernate? 🎛


Log in to reply