Readit News logoReadit News
reader_1000 · 5 years ago
I don't remember the exact project or where I read it but one project added delay (using sleep function) to depreatected methods in order to discourage people using them. After every release, they increased the sleep time so that at one point it became impossible to use it without noticing it. Although I don't know if it is possible to do this for new code trying to use deprecated function and have old code use non-delayed one, I think it was a nice trick.
deckard1 · 5 years ago
Slightly tangent, this reminds me of the story of the game developer that would allocate a few tens or hundreds of megs of RAM early on in the project and not touch it. He knew that as the project was nearing completion, they would get squeezed on available RAM. Then he could just go and delete a single line of code and, bam, tons of free RAM.

This seems like a slight variant of SDD: dickhead-driven-development. Clever, but your coworkers still hate your guts.

neilparikh · 5 years ago
There's a real reason to do something similar if you're developing for a memory constrained devices with a API someone else will use.

If you have objects your API functions return that API consumers will use, you want to make sure the objects don't suddenly grow in size, since that would eat into the memory that the consumers expect to use. So, you'd pad those objects with unused fields, and then if you need to add a new field, you can just use that padding area.

Something similar applies if you're sending objects over the wire, since you may not want to increase the size of the message later.

Spooky23 · 5 years ago
I knew someone who did this with humans at a bigcorp.

He’d politick to transfer in new teams for the sole purpose of building a supply of cannon fodder. Staff up in good times, and purge fodder when layoff targets came to protect “his people”.

gultig · 5 years ago
Back in 2000 we were mandated with a big push to eliminate all shared excel documents and turn them into real database driven products. There was this one department that had a huge excel database that was bringing the network to its knees. Around that time I had discovered that you could create a function in excel with the moniker of a null character (alt-255). We had used that for playing pranks on one another. Someone had the bright idea to put a function into the code that invoked a slowly increasing pause. That function was sprinkled all throughout their code and no one knew because you can’t see a null character.

A few months later that department was practically begging us to convert their excel document into a database project.

Communitivity · 5 years ago
I read this, and thought to myself that a hacker would love to find that in code through analysis tools. They could then replace the delay with malicious code, and no one would be the wiser for quite some time.

Doing stuff like this seems creative and awesome at the time, but it breeds vulnerabilities something fierce. It also creates a nightmare for maintenance.

I would suggest a different approach of figuring out how much that Excel doc was costing the company every month, how much the company would save if the doc was converted to a real data service and Web front end, and then present the comparison at a meeting with management from that department - give them a chance to sign on before you take it to more senior management.

mattnewton · 5 years ago
That seems far worse than just deleting the function IMO. The dev teams that most need to refactor are the ones least likely to notice perf slipping.
kbhn · 5 years ago
In this scenario I would argue that deleting a function abruptly without verifying impacts is significantly worse than gradually adding a delay. Usually when function deprecations occur impacted dev teams are notified on a shared distro of what's coming in future releases. Library maintainers at large companies typically don't have the bandwidth to investigate each project that uses their library to determine if deleting a function would detrimentally impact a production environment. What a deletion does do is block the downstream dev team in this hypothetical from deploying to prod as they investigate why their builds are suddenly failing (or crashing in prod!) and refactor an alternative solution. Do you really want to work in an environment where other devs feel empowered to break your builds and sprints ad hoc?
marmshallow · 5 years ago
While an interesting tactic, I don't think it's a great idea as it may mean a poorer experience for the customer rather than just the development team.
ddingus · 5 years ago
That is hilarious!

Also, a fair percentage evil.

Nice trick.

jimmaswell · 5 years ago
100% evil and pretentious. Not every dev team has the free time to go rewriting everything to the whimsy of library devs that can't help themselves from incessantly shuffling everything around every week. This is how you encourage people to never update and keep security vulnerabilities in the wild.

Deleted Comment

Moezart · 5 years ago
Haha what a smart idea
pbronez · 5 years ago
Here, a “shitlist” tracks existing uses of deprecated behavior within a large code base. It prevents new uses of deprecated behavior without disrupting legacy code. This is a temporary measure used to facilitate refactoring large code bases.
tantalor · 5 years ago
Not necessarily temporary. Abandoned (but critical) code might stay on the shitlist forever if it's not worth migrating it.
fduran · 5 years ago
This is a good example of "Organization as Code", where you are trying to influence a non-trivial change (often "cultural") by code.

Frequently it's better to change behaviour this way than say, holding meetings and presentations.

A typical example is "we want our developer to write more tests" but there are few existing examples of test code to look at and when you write a test it takes forever to run, so you fix this by fixing the underlaying issues (which is bad or non-existing code), rather than making developers attend TDD presentations and just talking about a "test culture" for example.

acbabis · 5 years ago
I've experienced this first-hand. Joining an existing project and being put on test-writing duty very quickly turned me into our team's chief advocate of writing testable code.
dhosek · 5 years ago
If you don't want people to use deprecated code, it's essential to document what the replacement should be. In JavaWorld, this can be done through Javadoc. Just tagging a method or class with @Deprecated and leaving it there is the sort of thing that makes me want to hurt people.
boojing · 5 years ago
Your comment made me think of the adage: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live"
nerdponx · 5 years ago
Another, less extreme version: "Your most important collaborator is yourself six months ago, and they won't respond to your emails."
ritchiea · 5 years ago
This is literally one of the topics covered in the article and the author advocates for the same solution, documenting the alternative in the error/deprecation message...
andruc · 5 years ago
Is supporting the article's position frowned upon?
postalrat · 5 years ago
Seems to me that if you want shitlists to drive development then often there won't be an immediate replacement.
remote_phone · 5 years ago
That’s because you don’t understand what deprecated means.

Deprecated means “still supported but its use is discouraged.” It does not mean “no longer supported.”

Robin_Message · 5 years ago
I've always understood Deprecated to mean "This works, but we don't want you to use it in new code, and we plan/hope to remove it in the future."
DonHopkins · 5 years ago
It's better to use a Shiterator, which can yield pieces of shit on demand, lazily enumerate them just in time, and generate infinite streams of shit, instead of allocating all your shit up front, and having your shit together in one place.
agravier · 5 years ago
That's elegant dungtional programming but it's not really relevant here as you are supposed to check if new crap matches any of the enumerated fecal matter; how would you do that against an infinite stream of diarrhea? I'd leave this to the type system if possible. And of course use a colon-delimited list for the occasion.
jokab · 5 years ago
Also make sure you have enough RAM in your septic tank
ben509 · 5 years ago
Shiterator requires your system is able to consume fibers, though, or it'll dump all your kernels, which is not a pretty sight.
Terr_ · 5 years ago
Isn't that backwards, though? More green threads increase the throughput of kernels, or at least decrease the processing latency.
jaza · 5 years ago
Proof of concept:

  def shiterator():
      while true:
          yield random.choice([
              "sinker", "floater", "firehose", "steamy heapy",
          ])

gwn7 · 5 years ago
haha so irrelevant yet funny
ddingus · 5 years ago
Yeah, it hits slow too. Read it, started to chuckle, than BAM! Hilarious!
codeulike · 5 years ago
'Shitelist' would rhyme better with 'Whitelist'

Deleted Comment

Jumziey · 5 years ago
Brilliant. It's a really good compliment to strangling certain parts of a large code base.

As always the key is getting the information to the right people at the right time, and making it more difficult to make the wrong choices then the right choices.

harryf · 5 years ago
Exactly. What's nice about this approach is it factors in the "behavioural economics" of developers. As the author puts it...

> At the end of the day, everyone needs to get work done, and if they see a code-path already being used from 10 places in the code-base despite these soft warnings–it doesn’t seem crazy to introduce another.

Even the best person with the best intentions will take a short cut under some circumstances, meaning to fix it later then getting distracted before that happens.

notabul · 5 years ago
The idea of deprecation and death of code assumes that those using it can easily stop.

That’s not always the case.

When Flash dies Jan 12, 2021, you’ll see what I mean.

There’s been so much misinformation about it, but there’s an OS datetime check in the Flash viewer code, browsers will disable the plugin even for some older versions not just new releases and have or will remove PPAPI and NPAPI support, and Windows already has an optional update to kill Flash support that will be part of regular updates in Summer 2021.

Even with three years of warning, it’s not ok.

It’s an extreme case of deprecation, being attempted by the best in the business, but it is inherently bad, and there’s hardly a good way of doing it.

JBorrow · 5 years ago
I don't understand what this has to do with the article or the previous comment at all.
WJW · 5 years ago
This is an excellent way of using your (hopefully) already existing testing and CI infrastructure to change a social problem into a technical problem. As we all know, technical problems are by far the easier of the two. :)

We used this technique to great effect at my previous day job, though under the more neutral name of "ratchet".

trevyn · 5 years ago
I like the term “ratchet” more because it communicates the underlying mechanism, which may be a useful tool in a broader set of applications.