@vaporeon_ nested python ternaries are things the devil itself would write
@vaporeon_ you get used it
@vaporeon_ you'd be stunned by the performance that JIT engines can achieve these days, they can get stuff that is close-ish to Java sometimes
Most people who do it write the codebase in TypeScript, which is a language that looks a hell of a lot like JS but it strictly typed, and is compiled to JavaScript (I have extremely mixed feelings about TypeScript)
There is just a huge cost to running a server with JS though (either you use a JIT engine which has a significant memory cost or you don't and get a huge performance cost), which makes me hard-pressed to ever consider it for a web server
@vaporeon_ I love JavaScript so I have mixed feelings about it
@vaporeon_ it's actually not abnormal lol
@vaporeon_ Maybe that was true at one time, but it would be unusual today
@vaporeon_ this plagued our backend, where everything was some subclass of an abstract class which implemented an interface and there was only one subclass which actually implemented the interface. Just make it one fucking class!!!!!!
@vaporeon_ the Java community also has a bad habit of what I'll call "Premature Generalization" where people where make a generic framework for something that is only used for a specific use case, making the API for it much more complicated than you want
You don't really see people using Spring for anything other than RESTful backends, and yet Spring is a generic application tool for using dependency injection in Java applications. It's so tedious to learn
@vaporeon_ once I use Java enough and get in the Java Zone I don't actually hate the language itself, but more the standard library and the excessive OOP people who use Java keep falling into (although I suppose it's fair to criticize a language if it incentivizes people to write bad code)
@vaporeon_ I find it extremely Uninteresting
@aescling @vaporeon_ oh this was an inefficient implementation of Dutch National Flag too, lol
@aescling @vaporeon_ if you are wondering this is using the Dutch National Flag partition, which is the actual real name for it, and I simulated recursion using a stack (a JavaScript array has methods on it that allow it to easily resemble a stack)
I used the ninther strategy for the pivot selection but that was not present in this snippet
@wallhackio 🎵 3 billion critical codebases run on Java!! 🎵
@vaporeon_ and because OOP was all the rage in that time period (it wasn't around ~2010 that the software engineering world was like, maybe we shouldn't solve everything with OOP)
@aescling @vaporeon_ nope :)
@vaporeon_ I am currently not working there, I was laid off in June, but yes it was
This is actually extremely normal since Java was extremely popular during the dot.com boom of the late 90's/early 2000's and the most appealing alternative was C++, so obviously people used Java instead
An enormous amount of critical codebases run on Java
@vaporeon_ okay here's a bad one. i implemented a non-recursive quicksort using the variables gorp, norp, and sorp:
const partition = (arr, start, end, strategy) => {
const q = [[start, end]];
while (q.length > 0) {
const [left, right] = q.pop();
const p = strategy(arr, left, right);
const pVal = arr[p];
swap(arr, p, right);
let gorp = 0;
let norp = 0;
let sorp = 0;
const L = right - left + 1;
for (let i = 0; i < L - 1; ++i) {
const curr = left + gorp + sorp;
if (arr[curr] === pVal) {
swap(arr, left + sorp, curr);
++sorp;
} else if (arr[curr] > pVal) {
swap(arr, curr, right - norp - 1);
++norp;
} else {
++gorp;
}
}
for (let j = 0; j < gorp; ++j) {
swap(arr, left + j, left + sorp + j);
}
swap(arr, left + gorp + sorp, right);
if (gorp > 1) q.push([left, left + gorp - 1]);
if (norp > 1) q.push([left + gorp + sorp + 1, right]);
}
};
@vaporeon_ I know how this is gonna go. I will show it to you and then you'll be like, wait this is cool I like it :)
@vaporeon_ full-stack software eggineer
@coriander Aspartame, son of Stevia
the clodvestigator
videogame enjoyer. mathematics hobbyist and recovering physicist. software engineer. professional wonk. certified weird movie liker. top-ranked c++ hater. prophet of The Truth. space dandy and kill la kill propagandist. the walking embodiment of "not diagnosed, but somethings wrong". i like animals that wear cowboy hats.
I am not picky about names. Most people here call me catwin, clodboy, clodsire, or Caleb.
header is by @vaporeon_
"i regret ever allowing him here" ~aescling
he/him