Spyke
programmer_humor·Programmer Humorbyvrek

What are some of the worst code you have seen in a production environment?

I'll give an example. At my previous company there was a program where you basically select a start date, select an end date, select the system and press a button and it reaches out to a database and pulls all the data following that matches those parameters. The horrors of this were 1. The queries were hard coded.

  1. They were stored in a configuration file, in xml format.

  2. The queries were not 1 entry. It was 4, a start, the part between start date and end date, the part between end date and system and then the end part. All of these were then concatenated in the program intermixed with variables.

  3. This was then sent to the server as pure sql, no orm.

  4. Here's my favorite part. You obviously don't want anyone modifying the configuration file so they encrypted it. Now I know what you're thinking at some point you probably will need to modify or add to the configuration so you store an unencrypted version in a secure location. Nope! The program had the ability to encrypt and decrypt but there were no visible buttons to access those functions. The program was written in winforms. You had to open the program in visual studio, manually expand the size of the window(locked size in regular use) and that shows the buttons. Now run the program in debug. Press the decrypt button. DO NOT EXIT THE PROGRAM! Edit the file in a text editor. Save file. Press the encrypt button. Copy the encrypted file to any other location on your computer. Close the program. Manually email the encrypted file to anybody using the file.

View original on programming.dev
sh.itjust.works

Long time ago, but by far the worst for me was when I inherited some code that a previous programmer had done. Every variable was a breakfast item. So if biscuit>bacon then scrambledeggs=10. Shit like that. It was a nightmare and luckily I only had to deal with it infrequently.

99
CaptDustreply
sh.itjust.works

Why do people do stuff like this, is the logic not difficult enough to follow on it's own without a secondary definition table to consult!? Fucking hell.

54

Had a programmer like this when I was still an apprentice. He was so full of himself. Was originally a Java programmer but had to program in PHP because that was what ran on the server. I never found out why he couldn't just put Java on the server. We had full control.

All his variables were first names. Like $klaus and $grobi. Because he was afraid of clashing with reserved keywords. The thing is, in PHP all variables begin with $ exactly to prevent this issue. So he brought that habit over from Java which was far superior and not such a "Mickey Mouse language".

I mean, he wasn't totally wrong, especially back then PHP was awful. But he surrounded every function with <?php and ?> (PHP was designed to be combined with HTML output outside of these tags) and had plenty of whitespace between them and couldn't fathom why all his html files had huge swaths of whitespace at the start.

His way of preventing SQL injection was to look for SQL keywords in user input and then throwing an error in the log files.

17
vrekreply
programming.dev

I don't know what's worse... That program or that you put biscuits greater than bacon...

Actually I think the greater crime is biscuits being greater than bacon

29
FuglyDuckreply
lemmy.world

but BiscuitTop + Bacon + Eggs + BiscuitBottom is definitely better than biscuit, or bacon or eggs.

12

I don’t know how old you are but when I was in school, this was just going out of style. They saw this as job security. If you’re the only one who can work on the code, then they won’t fire you

21
thelemmy.club

Oh god, that's worse than I've seen where a SQL query joining 10 tables aliased all of the tables as a, b, c, d, e, f, g, h, i, j.

It was a mess, and as a new dev on the project, trying to figure out which where clause was for which table and how things worked was a fucking nightmare. Trying to keep a dictionary of letters to real table names in your head as you looked at the query was very taxing. In the end, I just fixed it all to stop using aliases. Or to use short abbreviations.

Here's a mock example:

SELECT
    j.delivery_eta,
    c.cat_desc,
    a.part_number,
    h.region_label,
    f.wh_loc,
    e.emp_last,
    g.state_flag,
    b.mfg_title,
    i.ship_track_code,
    d.order_sum,
    a.created_on,
    j.last_scanned_at,
    e.emp_first,
    c.cat_code,
    g.state_level
FROM parts AS a
INNER JOIN manufacturers AS b 
    ON a.manufacturers_id = b.id
INNER JOIN categories AS c 
    ON a.categories_id = c.id
INNER JOIN orders AS d 
    ON a.orders_id = d.id
INNER JOIN employees AS e 
    ON d.employees_id = e.id
INNER JOIN warehouses AS f 
    ON a.warehouses_id = f.id
INNER JOIN inv_state AS g 
    ON a.inv_state_id = g.id
INNER JOIN regions AS h 
    ON f.regions_id = h.id
INNER JOIN shipments AS i 
    ON d.shipments_id = i.id
INNER JOIN logistics AS j 
    ON i.logistics_id = j.id
WHERE
    (b.mfg_title LIKE '%Corp%' OR b.mfg_title LIKE '%Global%')
    AND c.cat_desc NOT IN ('Unknown', 'None', 'Legacy')
    AND (d.order_sum > 1000 OR d.order_sum BETWEEN 250 AND 275)
    AND e.emp_last ILIKE '%berg'
    AND (f.wh_loc IN ('A1', 'Z9', 'M3') OR f.wh_loc IS NULL)
    AND g.state_flag IN ('ACT', 'PENDING')
    AND h.region_label NOT LIKE 'EXT-%'
    AND (i.ship_track_code IS NOT NULL AND i.ship_track_code <> '')
    AND (j.delivery_eta < NOW() + INTERVAL '90 days' OR j.last_scanned_at IS NULL)
    AND (a.part_number ~ '^[A-Z0-9]+$' OR a.part_number IS NULL)
    AND (
        (c.cat_code = 'X1' AND g.state_level > 2)
        OR
        (e.emp_first ILIKE 'J%' AND d.orders_id IS NOT NULL)
    );

10

That's how mainframe programmers at my workplace do SQL. I think they do it due to long table and field names and narrow mainframe COBOL files

1
piefed.ca

So, this is completely off topic, but some of the comments here reminded me of it:

An elderly family friend was spending a lot of her time using Photoshop to make whimsy collages and stuff to give as gifts to friends and family.
I discovered that when she wanted to add text to an image, she would type it out in Microsoft Word, print it, scan the printed page, then overlay the resulting image over the background with a 50% opacity.
I showed her the type tool in Photoshop and it blew her mind.

69

I am simultaneously horrified that she didn’t do any research to see if she could insert text into the image and incredibly impressed at her problem solving skills. Honestly, the more I think about it, the more I lean towards impressed; good on her!

30

Haha that's so dumb. She could've just taken a screenshot!

I showed her the type tool in Photoshop and it blew her mind.

Or well. That.

19

Aw really wholesome actually. Some libraries in my area have senior friendly editing classes, I think it's becoming more popular. Good looking out for them!

12
vrekreply
programming.dev

Photoshop is amazing. That said you kinda need to take a course in it to use 80% of the functionality.

9

And almost always, if you are not a professional, that could be done with any image editing program.

6
lemmy.ml

One time, I had to request firewall access for a machine we were deploying to, and they had an Excel sheet to fill in your request. Not great, I figured, but whatever.

Then I asked who to send the Excel file to and they told me to open a pull request against a Git repo.
And then, with full pride, the guy tells me that they have an Ansible script, which reads the Excel files during deployment and rolls out the firewall rules as specified.

In effect, this meant:

  1. Of course, I had specified the values in the wrong format. It was just plaintext fields in that Excel, with no hint as to how to format them.
  2. We did have to go back and forth a few times, because their deployment would fail from the wrong format.
  3. Every time I changed something, they had to check that I'm not giving myself overly broad access. And because it's an Excel, they can't really look at the diff. Every time, they have to open it and then maybe use the Excel version history to know what changed? I have no idea how they actually made that workable.

Yeah, the whole time I was thinking, please just let me edit an Ansible inventory file instead. I get that they have non-technical users, but believe it or not, it does not actually make it simpler, if you expose the same technical fields in a spreadsheet and then still use a pull request workflow and everything...

68
vrekreply
programming.dev

The corporate world runs on excel, never the best option, but everyone knows it so....

25
AtariDumpreply
lemmy.world

Yep; I’ve seen excel files that at like 10MB because it’s a database in Excel

12
inzenreply
lemmy.world

Try a few Gigabytes. I worked on site IT support for a year, we had to max out memory on a workstation because the company database was a, about 3GB, Excel file. It took minutes to open and barely worked, crashing frequently.

21

When I was interning in a cellular biology lab, I took their chemical inventory and converted it from excel to access. Complete with forms and reports. Spent some time training the permanent staff how to use it, explained how it was much more efficient than excel.

I don't think they bought into it, but I tried.

1
sh.itjust.works

I've had legacy systems that would encrypt user passwords, but also save the password confirmation field in plain text. There was a multitenent application that would allow front end clients to query across any table for any tenant, if you knew how to change a header. Oh and an API I discovered that would validate using "contains" for a pre-shared secret key. Basically if the secret key was "azh+37ukg", you could send any single individual character like "z" and it would accept the request.

Shits focked out here, mate.

65
Scrubblesreply
poptalk.scrubbles.tech

Rules I've learned from software engineering for almost 2 decades.

  • Never roll your own ORM
  • Never roll your own Auth

No matter what you think, someone else did it better. Trying to do either of those outside of a hobby environment is pure hubris. "But I can do it better" - no you fucking can't. I have wasted much much more time debugging shitty "home grown" ORM solutions that clearly some dev just was bored and did than I have spent figuring out the quirks of whatever one I'm using. Same goes for auth. Just learn it.

39
TootSweetreply
lemmy.world

Never roll your own ORM

I've done this. Probably 10 years ago. Even today, I maintain the same application that has the ORM in it that I designed. If I could go back in time and do something else, I'd do the same thing again. Honest to god. For my use case, I feel it was warranted. It was risky, but it worked out surprisingly well.

19
Clentreply
lemmy.dbzer0.com

If I could go back in time and do something else, I'd do the same thing again.

So many questions here. What language? What's the database? How many years of experience do you have in industry?

We are the worse evaluators of our own code, some of us are down right terrible but most people regret less significant code choices in a matter of months. The fact that you still think it is good 10 years later is a massive red flag.

4

Java, Postgres mostly but also LDAP and random in-house-written RESTful services, almost 20 years.

  • The objects we store in the Postgres database are very "hierarchical" in nature, with one top-level object and lots of child/grandchild/great-grandchild objects. (We asked for a Mongo database but the infra team at the time said "make do with Postgres.)
  • As I mentioned, some of that hierarchy is in LDAP or RESTful services, not in Postgres, so we needed something capable of dealing with multiple storage backends that would stitch the objects together as necessary. So the "ORM" needed to have backends for multiple backend systems.
  • We knew clients would need a vast number of different queries. So we made a RESTful endpoint that gave the full power of the ORM to (authorized) clients. If they needed different data, we'd be like "change your query like this" and they didn't have to wait on us.
  • Early in the project, we consciously designed an extensible JSON representation of our hierarchical objects. That is what's returned from the aforementioned RESTful endpoint.
  • However, we also created a "shortcuts" system to allow us to "balance" how much of the logic lived on the server vs in the client. (It can mix and match. Like "apply this shortcut, but also filter this way and paginate" or whatever.)
  • We made the API of the ORM such that it could both be used to query from the database/LDAP/RESTful systems, or be used as a client SDK for the aforementioned RESTful query endpoint that the application exposed.
  • It's both "more than an ORM" (querying from non-database sort of backends) and not fully an ORM (read only, doesn't handle schema evolution.) But it's fair to say it's more "an ORM" than "not an ORM".
  • The implementation of the Postgres backend part of it is heavily inspired by Django's ORM.

We couldn't have pressed Hibernate into this use case. It doesn't really deal with hierarchical data and sure as hell doesn't know how to query from LDAP. I don't know that anything existed at the time (nor am I sure anything exists now) that would fulfill our use case.

And the alternative to what we built was a massive, unmaintainable DAO with ridiculous numbers of individual queries in it that would have to be modified or added to endlessly every time someone needed to filter a bit differently or whatever.

7
lemmy.dbzer0.com

The SVP over my org keeps wanting to design his own RBAC/Auth/IAM system.

We have entra, auth0, and keycloak.

The reason he wants it is he doesn’t want secrets to setup auth. Like that’s how it (mostly) works, sunshine.

14

I never fuck with auth. If I can throw it up the stack I'll do it as much as I can. When I can't I find an open source solution and Im sure I still misconfigure it

6

I kinda rolled my own ORM, it was just a glorified class to SQL parameter converter that is then passed onto some SQL code. Then there was a thingy that marshals the result. Using table value functions in SQL standardises the result so any select * just works. It was around 50-100 lines total.

2
vrekreply
programming.dev

I have to ask, if it's only contains wouldn't you get a ton of collisions?

Expecting an apartment manager to know what a api header was nevermind how to change it is probably not likely. Security hole to be sure though.

6
CaptDustreply
sh.itjust.works

The secrets themselves were basically guids, they had quite a lot of characters. If sent MORE than 1 character, pretty low chance they would clash. But those long guids also covered a lot of letters and number - it wasn't terribly difficult to find one single character that cleared authorization reliably.

And maybe you're joking lol, but multitenant meaning multiple businesses/customers using the same application stored in the same database. If Bob's construction wanted to spy on Jim's contracting, they'd just need to know the right header to send and could get whatever they wanted from the other customer partitions. User access should of course be limited to their own assigned partitions.

11

Oh, ok I interpreted multitenant wrong. I was thinking it was like a apartment complex so you have like a manager and a sales person with access and that's it. Still a valid security risk but not as severe as what you are saying now.

Sorry for confusion

4

I once saw an application that would encrypt (not hash, encrypt) passwords but then when a user was logging in, they'd encrypt the password candidate and then compare the cipher texts to see if they were the same. This was using 3des, so no IV.

3
lemmy.sdf.org

Floats for currency in a payments platform.

The system will happily take a transaction for $121.765, and every so often there's a dispute because one report ran it through round() and another through floor().

64

Presumably every so often there's a dispute because 0 + (0.3 + 0.3 + 0.3) - 0.3 - 0.3 - 0.3 is not equal to 0 (in floating point arithmetic).

10

Lmao.

Using floats for nearly anything in a finance platform should be grounds for immediate dismissal.

5

Round is the safest way of using decimals for money as it corrects 10.499999999 (decimal fractions can't be stored precisely in floats as binary can't precisely represent all 2 digit decimals) to 10.50, where floor would take it to 10.49

It is safer to count in cents and have a policy to handle fractions of cents from divisions

1

I found code that calculated a single column in an HTML table. It was “last record created on”.

The algorithm was basically:

foreach account group
  foreach account in each account group
    foreach record in account.records
      if record.date > maxdate
        max = maxdate

It basically loaded every database record (the basic unit of record in this DATA COLLECTION SYSTEM) to find the newest one.

Customers couldn’t understand why the page took a minute to load.

It was easily replaced with a SQL query to get the max and it dropped down to a few ms.

The code was so hilariously stupid I left it commented out in the code so future developers could understand who built what they are maintaining.

62
lemmy.nz

A registration form and backend that would return the error "please choose more unique password" if you choose a password that was already stored (in plain text) in the database against another username.

I shit you not.

54

Create a moderately ok password, hash it, use the hash as your nice unique password, as a private joke for when the database leaks and yours is the only password that's hashed and you start getting spam saying they know your password hunter2 (because they incorrectly dehashed the password) or 2ab96390c7dbe3439de74d0c9b0b1767 (md5 sum of hunter2; because they correctly read it as plain text)

3

I worked for a mid-sized government entity where we handled PII data. Underneath us were local municipalities who were in charge of sending us that PII so that it could be registered at our level. For PII think licenses, IDs, sensitive stuff for sure.

Most of the municipalities were easy to work with, they did an SFTP drop or used a VPN or something.

A couple though were rural. Very rural, and didn't have IT departments. They had Martha who works the counter from 1-4pm. Those places were... horrid. We had a special email where they would email us whatever formats they had. Unencrypted, completely open, we couldn't do anything about it because it was their data and their rules, it was our job to simply accept what they had. We could of course make serious suggestions, point out how horrid this was, but at the end of the day it was their decision. So we had a job to log into an email account every day, check for an email from Martha's hotmail account, and parse the excel file she used to read out private IDs and license numbers which she manually typed into it.

This was 20 years ago now so dear god I hope their laws improved.

47
vrekreply
programming.dev

Maybe this says something about me but I would write a script to get the excel file from the email and then do whatever you did to it.

At what point would it not be financially viable to just a write a program for the entry on your budget and then send it to the rural places?

5
Scrubblesreply
poptalk.scrubbles.tech

above my paygrade that last question. As for the first, we did automatically pull it out of the email, but it was sent to us manually

11
vrekreply
programming.dev

Sorry I used to do gross margin improvement and that just seems ripe for cost cutting. Spend 100K one time, save $75k every year.

Was the email atleast encrypted?

7

Just old style SMTP. That's nearly extinct on the wild internet now

1
lemmy.world

Java webapp. Customer facing. E-commerce application, so in PCI scope and dealt with credit card info and such.

There was one specific cookie that stored some site-wide preference for the customer. (Why not just put that preference in the database associated with the user? Because that would make too much sense is why.)

But the way they encoded the data to go into the cookie? Take the data, use the Java serialization framework (which is like Python's "Pickle" or Go's "Gob") to turn that into a string. But that string has binary data in it and raw binary data is kindof weird to put in a cookie, so you base64 encode the result. (The base64 encoding was the only sane step in the whole process.) Then you do the reverse when you receive the cookie back from the browser. (And no, there was no signature check or anything.)

The thing about the Java serialization framework, though is that decoding back into Java objects runs arbitrary object constructors and such. As in, arbitrary code execution. And there's no checking in the deserialization part of the Java serialization framework until your code tries to cast the object to whatever type you're expecting. And by that point, the arbitrary code execution has already happened. In short, this left a gaping vulnerability that could easily have been used to extremely ill effect, like a payment information breach or some such.

So all a malicious user had to do to run arbitrary code on our application server was serialize something, base64 encode it, and then send it to our servers as a cookie value. (Insert nail biting here.)

When we found out that there was a severe vulnerability, I got the task of closing the hole. But the existing cookies had to continue to be honored. The boss wasn't ok with just not honoring the old cookies and developing a new cookie format that didn't involve the Java serialization framework.

So I went and learned enough about the internal workings of how the Java serialization framework turned a Java value into a binary blob to write custom code that worked for only the subset of the Java serialization format that we absolutely needed for this use case and no more. And my custom code did not allow for arbitrary code execution. It was weird and gross and I made sure to leave a great big comment talking about why we'd do such a thing. But it closed the vulnerability while still honoring all the existing cookies, making it so that customers didn't lose the preference they'd set. I was proud of it, even though it was weird and gross.

The value that was serialized to put into the cookie? A single Java int. Not a big POJO of any sort. Just a single solitary integer. They could just as well have "serialized" it using base-10 rather than using the Java serialization framework plus base64.

43

Some minecraft mods had/have a similar problem. They use javas serialization stuff for sending stuff between client and server. There is mod that partially fixes this by only allowing whitelisted classes to be deserialized.

16
vrekreply
programming.dev

Wow... If you can answer was this like a single company or were you selling the service to other companies?

If selling to multiple companies did you offer a "new" version and a "security patch" for the old or just made everyone use your implementation?

5
TootSweetreply
lemmy.world

This was a developed-in-house e-commerce web application at a major e-retailer. So fortunately that monstrosity of a cookie-handling mess was only ever used by one company.

You know what, though? Talking about this reminds me of another story about the same e-commerce application.

After a customer placed an order on this e-commerce site, the company's fraud department had to evaluate the order to make sure it wasn't fraudulently placed. (As in, with a credit card not owned or authorized for use by the purchaser.) Once that was done, the order had to be communicated to a worker at the warehouse so they could pack the right items into a box, put on a shipping label, and set the box aside to be picked up by the UPS truck which would come once a day near the end of the day.

The application used by the fraud department and the application that displayed new orders to warehouse workers was one and the same application. Whether a user had fraud-evaluating powers or pack-items-in-boxes powers just depended on what permissions their particular user had. (That may have been decided by LDAP groups. I don't remember for sure.)

Meanwhile, the e-commerce site offered gift cards for sale online. The gift card would be shipped to the customer. And there was a box where you could write a message associated with the gift card. So, for instance, someone could buy a gift card to be sent to their nephew's address or whatever and include a little note like "Happy Birthday. Don't spend it all at once." or whatever. And the fraud/pick-and-pack application would display all details of the order including any messages associated with the gift cards.

Well, I found a stored cross-site scripting vulnerability where if you put <script>...</script> tags with some JavaScript in the gift card message box and completed the order, the JavaScript would execute any time someone viewed the details page for the order in the fraud/pick-and-pack application. And of course, the JavaScript could do within that application just about anything the user could do with their given permissions.

The main danger was that a malicious actor with sufficient knowledge of how our fraud application worked could place an order fraudulently with someone else's credit card and include in the order a gift card with a malicious JavaScript payload in the message box, and then that malicious JavaScript could automatically mark the order "a-ok, no fraud here" when a fraud department worker loaded the order details page, letting the order be fulfilled without any actual fraud review.

The fix was pretty simple. Just stick a <c:out>...</c:out> in the appropriate place in the fraud/pick-and-pack application code. But it was an interesting example of a vulnerability in a not-customer-facing application that could none-the-less be exploited by any public customer/user without any particular special access.

If you're interested in one more interesting story about the same e-commerce application, see this comment I made a while ago.

22

That is interesting, I dealt with purely internal software so never considered that.

5
lemmy.ca

A program that HR had built so that all employees could they their payment receipts online

The username was the companies' email address, the password was a government personal id code that you can lookup online, a don't change, and you can't update the password to something else.

So I told the director of HR this was a bad idea. She told me I was overreacting until I showed her her own receipt, then she finally understood that this is a really fucking bad idea.

Okay, so now she out me in charge of debugging that program.

So I setup a meeting with the director of the company they hired, he came by with the developer: a 21 yo girl who I think hadn't finished college yet. Great start! Apparently it was her idea to do the authentication like that so that explains a few things.

So we dive in to the code.

First of all, the "passwords" were stored in blank, no hashing, no encryption, nothing. That wasn't the worst.

For the authentication she made a single query to check if the user email existed. Of that was true, then step two was a second query to see if the password existed. If that were true, the email had been authenticated.

So let's say, hypothetically, that they had actual passwords that people could change... I could still login with the email from anyone, and then use MY OWN password to authenticate.

This just blew my mind so hard that I don't think I ever fully recovered, I still need treatment. The stupidity hurts

43
groetreply
feddit.org

I wouldnt blame that on stupidity as much as on ignorance and naivety. Many people simply don't think about anybody deliberately misusing their design. The idea that somebody could even want to access somebody elses receipts didn't occur to them. And if they were still doing their studies they might not have known that you can "combine" SQL queries and ask for two things at once.

I don't blame the girl, but whoever chose her to design a system with sensitive information.

20
Phoenixzreply
lemmy.ca

I don't blame a girl for doing a job that lands her food on the table. I blame the guy employing her because she's the cheapest option

Having said that, this design was so bad that she should not have been doing any of this. If you don't know that SQL allows you to select multiple columns then by all means, do a tutorial, it's not that hard.

If you don't even know what encryption is, that passwords need hashing and what not, then you should really question what you're doing

OPs question was about the worst code I've seen, that was the worst I've seen

4
sh.itjust.works

If you don’t even know what encryption is, that passwords need hashing and what not, then you should really question what you’re doing

I agree with your point, but I would phrase it more generally: when we're assigned a task in a problem space we are unfamiliar with, we should always take some time to research that space before designing our solution.

After all, if we don't know what encryption or password hashing are, how could we know that we need to learn about them first? But spending just a couple hours one morning reading about password and authentication management would have given the developer a good sense of best practices.

So she either, A) didn't think to familiarize herself with a new topic prior to working on it, or B) did read about it and ignored general industry guidance. Both of those options are more problematic to me than simply not knowing specific things. Those are process problems that need to be addressed to build her skills as a developer.

But ultimately, in my opinion, this is really all the fault of the cheapass director who didn't want to pay any experienced professionals to handle the task.

1

It wouldn't take much google-fu to get a worked example of good authentication in whatever language. She can't have tried, she must have just gone "programming 104 covered how to SQL, I can use that"

1
lemmy.zip

First of all, lack of ORM isn’t bad. It’s not a good or bad thing to use them out not use them. What’s bad is not sanitizing your query inputs and you don’t need an ORM to do that.

I think the worst thing I’ve seen is previous devs not realize there’s a cost to opening a DB connection. Especially back when DBs were on spinning rust. So the report page that ran one query to get the all the items to report on, then for each row ran another individual query to get that row’s details was probably one of the slowest reports I’ve ever seen. Every DB round trip was at minimum 0.1 seconds just to open the connection, run the query, send back the data, then close the connection. So 10 rows per second could be returned. Thousands of rows per page has people waiting several minutes, and tying up our app server. A quick refactor to run 2 queries instead of hundreds to thousands and I was a hero for 10 min till everyone forgot how bad it was before I fixed it.

36

It's the round trips that kill you.

Oracle drivers for .NET are fun. Have a user client application which uses quite a lot of data, but a few thousand rows are fetched some queries. It's way too slow for any larger query, turns out for the batch query kind of work we do, the default FetchSize for Oracle is just a performance killer. Just throw it to 128 MB and it doesn't really hurt at all.

Worst thing i've seen though, apart from the 150 line long dynamic sql stored in our database, was probably a page in our program that loaded about 150 rows from the database. Normally we do create a new connection for each query, but it's fine since Oracle has a connection pool. Whatever millisecond is trumped by the round trip. But imagine a UI so badly written, it did 4 separate database queries for EACH row it loaded into the UI list. Useless things like fetching a new ID for this row in case it is changed, reading some data for the row i think, and more. Thing took a solid minute to load. There was so many bad patterns in that page that even during the PR for improving the speed it was just dealing with a mess because you couldn't just rewrite the entire thing, so they had to make it work within the constraints. Horrible thing to work with.

6

Our CFO's social security number, contact info, and just about everything you'd need to impersonate them inside a random shell script that was being passed around like drugs at a party for anyone to use. Oh and it had an API key to our payments processor hard coded into it.

That was the tip of the iceberg of how bad the systems were at the company. All of these are from the same company:

  • A fintech based company with no billing team
  • An event system that didn't event
  • A permissions system that didn't administer permissions
  • A local cache for authentication sessions. Which means that requests would intermittently fail auth because the session was only on one replica. If you hit any of the other ones, you'd get an unauthenticated error
  • A metrics collection system that silently lost 90% of it's data
  • Constant outages due to poorly designed and implemented systems (and lack of metrics... hmmm)
  • Everything when I joined was a single gigantic monolith that was so poorly implemented they had to run at least 3 different versions of it in different modes to serve different use cases (why the fuck did you make it a monolith then?!)
  • The subscriptions system was something like 20 or 30 database tables. And they were polymorphic. No one could touch the system without it breaking or that person declaring failure, which leads me to ...
  • A database schema with over 350 tables, many of which were join tables that should have been on the original table (fuck you scala/java for the limitations to the number of fields you can have in a case class). Yes you read that right. Table A joined to table B just to fill in some extra data that was 1:1 with table A. Repeat that a few dozen times
  • History tables. Not separate from the original table, but a table that contained the entire history of a given piece of data. The worst example was with those extraneous join tables I just mentioned. If you went and changed a toggle from true to false to true to false, you'd have 4 records in the same table. One for each of those small changes. You'd have to constantly try to figure out what the 'latest' version of the data was. Now try joining 5 tables together, all of them in this pattern.
  • Scala... I could go on a tirade about how bad scala is but needless to say, how many different error handling mechanisms are there? Scala decided to mix all of them together in a blender and use them all together. Scala is just two white paper languages in a trenchcoat. Never use it in a production system
  • A dashboard for "specialists" that was so easy to overwhelm that you could do it by breathing on it due to the LACK of events that it needed
  • Passwords stored in plain text (admittedly this was in the systems of the company we acquired while I was there). Doesn't matter if they were actually , they were visible in a dashboard accessible by employees. Might as well have been plain text
  • A payments system that leaked it's state into a huge part of the rest of the system. The system ended up being bifurcated across two systems, I was brought in to try to clean up some of the mess after only a couple of months. I desperately tried to get some help because I couldn't do it solo. They ended up giving me the worst engineer I've ever worked with in my 15 year career, and I've seen some bad engineers. Looking back, I'm reasonably confident he was shoving our codebase into an AI system (before it was approved/secured, so who knows who had access) and not capable of making changes himself. I could make several posts about this system on its own
  • I could go on but I'll cut it off there
33

I was told about a bug in a specific tool. It was being used in production. Apparently we've gotten a lot of complaints about it over the years, and they would complain if the site was actively used it always failed.

I couldn't find it in the development branch in source control.

I asked if this tool was purchased from a third party. My boss, who was not a developer, said no. And he was very sure of that. But he didn't know where the code was.

I was the developer with the most seniority, and I was there for less than a year at this point.

I looked again. I finally found it... In an unapproved pull request from a few years prior.

The meat of this tool basically took information to make an order and create an order in the system.

Any time we needed to insert a record, it would find the highest Id in the table, increment 1, and insert the new record, id and all. It did this for every entity that needed to be inserted. Address, customer... Everything.

Worse, very little validation was done. Want to order something but it's out of stock? No problem, this tool just pushed it right through.

Want to ship something using a shipping method that doesn't exist? You got it.

Want to ship something to an address that doesn't exist? Sounds like the warehouse's problem.

Knowing about the level of knowledge here, you know that there were no transactions. All sorts of unused records were left in the database when there was an error. The users would get a generic error and try again several times, too.

The worst part was, we have an already existing function that would take order information and try to make an order. And it would give you actionable errors!

31

This reminds me of a time at work when we got sued. The company was allegedly using (or had copies) of some tool we couldn't have anymore. Annoying, but fine. However, to check this, they scanned all of our computers for the name of that company. They told us all to delete our entire local Maven repository. Someone who worked there was on the commiter list for a couple of open source projects. I just manually deleted those files because I knew for a fact that our central Maven repository didn't have some of the versions of our own code on it and I wasn't confident we wouldn't need them again. Turns out I was right and needed to grab one later on to upload. Because I manually deleted the files with the company's name instead of just deleting everything, the scanner thing they were running didn't detect offending files. (Not that a file listing someone's email address as a commiter to an open source project should be offending, but still.)

8

Oh boy, this one was a doozy...

Was working at a very big company named after a rainforest on smart home products with integrations for a certain home assistant...

New feature was being built that integrates the aforementioned home assistant with customer's printers so they can ask the assistant to print stuff for them.

The initial design lands from our partner team with a Java backend service fairly nicely integrated with some CUPS libraries for generating the final document to be sent to the customer's printer. All good.

They are about to launch when... uh oh... the legal team notices an AGPL licensed package in one of the CUPS library's dependencies that was absolutely required for the document format needed by the project and the launch is cancelled.

So the team goes off in a panic looking for alternatives to this library and can't find any replacements. After a month or two they come back with their solution...

Instead of converting the document directly in the backend service with the linked CUPS library (as AGPL is a "forbidden license" at this company) the backend uploads the initial document to an S3 bucket, then builds a CUPS document conversion bash shell script using some random Java library, the shell script is then sent (raw) to a random blank AWS host that comes prepackaged with CUPS binaries installed (these hosts were not automated with CI/CD / auto updates as was usually mandated by company practice because updating them might remove the CUPS binaries, so they required a ton of manual maintenance over the service's lifetime...), the bash shell script is then executed on that "clean" host, downloading the document from S3, converting it via the CUPS command line binary, then reuploading it to another S3 bucket where the Java backend picks it up and continues the process of working the document through the whole backend pipeline of various services until it got to the customer's printer.

This seemed to satisfy the legal team at the very least, and I have no doubt is probably still in production today...

The kicker though? After all those months of dev work from a whole team (likely all on 6 figure salaries), and all the time spent by various engineers including myself on maintenance and upkeep on that solution after it was transferred to us?

An alternative, completely unrestricted corporate license was available for the package in question for about $100 per year so long as you negotiated it with the maintainers.

But that was a completely unacceptable and avoidable cost according to upper management...

31
vrekreply
programming.dev

Wait 100 per year total or 100 per seat per year? If it's per seat I can understand, if it's total wtf...

6
softkittehreply
lemmy.blahaj.zone

$100 total, per year... as a FOSS enthusiast, it made me very angry that such a rich company was so petty over such a small cost for a product that raked in multiple millions of dollars per year 😾

19
vrekreply
programming.dev

Yeah that's fucked up. From two perspectives 1. Who ever wrote that library needs money to survive. 2. From the company point of view they wasted WAY more money on the development then the license. Hell if 1 developer spent a day to do it, they paid more than they would for the license

12

The first time something goes wrong with that complicated setup, it probably pays for a decade half a century or more of it's fee.

6

I wonder if they would have bought it had the dev priced it at $10k/year

1
ttrpg.network

There was a website where users could request something or other, like a PDF report. Users had a limited number of tokens per month.

The client would make a call to the backend and say how many tokens it was spending. The backend would then update their total, make the PDF, and send it.

Except this is stupid. First of all, if you told it you were spending -1 tokens, it would happily accept this and give you a free token along with your report.

Second of all, why is the client sending that at all? The client should just ask and the backend should figure out if they have enough credit or not.

30

I agree but I would say if there are variable token costs depending on report it would be nice if client sent request to server, server calculates x tokens to be used, sends x to client, client confirms that's acceptable, server does work.

Like if I expected a report to be 2 tokens but because of some quirk or a typo or something it cost 200 tokens I would like a chance to cancel it if it's not worth it.

12
fedia.io

I basically fix other people shitty voice for a living (replacing it with my own shitty code), the "best" one was by a guy, I suppose he was a self taught c programmer from how he wrote code, writing a complex python program. I saw:

  • a function called randomNumberGenerator. It was a function which started a webserver. While looking for a python tutorial for something I found out why: he copy pasted the tutorial snippet but then didn't bother renaming the function
  • a program whose job was to listen to all other services and send them to another service via udp BUT it had a maximum buffer size so messages sometimes got truncated. I just directly put the listener in the target program and deleted it
  • like another guy in this thread he didn't use git. First day on the job they told me "yes, we need to check which machine has the latest code because he ssh into them and work there". His version control was basically putting code in different machines
  • lot of copied variables, because of c I suppose? Things like var = self.var
  • camelCase python (ok this is just styling in the end)
  • files with 10k lines of code
  • half the services were in python 2, half in python 3. Don't ask me why
  • variables name in his original language (not English, not the client language)
  • single letter variables, I fondly remember self.I (upper case i)
  • I remember an if a == a: (I left it there because lol)
  • he added a license check which used the ethernet mac address. Too bad ethernet was removed from the machine, and his code launched an exception which returned 00:00:00:00 as mac address, so all licenses were working on all machines

And many other things...

In another project I saw a backend running on the frontend, as in, this guy wrote the logic for a machine on the Javascript running the user interface of the screen

29
felbanereply
lemmy.world

files with 10k lines of code

oh my sweet summer child.

I was once charged with maintaining an application with a median line count of 40k. The largest file was 87kLOC with 2nd place going to a 69kLOC (nice) file filled with interwoven C and inline assembly. My favorite was a 51kLOC file with a 32,621 line function.

Miracle I didn't develop alcoholism during that job.

5

Pretty sure there was one over 100k file at one of my old workplaces. It kept growing and growing and was the most critical file in the business. Like if that file suddenly vanished, the business would be done or shut down for at least a year, maybe two kinda thing. Re-certifying the output of that file would probably take 6 months alone.

It had a partner file, also very important, but not as, which was much smaller around 20k-25k

4

I remember an if a == a: (I left it there because lol)

I once worked on a codebase in js where

a == a // true
a == a // false
a == a // true

(Same variable compar to itself is true at first, then false, then true...)

And when I cried 'per que' the explanation made some evil, sadistic sense.

3
lemmy.world

XML-DOM page templates stored in a database, line by line.

So rendering a page started with:

select * from pages

where page_id = 'index'

order by line_number asc;

Each line of XML from each record was appended into a single string. This string was then XSLT transformed to HTML, for every page load.

27
lemmy.world

This has to be one of the worst ways to reinvent a filesystem that I've ever heard. At the very least, storing static data in an relational database at this scale should be a slappable offense.

12
quinkinreply
lemmy.world

The session data, that would have been fantastic to have in a relational, queryable, reliable and trustable format was stored as a single giant string of PHP pickled data structure in a session file associated with the users cookie id.

10
lemmy.world

The architect sending a pointer over an API, in hexadecimal string format. char *c = "71E4F33B" just cast it on the right structure bro.

Just to add, we only did C/C++, on windows mfc, in a monolithic software.

I spent quite some time assuring myself that I was not the insane person before bringing it up with him.

25
groetreply
feddit.org

A memory pointer? So it must have been a program sending a pointer using an API to itself so it ends up in the same process again?

6
wer2reply
lemmy.zip

Mine was very much like that, but they also deleted the pointer after sending it, but before receiving it for good measure.

2

Disclaimer: this is not really about code, but about using IT in my non-IT workplace and I realized this just yesterday. A rant.

I work in the social sector. Our boss seems to have slipped into position sideways (they did not do our work for a significant amount of time before).

I got zero onboarding when I started working there; everything I know about the organisational ins and outs I learned by asking my colleagues.

The boss seems to actively want to not inform me of things, i.e. even if I ask about something they reply in the most cursory manner or immediately refer me to somebody else. I have no idea why they do it, my guess is that they sense that they're woefully inadequate for the job, plus me being much older triggers insecurities?

For example, when I could not log into an app to see my future shifts, I asked the boss about it first but they immediately refered me to tech support. Calling them, after a while we found out that the boss had mistyped my name. Then I could log in.

Last week I was sick and waited til Sunday noon to check this week's shifts - but again I couldn't log in. The boss answered neither phone nor email. Fair enough I guess, on a sunday. Thankfully tech support was working and after a long while we found out that the app for checking my shifts only allows log-ins from within the workplace network, not the open web.

I almost missed my monday shift because of that. Boss calls me, enraged. I explained the situation. They clearly did not know that the app only allows log-ins from within the workplace network.

All my coleagues tentatively/silently agree that this boss is useless. How do we keep the workplace running, and why is it me who is left in the dark? Turns out they have a Whatsapp group. I don't use Whatsapp. They asked me repeatedly and urgently to join.

tl;dr: this workplace would fall apart if people wouldn't communicate through Whatsapp instead of official channels

24

I don't have any specific examples, but the standard of code is really bad in science. I don't mean this in an overly judgemental way — I am not surprised that scientists who have minimal code specific education end up with the kind of "eh, close enough" stuff that you see in personal projects. It is unfortunate how it leads to code being even less intelligible on average, which makes collaboration harder, even if the code is released open source.

I see a lot of teams basically reinventing the wheel. For example, 3D protein structures in the Protein Database (pdb) don't have hydrogens on them. This is partly because that'll depend a heckton on the pH of the environment that the protein is. Aspartic acid, for example, is an amino acid where its variable side chain (different for each amino acid) is CH2COOH in acidic conditions, but CH2COO- in basic conditions. Because it's so relative to both the protein and the protein's environment, you tend to get research groups just bashing together some simple code to add hydrogens back on depending on what they're studying. This can lead to silly mistakes and shabby code in general though.

I can't be too mad about it though. After all, wanting to learn how to be better at this stuff and to understand what was best practice caused me to go out and learn this stuff properly (or attempt to). Amongst programmers, I'm still more biochemist than programmer, but amongst my fellow scientists, I'm more programmer than biochemist. It's a weird, liminal existence, but I sort of dig it.

23

A data ingestion service that was processing ~15 billion logs each day that was duplicating each of those logs 2-4 times in memory as a part of the filtering logic. No particular reason nor need to do it. When I profiled the system it was BY FAR the largest hog of CPU and memory.

The engineer who wrote it once argued with me about writing comparisons a == b vs b == a because one was technically more efficient ... in a language we weren't using.

22

VB.NET app that was installed on every employees computer to capture time sheets. Required VPN access so it could talk to the accounting DB using raw queries, zero input validation, and it used a pirated library for the time input grid control.

The IT staff who would install the program on all new machines (it didn't work with their imaging system) had a script to suppress the message requesting a paid license. There was nothing special about this control, it was basically a rip off of built in winforms controls.

Source code was long lost, but reverse engineering and decompiling CIL/MSIL code is thankfully relatively straightforward.

20

I once saw an 'encryption' function where the key had a range of 32. Not 32 bits. I mean there were 32 different keys. And it was prepended as the first byte in the stream, so the decryption function didn't have to go out of the way to find it.

Thankfully I noticed that it got torn out and replaced with real encryption at some point.

19

I'll consider myself lucky that the worst I've had to deal with was a 8K LOC C file that implemented image processing for a cancer detection algorithm. Nothing terribly tricky but just poorly organized. Almost no documentation at all. The only test was running this code against a data set of patient images and eyeballing the output. No version control other than cloning the project onto their NAS and naming it "v2" etc.

Research code can be really scary.

19
Cavemanreply
lemmy.world

At my job there's a class method that's longer than that.

4

My current workmate unironically calls his variables as "cat1", "cat2", etc.

He also didn't knew about git, so before I arrived, he uploaded the code to production with scp.

Finally, my boss told me that he is priority, so if he doesn't underestand git, we won't keep using it. I would underestand if this was about a different language, but it's git vs scp we're talking about.

18

It was a single PHP file containing upper tens of thousands of lines of code (i.e. probably 60k+ but I no longer recall the exact amount). And the horrors didn't stop there. Function names and code formatting were haphazard, some functions were descriptive enough to be helpful(ish) like check_if_first_friday_of_month() but most were literally along the lines of function12() with no comments to indicate the purpose. A̸n̶d̷ ̴t̵h̵e̵ ̸h̷o̵r̶r̸o̷r̵s̸ ̸d̷i̸d̵n̷'̷t̶ ̵s̶t̴o̸p̸ ̷t̵h̶e̶r̵e̶.̴ This application was storing sensitive personal information in the database in plain text. And the horrors didn't stop there.

Congrats to the developer, though. This project was the one that finally got him fired and he immediately pivoted into a management position at a big tech company (don't recall which but it might've been Microsoft or IBM) making an order of magnitude more money.

18
lemmy.world

We had some super old code in our company monorepo that was written by someone who became the CTO, there was a comment forbidding people from writing private methods in the code base because "we aren't babies". It explained so much about the awful code and why everything was crazy.

18
vrekreply
programming.dev

That sounds like someone who didn't understand the purpose of private

11
lemmy.world

Yet he was still in charge of all the engineers who did. He had people actively working against their best interests lol. Disaster

6
exprreply
programming.dev

Access modifiers are definitely something I despise about OOP languages, though I understand that OOP's nature makes them necessary.

3

I don't think OOP's nature makes them necessary, so much so as it enables them and popular programming principles encourage them. I think they're a good thing, especially if there's a way around them in case you can't get the public interface changed and it doesn't work for you, especially for performance reasons, but that should be done with care.

Funny story, when modding Unity games using external modloaders you're writing C# code that references the game's assemblies. And with modding you often need to access something that the developers made private/protected/internal. Now, you can use reflection for that, but a different trick you can use is to publicize the game's assemblies for referencing in your code, and add an attribute to your assembly that tells the runtime to just... Let you ignore the access checks. And then you can just access everything as public.

2
lemmy.zip

Another kind of "code" but:

The poll in a excel sheet the office sent via email. You had to fill it out and send it back, so they could type it off in another excel sheet.

That's where i realized that people have fundamentally different approaches in thinking and problem-solving.

18
KubeRootreply
discuss.tchncs.de

Am I getting it correctly that the excel sheet was basically a form to fill in, with fields and labels, but as a spreadsheet? If so, that sounds pretty clever to me - there're many better ways to do this, but if everybody working there has excel anyways, that's a fast and easy way to get the data in a unified and automatable format without any extra infrastructure.

1
lemmy.zip

Nope. Like "what to get for the company party? A, B or C".

Workflow: open excel sheet to know what it is about, save it, edit it, drag&drop it to the answer-mail. That could have been one of the zilions of online polling tools.

1

If it was a single question, that does sound lame, my other thought was that those "online polling tools" might not be viable because you can't put internal company communications into them... But if it's stuff like food choices or something, then that might also not be a problem.

That said, my point still stands - what you describe does sound like what I'm saying. If you make a sheet with a dedicated field to put the answer into, it should be possible to reliably automate pulling out answers from all the files with excel-level knowledge, and without any additional sites or servers, just spreadsheet editing software and email.

1
lemmy.blahaj.zone

A bit of Perl code from the late 90s/early 2000s that worked something like this (working from memory, untested):

my $hits = `grep $search_string $file`;
my @lines = split /\n/, $hits;
my @real_hits;
for( my $i = 0; $i < scalar(@lines); $i++ ) {
    my $line = $lines[0];
    if( $line =~ /$search_string/ ) {
        push @real_hits, $line;
    }
}

Let me explain a bit about what this does. Instead of reading a file line-by-line and using Perl's regex engine to match, it uses backticks to call out to the shell for grep. Those are split up by line. Then go through those lines (in a C-style for loop, not the perfectly good foreach version that Perl has had for a long time) and now we use a regex to match that line. You know, just in case shell grep didn't do its one job.

If anything, I'm probably making this code look better by declaring variables with my and following use strict standards.

This was written by a guy who was the main programmer before I was hired. I was told he was a real piece of shit. He often had some checks in his code that, if not passed, threw messages to the client like "WE HAVE DETECTED YOUR HACKING AND LOGGED YOUR IP ADDRESS WE'RE GOING TO GET YOU". Never met him personally, but his code is a pretty good example of why everyone came to hate Perl.

17

There may be more than one way to do it, but that really isn't the best way of doing what perl is best at

1
lemmy.world

I spoke with a client just last week, international scale, that let me know their user passwords are simply encoded and stored in Base64 haha

17

Are they speaking to you to improve it? Or like that's just how they do it so account for it in what you are doing?

8

Based on things I've seen I can actually believe this is real. Just goes to show that you can't trust everyone to have a functional intuition for separating horrible ideas from good ones.

2

First One:

Big ASP.Net Core Web API that passed through several different contract developer teams before being finally brought in house.

The first team created this janky repository pattern on top of Entity Framework Core. Why? I have no idea. My guess is that they just didn't know how to use it even though it's a reasonably well documented ORM.

The next team abandoned EFCore entirely, switched to Dapper, left the old stuff in place, and managed to cram 80% of the new business logic into stored procedures. There were things being done in sprocs that had absolutely no business being done there, much less being offloaded to the database.

By the time it got to me, the data layer was a nightmarish disaster of unecesary repo classes, duplicates entities, and untestable SQL procedures, some of which were hundreds of lines long.

"Why are all our queries running so slow?"

We'll see guys, it's like this. When your shoving a bunch of telemetry into a stored procedure to run calculations on it, and none of that data is even stored in this database, it's going to consume resources on the database server, thereby slowing down all the other queries running on it.

Second One:

Web app that generates PDF reports. Problem was it generated them on-the-fly, every time the PDF was requested instead of generating it once and storing it in blob storage and it was sllloowwwww. 30 seconds to generate a 5 page document. There were a list of poor decisions that led to that, but I digress.

Product owner wants the PDF's to be publicly available to users can share links to them. One of the other teams implements the feature and it's slated for release. One day, my curiosity gets the best of me and I wonder, "what happens if I send a bunch of document requests at once?" I made it to 20 before the application ground to a halt.

I send a quick write up to the scrum Master who schedules a meeting to go over my findings. All the managers keep trying to blow it off like it's not a big deal cause "who would do something like that?" Meanwhile, I'm trying to explain to them that it's not even malicious actors that we have to be concerned about. Literally 20 users can't request reports at the same time without crashing the app. That's a big problem.

They never did fix it properly. Ended up killing the product off which was fine because it was a pile of garbage.

16
vrekreply
programming.dev

I think this is the problem with legacy code. It's not that it's old but that 35 people each with their own coding standards and practices.

5

One of my old bosses used to say, "the choice is often not between right and wrong, but good, better, and best."

I agree with that sentiment for the most part. Different styles is fine. But sometimes you run into someone who is trying to use a socket wrench to drive nails and all you can do is just kind of watch in amazement and wonder how they arrived at the conclusion that this was the way to go.

6

I would go for "garbage, bad and ok" where bad is acceptable. Most styles are ok, a lot of anti-patterns are bad but still get the job done but sometimes people write pure garbage. I'm very happy that at my job we just have a lot of bad code that's workable but this one contractor wrote an absolute piece of shit. His code was a convoluted side-effect mess that was "reactive" and at around 3-5x more verbose than the "naive" solution. He made so many decisions that increased complexity and overhead that it become a rigid buggy mess.

Sometimes people just need to stick to the basics by using a database layer and a service layer on the backend and a API layer and component code on the front.

5

And all it takes is for one of those folks to be motivated and stupid to really muck things up.

1
slrpnk.net
  1. Take from index 10 of the buffer, AND it with some hard-coded hex value.

  2. Bit shift it by a hard-coded amount of 2

  3. Do the first two steps, but with a different hard-coded index, hex value, and bit shift.

  4. OR the two results.

  5. Shove the result back into a buffer.

All of this is one line with no commenting or references to what the fuck this process comes from or why it is applicable. Then there was a second copy of the line, but with different hard-coded values.

16
// Here be dragons
// Call Darren before changing
// Darren quit 2 years ago good luck 
//         - PJ 2015
18
vrekreply
programming.dev

Ok that is truly horrid...

Can you say what the point of it actually was?

7

Nope. It was buried 300 lines into a 600 line C function.

The cherry on top was that testing at this place was all manually done on the hardware. And the "unit testing" comprised of making one off tests to prove line coverage, then throwing out the unit tests because the IDE we were using would have an aneurysm if it tried to open up existing unit tests.

I was the poor fuck tasked with writing throw away "unit testing" code for that bastard of a function. All of it was probably written before I was born.

5

For anyone who knows and understands Android development, process death, and saved state...

The previous dev had no understanding of any of it, and had null checks with returns or bypassing important logic littered all over the app, everywhere.

I could only assume he didn't understand how all these things were randomly null or why it was crashing all the time so he thought oh, i'll just put a check in.

Well, you minimize that app for a little bit, reopen it, and every screen was fucked visually and unusable, or would outright crash. It was everywhere. This was before Google introduced things like view models which helped but even then for awhile weren't a full solution to the problem.

It was many many months of just resolving these problems and rewriting it the correct way to not have these problems.

16
Kazumarareply
discuss.tchncs.de

Oh I remember. There are tons of events and associated handlers. Even just switching to landscape view stops and restarts an android view I think. Friends at uni handled that problem by disallowing landscape view instead of handling it hahah

10

Friends at uni handled that problem by disallowing landscape view instead of handling it hahah

😭

Such a tragic and common 'solution' because it doesn't actually solve it, it just delays it until someones minimizes the app for 30 minutes and re opens it, or one of the many many other ways that also trigger it.

I've had some apps that I do lock to portrait, but I would disable that flag on debug builds, since rotating the phone was the easiest way to test for some of those bugs. I didn't worry about a good looking UI since it'd be locked in portrait, I just used it to test for bugs.

6
lemmy.ml

Here is my story:

There were console outputs after nearly every line. I asked about them: "Oh, I couldn't get the debugger to work, so I print everything to the console"

This was everywhere. The whole program was like this. On a standard Linux machine. It wasn't even remote debugging or something. Just a local C++ program.

The filenames where written in 8+3. Again, on a modern Linux machine. His answer? "You never know where we'll port this software to"

Onto computers that were outdated decades ago? To embedded systems? Of course he had no answer for this except "just in case..."

I could tell you more, that software was the stuff for nightmares.

15
vrekreply
programming.dev

Was he trying to use a ide or like vim/clang/gdb for debugging before giving up?

4

He didn't use an IDE, but I don't remember what he tried. He also wasn't a fan of googling stuff. Use the man pages and nothing else.

2

Of course he had no answer for this except "just in case..."

Never in my career have I seen this argument come to fruition as valid.

4
lemmy.world

At a small company I used to work for we agreed to take over the management system for someone trading physical resources. The guy that originally wrote it was self taught. We did a hand over with him where he took us through the code base. It was written in dotnet but it was a huge mess, he had blended multiple different dotnet paradigms, there was mixed business and UI code all over the place, large chunks of html were stored in the db, db code was just scattered through the application. We took it over briefly but it was a nightmare to work on and we found a SQL injection vulnerability. So as kindly as possible we told the client that his software was a piece of shit and the dev he hired had no idea what he was doing.

15
vrekreply
programming.dev

What was the final result? Did you cancel the contract or re-write the whole thing?

7

We finished working on what we had already agreed to do and then cancelled the contract, the client was quite understanding.

1
sh.itjust.works

There was something like

# sleep for about a second on modern processors
math.factorial(10000)

After it was found we left it in the code but commented out along with a sleep(1) for posterity.

14

In the readme: if you want this program to be usable, press the turbo button until the turbo light is OFF.

3

I saw one where the program ran a busy loop on startup to calculate how long it took. Then it used that as an iterations-to-seconds conversion for busy loops between scheduled actions.

2

It was a huge codebase in c# with a single file in VB.net with a comment at the top "copied from codinghorrors.com/…". I never dared to try understanding what that file was supposed to do and why nobody bothered converting it in c#

14

So this is not as bad as some of the other stories I've seen, but I'll bite.

It was an old .NET Framework MVC app. Some internal product management system or something. There was a need to do a PDF export in one of the use cases, so someone implemented it. It wasn't a good implementation: one big controller, mixing UI and business logic, etc. However, it basically came down to a single private method in a specific controller for a page.

Now time passes and lo and behold, we need a PDF export in another page for a different use case. "No problem," - same dev, probably - "I already solved this problem. I'll just reuse the PDF generation logic."
Now, any sane person would probably try to refactor the code responsible for PDF stuff into a separate service (class) and reuse it. A less sane, but somewhat, acceptable approach would have been to just copy paste the thing into another controller and call it a day.

Ha! No no no no no no… Copy pasting is bad, code should be reused…

The end solution: REFLECTION. So the dev decided that the easiest way to make it work was to: 1) use reflection to inject one controller into another; 2) then use reflection again to get access and call that private method for PDF rendering into a stream.


Fortunately I didn't have to fix that fragile mess. But I did my fair share of DevExpress corpse hacking and horrible angular "server side rendering" workarounds.

14

I think the worst software-gore I remember seeing was a web app that dumped all the data to the browser as a huge XML file and then had JavaScript translate the contents of the xml into views. That probably wouldn’t even sound that far off the reservation now if it was JSON, thanks to the sleepless efforts of the JavaScript industrial complex, but back then you’d just render pages and return them.

14

Oh, I've seen some doozies... The one I remember the most, and I've seen this twice, is this:

myClass.TheProperty = myClass.TheProperty;

When I asked about it, the developer said that, well yes, because it reads from one place and sets in another! Not at all difficult to read!

13
piefed.world

I wrote an algorithm that should be recursive but in expediency I wrote a loop that iterates 10 times.

It's fine but I'm still mad 3 weeks later

13
sh.itjust.works

Good chance that's more performant though, compilers can flatten for loops and you don't have to waste as much time creating new stack frames each time you recurse

6

It might, I'm mostly mad because it seems like a classic recursion problem. Build a graph of nested references.

1

I had to rewrite an iterative implementation I made for an exercise in school because the solution they prepared used recursion. I'm still mad about that. Admittedly the recursive solution was a tiny bit more elegant, but my solution worked too!

2

This might require a bit of background knowledge about Power Query in Excel and Power BI, specifically the concept Query Folding.

Power Query is a tool to define and run queries against a host of data sources and spit out tabular data for use in Excel (as tables) or Power BI (as Tabular Data Model). The selling point of it is the low-code graphical presentation: You transform the data by adding steps to the query, mostly through the menu ribbon. Change a column type? Click the column header > Data Type > select the new type. Perform a join? Click "Merge Queries", select the second query, select the respective key column(s) to join on and thr join type – no typing needed. You get a nested table column you can then select which columns to expand or aggregate from.

Each step provides you with a preview of the results, and you can look at, edit, delete or insert earlier steps at will. You can also edit individual steps or the whole query through a code editor, but the appeal is obviously that even non-programmers can use it without needing to code.

Of course, it's most efficient to have SQL transformations done by the database server already. Bur Power Query can do that too: "Query Folding" is the feature that automatically turns a sequence of Power Query steps into native SQL. A sequence like "Source, Select Columns, Filter Rows, Rename Columns" will quite neatly be converted into the SQL equivalent you'd expect. Merges will become Join, appending tables becomes Union, converting a text to uppercase becomes UPPER and so on.

If at some point there is a step it can't fold, it will use a native query to load the data up to that point, then do the rest in-memory. Even if later steps were foldable, they'll have to be done in-memory. You can guess that this creates a lot of potential for optimising longer queries by ensuring as much or it as possible is folded and that the result is as "small" as possible – as few rows and column as feasible etc.

Now, when I tell you that there is a table in one of our sources with a few large text columns you almost never need, you may be able to smell the smoke already. A colleague of mine needed help with his queries being slow to load. He had copied some code from Stackoverflow or what have you that joins a query with itself multiple times to resolve hierarchies. In theory, it was supposed to be foldable, provided the step it runs off of is. The general schema of my colleague's query went Data Source -> non-foldable type conversion -> copied code -> filtering (ultimately keeping about 20% of rows) -> renaming columns -> removing columns. Want to guess which columns were loaded, processed with each join, explicitly renamed and only then finally understood to be useless and discarded?

"I always do the filtering last, don't want to miss anything."

This is your regularly scheduled reminder that MS (and our corporate BI team) can present Power Query as self-service data transformation tool all it wants, that still doesn't mean it's actually designed for use by non-data techies.

13
lemmy.world

Back in the day, a C program to handle estimating procurement costs for complex government contracts. We had to figure out the code and write in in a different language. It was just one giant loop, no functions, with variables named V1, V2, V3, etc. Hundreds and hundreds of them. I still shudder at the horror of it all.

13
vrekreply
programming.dev

I worked on a laser seam welder which basically was programmed in a mix of g code and I guess vb??

The fun part was variables could only be numbers between 100 to 999. So let's say you have a sensor and need to verify it's within a certain range. You could set #525 to 10 and #526 to 20 then say #527 = sensor 1 signal. Now lower down you verify it as if(#525 > #527 || #526 < #527){show error}

Now you could create each variable at the beginning with comment of what it was but then have to keep referring to the top to remind yourself what number was what. Or create the variable at first use so it was closer but now it's spread across the document.

I went with first case and just printed out the first 2 pages which listed all the variables.

Before you ask, I talked to the guy who wrote the language and made the system many times he confirmed you couldn't use variable names.

9
lemmy.world

I wonder at what point it would be easier to make a compiler to convert variable names into those numbers

6
vrekreply
programming.dev

If you did and it was usable across multiple cnc manufacturers you could make a pretty penny.

3

If I had the necessary insight into these fields to make fixing inefficiencies my job I would

1
Machinistreply
lemmy.world

G Code is basically a geometric scripting languge and isn't Turing complete in basic implementations. Every manufacturer pretty much also has their own dialect that is Turing complete.

Gcode with control commands and variables is called, no shit, Macro G Code. It's Turing complete. That form of variable names is normal and is inherited from hardware registers/banks and TTL.

It's not unusual for a save dialog to be labelled Punch as it has a direct lineage from punch tape.

Kind of like assembly and a graphing calculator had an abortion together.

5

Lol, yeah I've written g-code from 4 different manufacturers and yeah it's a new experience each time.

3

"Man if we had the original source code, it'd be so much easier than reverse engineering this binary in Ghidra"

The source code in question:

1

I got forcefully moved onto another team at work. They use Observables to replace signals, change detection, local storage, and even function calls. Every single component is a tangled mess of Observables and rxjs. Our hotlist has over 300 bugs, and the app is like 6 months old.

I've been looking for a new team

12
psivchazreply
reddthat.com

There's a part of me that kind of feels like this could work if you just do it right. Like the idea is kind of cool, in a way.

2

Unfortunately, it results in a dependency tree that resembles the tangled power lines in Bangladesh. Especially when half the code base is written by new devs using GAI and there isn't a design doc in sight

6

I had some absolutely beautiful RxJava2 chains in an app I worked on once. Can definitely be abused and done poorly though.

1

Had a coding firm costing 1k+ euros which was unfamiliar with django select all() from DB just to cast that into a list each time a user opens the tool. That got real funny real fast when the customer started adding the announced 50k objects per day. They did that buried in about 50-60 api endpoints conveniently coded by hand instead of using genetic api endpoints available from django rest framework.

When the loading times hit 50s per click, the company took the money and ran. My colleagues and me spent 2 years and half that to fix that shit.

11

My university uses ORACLE. To make a payment from a research account, you need to manually input a 15 character chart string. Every time.

11

Mine.

I should state that I'm not a programmer. I'm a network engineer.

I work for a space (among other things) contractor, and there are days I feel like I'm mission control for Apollo 13.

9
lemmy.world

There are a couple that come to mind.

Definitely the worst, a C# .net mvc application with multiple controllers that were 10s of thousands of lines long. I ran sonarqube on this at one point and it reported over 70% code duplication.

This code base actively ignored features in the framework that would have made things easier and instead opted to do things in ways that were both worse, and harder to do. For example, all SQL queries were done using antiquated methods that, as an added benefit, also made them all injectable.

Reading the code itself was like looking at old school PHP, but c#. I know that statement probably doesn't make sense, but neither did the code.

Lastly, there was no auth on any of the endpoints. None. There was a login, but you could supply whatever data you wanted on any call and the system would just accept it.

At the time I was running an internal penetration test team and this app was from a recent acquisition. After two weeks I had to tell my team to stop testing so we could just write up what we had already and schedule another test a couple months down the line.

9
vrekreply
programming.dev

What is a sonarqube? I never heard that term before. Could you also provide the names of some software to run them?

4
lemmy.world

Sonarqube is a kind of like an automated code quality checker that works for a bunch of programming languages. It's pretty configurable (though I've never configured it myself), so it can be set up to check a code base for a wide range of things.

There's a couple of different ways to run it, in my experience bigger companies usually have a dedicated server on their internal networks that connects to their CI/CD pipelines so that code gets checked before it gets merged in.

On a smaller scale, it's also possible to run locally (either on metal or inside a docker container). From there you'd install a plugin to your IDE of choice.

More info:

8
programming.dev

This was then sent to the server as pure sql, no orm.

ORMs are overrated.

9

Yeah but simply using entity framework would of made the configuration file a list of systems.

2
programming.dev

The encryption thing is definitely weird/crazy and storing the SQL in XML is kinda janky, but sending SQL to a DB server is literally how all SQL implementations work (well, except for sqlite, heh).

ORMs are straight trash and shouldn't be used. Developers should write SQL or something equivalent and learn how to properly use databases. eDSLs in a programming language are fine as long as you still have complete control over the queries and all queries are expressable. ORMs are how you get shit performance and developers who don't have the first clue how databases work (because of leaky/bad abstractions trying to pretend like databases don't require a fundamentally different way of thinking from application programming).

9
jlai.lu

Orm are a way to handle seamlessly the model aspect of a codebase. But I agree.

My first big project (Symfony, with doctrine orm), we had to have several SQL requests made by hand due to the complexity of the databases here and there. So we were kept on our toes when it came to database knowledge haha

2

Except it's not seamless, and never has been. ORMs of all kinds routinely end up with N+1 queries littered all over the place, and developers using ORMs do not understand the queries being performed nor what the optimal indexing strategy is. And even if they did know what the performance issue is, they can't even fix it!

Beyond that, because of the fundamental mismatch between the relational model and the data model of application programming languages, you necessarily induce a lot of unneeded complexity with the ORM trying to overcome this impedance mismatch.

A much better way is to simply write SQL queries (sanitizing inputs, ofc), and for each query you write, deserialize the result into whatever data type you want to use in the programming language. It is not difficult, and greatly reduces complexity by allowing you to write queries suited to the task at hand. But developers seemingly want to do everything in their power to avoid properly learning SQL, resulting in a huge mess as the abstractions of the ORM inevitably fall apart.

3

A switch that would just return the input value with a constant offset ... hardcoded for over 40 consecutive values.

9
lemmy.ca

My current favorite is in ruby with the unless keyword:

tax = 0.00
unless not_taxed(billing)
  tax = billing.zipcode.blank? ? estimated_tax_from_ip(account) : billing.tax
  tax = (tax.nil? ? 0.00 : tax)
end

To me, anything payments related you want to be really super clear as to what you're doing because the consequences of getting it wrong are your income. Instead we have this abomination of a double negative, several turnaries, and no comments.

8
feddit.org

FYI, an operator with three arguments (such as ?:) is called ternary. The word is related to tertiary, if that helps remembering it.

3
dimeslimereply
lemmy.ca

Correct, and since there are multiple instances I'm using a plural form, and fighting autocorrect at the same time.

5

I know you were using multiple instances, but I wasn't sure if that was a typo, auto cow wrecked or genuinely not knowing.

5

Hm. Needs to be unrolled into early returns and have some unit tests strapped tight around it

1
lemmy.wtf

A (poorly written) Shell check if the process was able to write to the production database which in some, not all, cases threw the gem:

!!!!!!!! SQL ERROR !!!!!!!!!

7
sh.itjust.works

Lots. But one that springs to mind is a custom CMS where a new dev decided to print out the sql generated for a particular content type on paper. He took it to the CTO without comment.

What was wrong?

It was 12 pages.

7
vrekreply
programming.dev

Am I reading that right, that he printed out the generated sql query?

If so depending on context that may make sense to complain about. A 12 page sql query would be insane, something sounds like their are other issues.

That said I probably wouldn't go to cto, I would go to manager or a senior dev and ask why it was so complex to get a particular content type. If there were no performance issues or bugs I would just ask out of curiosity.

2

Yes, the generated SQL query. It basically consisted of a lot of WHERE x IN (1,2,3,4) clauses for all the document IDs that matched something or other, and then repeated for the next JOIN. Small company, CTO was our direct boss and in the same open-plan office.

1

The worst programmer I ever seen was myself six months ago...Hopefully will be true in another 6 months too

11
lemmy.eco.br

it wasn't funny in any way, but JSHITBOSS "microservice" (it was a jboss service with one microservice inside, in a kubernetes pod, with only one core, tell me about redundancy). Service classes with over 2000 lines of code, it shouldn't even be called spaghetti code, more like lasagna code, the pasta came in layers, separation of concerns was a mere suggestion, code was not thread safe (and it needed to be), but there was only 40 Ejbs for each "stateless" service inside de EAR, so number go up, code goes better.

I refactored it, it's now in the glorious quarkus 3.27, on virtual threads and java 21, not hyperbole, but 5x more throughput and you don't need 7 phds in italian cousine.

Edit: I also saw, in Angular, the infamous:

if (variable === true || variable === 'true' || variable === "true") {

6
vrekreply
programming.dev

Why does it seem like Java is always the language with the worst code?

I mostly do local programs with c# or python so alot of your comment didn't make sense to me like quarks and ejbs but yeah it sounds horrible.

6
potatoguyreply
lemmy.eco.br

The most used language has the most of the worst code, quarkus is a new framework (and very good), ejbs are enterprise java beans (the worst thing ever made).

I think a lot of the code was written by a lot of people in a rush, very backend of the backend, but EXTREMELY needed. Java is hated (I hate it too), but the new things in it? It's amazing too (I only love the new stuff).

9
vrekreply
programming.dev

I'm thinking of diversifying, do you think Java or Javascript would be better?

2
potatoguyreply
lemmy.eco.br

What is your purpose?

Do you just want a job or do you want to program for fun? If you want backend, that'll be very different than frontend, do you want corporate or startup?

I didn't care about that, but I think java, for backend would be a first choice, as it has the biggest amount of "it just works with that".

I think scala is cool too, very modern and with A LOT of less boilerplate, all the JVM support, so it can work with almost anything in the backend, but for working for jobs, it's not very used.

4
vrekreply
programming.dev

I had a job as a software engineer at corporate job but got let go. Mostly I enjoy backend. I can do front end programming but am very bad at making pretty things. Like sketch something out for what you want for a interface I can program it, but ask me "just make an gui for users" and it will be like win-me quality of bad.

4

JavaScript might be more widely appliable. Java is good to learn, too. If you learn Java, you can also learn Kotlin which is a glorious language to work with.

1
lemmy.ml

I've seen a many-to-many relationship written as a column of CSV ids.

Also same ppl used "ID" instead of "id" (sometimes Id even) which made ORMs cry hard

6

Half our ids are called 'number' sooo. Also our entire in-database translation system relies on guids that are not foreign keys. The only reason our ORM doesn't flip on that is because it's completely custom made with semi-autogenerated stored procedures resolving that translation in-database (using yet another SP).

We are at 2696 stored procedures right now, most of those are simple CRUD (can't do straight selects on our tables because of the translations, so every select with different parameters is a SP)

4

Ok so this one is someone trying to move to "the cloud."

They had a database they used. It was on a server in the office. We were tasked to clone the db server to a hosted VM. Due to order of creation this got put on a new host without anything yet on it.

They needed a site to site VPN to keep privacy, that was all fine. However after the clone and during testing, their guy there said that this one part was really slow. We take a look and everything is good with performance of the server and of the VPN. I have to pop on to take a look.

It was in an office app and written in VB. (I forgot which one.) It was indeed slower on the hosted server. So I took a look at the function (he got it up for me) and I could instantly tell the issue.

This part was a lookup page that searched for you input. The function retrieved the entire table, then filtered the results in the client. I explained that transferring the whole table over the internet would be slower than on the local lan.

This guy said he originally wrote this, but "forgot VB."

In the end they decided not to update the app or keep the server in the office, but instead they rented some VDIs in the same data centre as the db.

6

I saw a talk recently, I can find the video if you like but pretty sure it was the most recent ND conference, where they made the point that a lot of lack of efficiency in modern code is because of large companies. Basically in alot of cases it's more important to get a product out ASAP then to care if it was well done. Ok, a poorly written program may cost an extra $10,000 a month to run but if it earns them a million a month and saves 6 months of development time it pays for itself and they can eat the cost.

This seems like the case with renting vdis instead of fixing the program.

2
lemmy.zip

The C++ code went something like this:

  1. Conver pointer to int
  2. Serialize the int over IPC to self using Linux Message Queues
  3. Delete/free the pointer
  4. Read the int from the queue
  5. Convert to pointer
  6. "Use" the pointer
6
vrekreply
programming.dev

Only reason I can think to do that is to "verify" the data in the pointer is not null/empty and is a valid int???

There are much better ways to do that but I can't think of any other intent the programmer had.

1

Oh no, when they deserialized the int/pointer they used it like the original structure (which now points to freed memory). They meant to serialize the data structure across, but only sent the memory address.

1

A page that handled call requests. It was a table showing some information about the person, the case it's related to and some other fields. It fetched everything from any table it touched. So the call was fetching all the information about the person. The case it was related to. The person who was assigned to the case, and since the case was linked a couple of layers in, all of that data as well.

I created a simple view that only fetched the data it needed. It went from over A GIGABYTE of data to less than 25mb of data of transfer to the web ui.

6

This one is funny because it 100% still exists somewhere, but I haven't had the chance to verify it again.

Okay so basically its a data recorder box (ex: brainbox) that connects to a bunch of industrial sensors and sends the data over the network with your preferred method.

Builtin firmware gives you an HTTP webui to login and configure the device, with a user # and password.

I think the user itself had a builtin default admin which was #0, which everyone uses since there wasn't really much use for other users.

Anyway, I was looking at the small JS code for the webui and noticed it had an MD5 hashing code that was very detailed with comments. It carefully laid out each operation, and explained each step to generate a hash, and then even why hashes should be used for passwords.

Here's the kicker: It was all client side JS, so the login page would take your password, hash it, and then send the hash over plaintext HTTP POST to the server, where it would be authenticated.

Meaning you could just mitm the connection to grab the hash, and then login with the hash.

I sat there for like 10 minutes looking at the request over and over again. Like someone was smart enough to think "hey let's use password hashing to keep this secure" and then proceeded to use it in the compleltly wrong way. And not even part of like a challenge/handshake where the server gives you a token to hash with. Just straight up MD5(password).

It was so funny because there were like a hundred of these on a network, so getting a valid hash was laughably easy.

I never got to check if this was fixed in a newer firmware version.

6

Joined a new team and one of my first tasks was a refactor on a shared code file (Java) that was littered with data validations like if ("".equals(id) || id == null) { throw new IllegalArgumentException() }

The dev who wrote it clearly was trying to make sure the string values were populated but they apparently A) didn't think to just put the null check first so they didnt have to write their string comparison so terribly or else didnt understand short circuiting and B) didn't know any other null-safe way to check for an empty string, like, say StringUtils.isEmpty()

5
vrekreply
programming.dev

I mean... That's bad but not on the same scale of some of these other issues.

6
lemmy.world

Sure. There were worse problems to. SQL injection vulnerabilities, dense functions with hundreds of lines of spaghetti code, absolutely zero test coverage on any project, etc. That's just the easiest to show an example of and it's also the one that made me flinch every time I saw it.

"".equals() 😨

4
vrekreply
programming.dev

If it makes you feel better at my last company I asked the "senior validation specialist" what the validation path would be for a program which incorporated unit tests.

The answer I got was "what's a unit test?"

7
lemmy.world

The script I vibe coded to automate part of my job. It's sloppy and unrefined, but it works, and saves me a ton of effort.

4
sopuli.xyz

I hate vibe coding. However, this is the best use of it. I've done it several times for scripts and basic HTML dashboards.

4

Agreed. I wouldn't write an entire app with an LLM, but for basic scripting and backend UIs, it's perfect for when you just need something quick and inelegant that works.

I have nothing against AI when it's used as a tool instead of a crutch.

4

All about PTC's God awful piece of shit PLM/PDM systems IntraLink and PDMlink. I cannot believe the amount of trash code that company uses. And they get paid millions to basically screw the customers over. The costumer's CAD gets intertwined in a huge heap of automated HTML garbage. This leads to a total disaster.

4

Unless I'm missing something, this is a pretty bog standard SQL injection, yeah?

2
lemmy.world

Weather forecasting software that maintains a linked list. When it eventually freed the memory used by the list, it would walk to the end of the list and free the last item. Then it would go back to the beginning of the list and do it again - rinse and repeat. Wonder why it was having performance issues 🙄

3
lemmy.dbzer0.com

A bit late to the party on this one, but Facepunch just opensourced a bunch of their code, I nominate that.

2
vrekreply
programming.dev

I don't recognize the name, what dud facepunch make?

2

#4 is a good thing. ORMs do not make queries better or safer, they make them easier for devs that don't learn SQL or safe calls. In some cases, they have been shown to cause slowdowns.

1

Php, ob_start + ob_clean and friends. On backend. Nothing could go wrong, right

1
programming.dev

Doesn't that mean that your encryption algorithm and key is stored inside the code?
And since you are opening the code in Visual Studio anyway, just follow the function called by the "Decrypt" button, copy the function into another project and now you have a decryptor.

0

I believe so but I don't remember the exact encryption algorithm and don't have access to the code anymore.

This was the same place that had a 500 line file named glob_vars.cs which you can guess the content of because "passing around variables cause memory leak issues".

2