Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Search - "if statement"
So, I was going to complain about JS being finicky and not making a damned bit of sense, but it turns out that it wasn't JS's fault. Not entirely, anyway. It was the halfassed JS minifier middleware (written by the legendary dev himself) that was breaking the JS while writing it to the page.
The original problem:
My code worked. I removed some comments. Big ol' block of //'s. And suddenly $() isn't a function. But if I call $(); at the top, it all works!
It turns out the "minifier" caused JS to think my code was chaining off the previous JS line in the rendering pipeline instead of being a separate statement. so all it really needed was a `;` at the start. What threw me, though, was the last line of the previous blob of (non-minified) JS was a comment, so it should be a separate statement, right?
But as it turns out...
// JS really is finicky.
My previous bosses were real awesome people. However, the current one is an intentional asshole.
He wants to review every piece of work. He thinks I am a retard who knows shit. He has no sense of feedback vs. humiliating criticism.
Fucker questions every single word.
For example, consider the following statement, "They are taking the Hobbits to Isengard."
He'd critical question every word like,
What do you mean by 'they'?
Why have you mentioned it?
Why does 'They' exists in English vocabulary?
Why cannot you try 'Your'?
What data points you have?
And after endless questioning, he'd repeat the same with next word. Making sure to break my spirit of working for him.
And let me add that his communication is saturated with heavy jargons which are difficult to understand. At times, I slow down to understand and absorb and he has a problem with that as well.
My past experience says that I learned a lot from strict managers.
But this fucker intentional criticises every aspect with zero to negative appreciation. All in the name of feedback.
I have gotten tons of compliments and good ratings in the past based on my communication and thought process. However, this fucker feels that my thought process is shit and I don't know how to communicate. Furthermore, he feels that I lack sense of ownership.
I really don't know what he saw in my resume or me to even hire me in the first place.
Given how he treats me and others, no wonder people are leaving. And if he fires me, good luck to him finding a sensible replacement who matches his expectations or puts up with his crap.5
Have a function that takes parameters and then performs a switch statement to determine what function to call next with those same parameters. One of those parameters is a Union type.
During CR, my reviewer said they’d like if instead of returning the function per case, I instead assigned a handler to the value of the function per case and then returned that handler at the end of the switch. Simple change, right? Only snafu, I’m casting one of the parameters on a per-case basis.
Somehow, through no fucking change of my own, TypeScript in its wisdom has decided that the type of that value by the time I call the next function is a fucking Intersection.
WHY THE FUCK DO YOU THINK IT’S AN INTERSECTION?! I’m fucking casting it per case! I’m ensuring it’s the right type for the next function called on a per case basis!
…. And that, my friends, is how I wasted a day with a stupid refactor that was ultimately just scrapped because no one could figure out how to make it work.
Goddamn fucking TypeScript. I3
!rant, TL;DR at the bottom
Holy fuck, Yesterday, I got absolutely schooled by a literal newbie.
And I mean, NEWBIE newbie, the dude just started a Computer Science degree, and has been learning Java only for a MONTH. He has 0 prior experience with code or anything of the like, and he's somewhat of an Ars(Israel's version of a Gopnik).
So I was helping him with some stuff he didn't understand, and lo and behold his code was probably the most aesthetically pleasing and organized code I have seen in my 8 years of programming(I know 8 is not much, but It's at least above beginner level). The dude's a perfectionist, so I was like, "Okay, very impressive, but makes sense for perfectionism"(I straight up told him: "Damn, I've seen people with years of programming experience who can't learn to write this well, and you do this by default? I envy whoever's going to work with you"), and then I saw the way he writes checks(as in, methods that return a boolean) and I think I came.
The code was:
[First method in the picture]
And I know, it doesn't look as ✨ WOW✨ as I make it sound, but in my personal opinion this both looks much better and is much more readable than what I normally write:
[Second method in the picture]
and whenever there are longer or more complicated checks it makes it look like a simple puzzle that just fits in all the pieces nicely, for example in a rectangle class we had to write an 'isIn' method, this is how I wrote it:
[Third method in the picture]
His way of writing the same thing was:
[Fourth method in the picture]
Which I think is soooooo much better and readable and organized,
It's enough just looking at the short return statement to immediately understand everything that's going on.
"Oh, so it just checks if the SW(South West, i.e. Bottom Left) corner is above and to the right, and if the NE(North East, i.e. Top Right) corner is bellow and to the left"
Point of the story? Some people are just fucking awesome. And sometimes the youngest/most inexperienced people can teach you new tricks.
And to all of you dinosaurs here with like, 20+ years of experience, y'all can still learn even from us stupid ones. If 8 years can get schooled by a 1 month, 20 years can get schooled by a 1 year.
Listen to everyone everybody, never know where you might learn something new.
TL;DR: Got schooled by a local "Gopnik" who only started learning programming a month ago with 0 prior experience with his insane level of organization and readability.30
The “if” statement works the same in every* language, so if you can code in one language, you can code in most of them.
*Terms and conditions apply.5
devops - im sick of everyone mis-using this term
it seems like everyone in the industry (even famous ppl and youtubers, not just recruiters) have clung to this word and use it as a blanket statement and it pisses me off. two parts of the word, dev (you know, development) and ops (operations, keeping shit going). yet ppl use this whenever there's more than one machine being used or something. like it's in aws must be devops, it's a cluster of machines must be devops, it's a lot of ci/cd so it's clearly devops.
if youre not keeping a system alive, debugging it, fixing errors in the environment -and- creating said environment then using the operations work to influence your development, how is it devops?
you made a build server with some kind of orchestration tool. how is that deovps?
you have a ci/cd pipeline that's in aws. how is that devops?
you built a cloud cluster in aws/gcp/azure but hand it off to another team that monitors it and pokes and prods. how is that devops?9
Follow up to my other rant https://devrant.com/rants/4994932/...
I have finally fixed the bug i couldnt fix for over several weeks. I was just missing a fucking if statement check. Not expecting this to work, i compiled, tested and it worked perfectly on the first fly.
Immediately i shit you not have i broken down crying. Sobbing in tears. Uncontrollably crying down on my table for several minutes and cant refocus to continue coding. I have NEVER cried because of a fucking bug fix! But i have also NEVER had a problem so much difficult that i needed several weeks to fix it!
Potentially hot take : If you're making a video course on a tool that supports multiple languages you should show examples in a language with explicit typing whenever possible.
Weakly typed and implicitly typed languages make it harder to know what the results of a particular statement are and therefore what you can do with them.6
If you think meetings are bad.
Have a day full of license renewal and price negotiation talks regarding technical products.
It's funny how you can blatantly say: We don't need feature XYZ, we get it for free via BLA.... Yet they still present it in all glory.
Even better when they don't even know their alternative / competition products...
X: "our tool is better".
Me: "We have tool XY. Doesn't cost a penny, does the same, we don't need your tool".
X: "No it doesn't. Look at all the features we have *screen share presentation* with long explanations".
Y: "Yeah... You've certain additional features, but the basics are all present in the tool that we use, so my statement remains the same".
These meetings are really mind boggling insane.
Even more insane when you get the price offers.
The cloud only madness is absurd.
Sure, we move 50 terabyte plus to the cloud from premise, no problem. *🤡*
Not that we haven't told them explicitly that cloud only isn't possible....
The worst: every motherfucking company does it for every stupid single craptastic product...
You cannot even swoop it up in a single meeting... Every company. Every single product.
*booze liberate me from madness and remove the filthy stain of humanity*
I don't know if it's just me but if you sign up for Dashpass and then cancel during the month, it refunds the entire subscription...
Even when I've used all the benefits...
Seems like the devs forgot an if statement...2
The Zen Of Ripping Off Airtable:
(patterned after The Zen Of Python. For all those shamelessly copying airtables basic functionality)
*Columns can be *reordered* for visual priority and ease of use.
* Rows are purely presentational, and mostly for grouping and formatting.
* Data cells are objects in their own right, so they can control their own rendering, and formatting.
* Columns (as objects) are where linkages and other column specific data are stored.
* Rows (as objects) are where row specific data (full-row formatting) are stored.
* Rows are views or references *into* columns which hold references to the actual data cells
* Tables are meant for managing and structuring *small* amounts of data (less than 10k rows) per table.
* Just as you might do "=A1:A5" to reference a cell range in google or excel, you might do "opt(table1:columnN)" in a column header to create a 'type' for the cells in that column.
* An enumeration is a table with a single column, useful for doing the equivalent of airtables options and tags. You will never be able to decide if it should be stored on a specific column, on a specific table for ease of reuse, or separately where it and its brothers will visually clutter your list of tables. Take a shot if you are here.
* Typing or linking a column should be accomplishable first through a command-driven type language, held in column headers and cells as text.
* Take a shot if you somehow ended up creating any of the following: an FSM, a custom regex parser, a new programming language.
* A good structuring system gives us options or tags (multiple select), selections (single select), and many other datatypes and should be first, programmatically available through a simple command-driven language like how commands are done in datacells in excel or google sheets.
* Columns are a means to organize data cells, and set constraints and formatting on an entire range.
* Row height, can be overridden by the settings of a cell. If a cell overrides the row and column render/graphics settings, then it must be drawn last--drawing over the default grid.
* The header of a column is itself a datacell.
* Columns have no order among themselves. Order is purely presentational, and stored on the table itself.
* The last statement is because this allows us to pluck individual columns out of tables for specialized views.
*Very* fast scrolling on large datasets, with row and cell height variability is complicated. Thinking about it makes me want to drink. You should drink too before you embark on implementing it.
* Wherever possible, don't use a database.
If you're thinking about using a database, see the previous koan.
* If you use a database, expect to pick and choose among column-oriented stores, and json, while factoring for platform support, api support, whether you want your front-end users to be forced to install and setup a full database,
and if not, what file-based .so or .dll database engine is out there that also supports video, audio, images, and custom types.
* For each time you ignore one of these nuggets of wisdom, take a shot, question your sanity, quit halfway, and then write another koan about what you learned.
* If you do not have liquor on hand, for each time you would take a shot, spank yourself on the ass. For those who think this is a reward, for each time you would spank yourself on the ass, instead *don't* spank yourself on the ass.
* Take a sip if you *definitely* wildly misused terms from OOP, MVP, and spreadsheets.5
I know there’s this notion that you shouldn’t label yourself as a “.Net dev” or a “Python” or “Java” dev because programming languages are just tools that have areas in which they shine. Nothing’s wrong with that statement because it entirely true but I believe in picking something and mastering it so if someone wants a python dev or java dev they know where to look and what to expect. Nothings wrong with being a jack of all trades master of none because the industry needs people like that, but if you don’t have to then don’t.5
I know we are supossed to complete tasks fast.
But god I hate it when they ask for a "simple fix" that they have no fucking clue how to even begin to do. Clients obviously don't have to know this, but my boss can't code an if statement yet feels as though he can say what's easy and what's not and how long it'll take.2
I need to make a legacy Java monstrosity asynchronous and came across a class which is currently making me cry blood.
It took our whole team 5 days to figure out how this thing works, including the weekend. At one place, It is adding an empty list, to another list.
The magic here is that if I remove the statement assigning data to the sub list, the data is still somehow being populated in the root list.
This clusterfuck somehow works in single threaded processing, but as soon as I make this multi threaded, all hell breaks loose.
Please send help!!1
On https://reactjs.org/docs/... it is declared that useEffect runs after render is done.
However... if you put into useEffect an expensive calculation or operation e.g. "add +1 to x billion times", it will get stuck after updating the data, but before the re-render is done.
This leads to inconsistency between the DOM and the state which I believe is a foundational point of react. Moreover, the statement that "useEffect runs after render" is false.
See also: https://stackoverflow.com/questions...
The solution is to add a timeout to that expensive operation, e.g. 50 ms so the re-render can finish itself.
The integrity of my belief in react has received a shrapnel today. Argh :D Guys, how this can be? It seems that useEffect is not being run after re-render.13
Damn, I hate Spring and most CoC frameworks. We’re using it from 2 years, I read most of the docs and it still gives issue for basic taks which takes hours to fix because I have to guess the exact convention which allows the program to process corner cases which aren’t explained in the docs. Yes, in the end the code is more elegant but it’s worth it when issues which could be solved in minutes by a trivial if/else statement takes hours (rigorously on pair programming™️ since being one of the few which actually read the docs I end up with lots of calls for help for Spring related issues by other teammates) and huge headaches to fix following the framework’s way?2
There are some people who do not want to talk about death. Others will simply talk about it out of curiosity. But sometimes, such a tragic subject can also bring out the best in you when it comes to writing. Let us talk about writing a death essay. This subject can be considered a good topic especially if you do not have one yet.
One important thing that you must know before we talk about the topic is the essay structure. By now you should already know the parts of a formal essay and what their functions are. In any case you need to input the introduction, thesis statement, body paragraphs and the conclusion. Now let us take a look at some possible topic scopes for your death essay.2