Joined devRant on 5/30/2017
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
The other day I wrote a bit of code using a new component. I spent three hours trying to find why it wasn't working - how was I using the component wrong? It was rendering its source html directly in the browser.
I had forgotten to import the file defining it.
New guy at work asks me for a code review. 16 lines added, and I have 4 comments, all about readability. Only the major stuff because I went easy on him. I even ignored a missing semicolon.
Guy comes to me and explains that code review is about if code works, not what it should look like. "You want me to write it your way, and we'll have endless arguments if that's how you do code reviews. But I'll do your requested changes." Reduces his entire code to two lines, which make a lot more sense.
Later, I ask him why he used "void 0" anyway. I was wondering if he's thinking of security aspects or if there's another reason. His answer: "because it looks cool and nobody else does it".
I was a little too harsh on a colleague today.
He asked to help him get something working... After looking at it for a bit, I asked: "I don't get it, what have you been doing all day? Yesterday we split this element into two separate divs, and it worked perfectly, now I've see you've moved all the styles back to the container and there's only one div. The easiest way to get this to work properly is to simply undo everything you've done today."
He looked at me with puppy eyes and I realized I was too harsh. He wasn't _trying_ to break everything, he just hadn't understood why we split the element into two divs. So I lowered my tone a bit, and explained everything again, from the start, then did it again together with him and made sure he understood the separation.
But I still feel bad for how I talked to him. It's not like I shouted or cursed or anything (and I curse a _lot_ when talking about code). It was just condescending as fuck, and belittling. As if I was mocking him for not being as experienced as I am.
I'll do better next time.8
I need to pick a new development laptop. Can't make up my mind about either which laptop I want or even which OS I should use.
I'm comfortable with both Windows and Linux, and I can't think of any software I currently use that's not available in Linux off the top of my head. I use bash religiously, so I'm more comfortable with a Linux terminal so I'm leaning towards Linux, but whenever I've used Linux as a desktop operating system in the past, the GUI drove me insane. I don't want to deal with GUI issues or drivers etc.
As for which laptop to buy, it's been so long since I've had bought one and a good experience, so I really got nothing to go on. At the same time, I'm planning to make the switch from 1080p to 4k monitors, so there's that.
Any and all advice welcome. Except a Mac. I don't think I can go there.10
When I was in the army I wasn't officially a dev. But one commander needed someone to develop a bunch of stuff and couldn't get a dev officially, so I ended up as his "assistant", which was an awesome job with about 60% time spent on software development.
Except I wasn't an official developer, so I wasn't afforded many of the privileges developers get, like a slightly more powerful machine, a copy of Visual Studio, or an internet connection. In this environment you couldn't even download files and transfer the to your computer without a long process, and I couldn't get development tools past that process anyway.
So I was stuck with whatever dev tools I had pre-installed with Windows. Thankfully, I had the brand new Windows XP, so I had the .Net framework installed, which comes with the command line compiler csc. I got to work with notepad and csc; my first order of business: write an editor that could open multiple files, and press F5 to compile and run my project.
Being a noob at the time, with almost no actual experience, and nobody supervising my work, I had a few brilliant ideas. For example, I one day realized I could map properties of an object to a field in a database table, and thus wrote a rudimentary OR/M. My database, I didn't mention, was Access, because that didn't need installation. I connected to it properly via ADO.NET, at least.
The most surprising thing though, in retrospect, is the stuff I wrote actually worked.15
In my last rant I mentioned I used to convert VB3 code to .Net. Before that, I used to work on the VB3 product itself. This software emulated something from the real world, and as such complied with a bunch of regulations that changed on a regular basis, and always had additions and removals that were to be done on a strict schedule (e.g. "we're adding a new product next month, so we have to be able to sell it by the first of the month"). As such, it was a huge sprawling mess.
One day, I was given a task to change some feature slightly. The task was simple enough and really only required adding one line of code. I added that line and clicked "Run".
Error: Too Much Code
What? What do you mean too much code? I asked a colleague for help. "Oh, don't worry, it happens when a function is too long. Just remove one or two of the comments and try again." The comments were, naturally, old deleted code that was quite meaningless so I had no qualms about removing some. It worked, and I went on with my life.
This started happening on a regular basis on our larger functions. But there were always comments to remove so it wasn't a big issue.
One day, though, it happened on a five-line function. This was puzzling - the error had always happened when a function was too big but this one clearly wasn't. What could the error mean? I went to the same colleague.
Apparently, there's also a limit to how big the entire code base can be. "Just find a function that isn't used any more and delete it." And so I did. There were many such functions, responsible for calculating things which no longer existed so they were never called. For months, I'd find functions and remove them. Until there weren't any more. I checked every function and subroutine in our codebase, and they were all used; I checked every possible code path and they were all needed.
What do I do now, I asked? The colleague, who was an expert on VB3 but worked on another project, came and take a look.
"Look at all these small functions you made! No wonder you're running out of space!" Apparently each function created a lot of overhead in the compiled executable. The solution was clear. Combine small functions into large monolithic ones, possibly passing flags in them to do completely unrelated things. Oh, and don't comment on the different parts because we have no room for comments in our code base.
Ah, the good old days.5
So I once had a job as a C# developer at a company that rewrote its legacy software in .Net after years of running VB3 code - the project had originally started in 1994 and ran on Windows 3.11.
As one of the only two guys in the team that actually knew VB I was eventually put in charge of bug for bug compatibility. Since our software did some financial estimations that were impossible to do without it (because they were not well defined), our clients didn't much care if the results were slightly wrong, as long as they were exactly compatible with the previous version - compatibility proved the results were correct.
This job mostly consisted of finding rounding errors caused by the old VB3 code, but that's not what I'm here to talk about today.
One day, after dealing with many smaller functions, I felt I was ready to finally tackle the most complicated function in our code. This was a beast of a function, called Calc, which was called from everywhere in the code, did a whole bunch of calculations, and returned a single number. It consisted of 500 or so lines of spaghetti.
This function had a very peculiar structure:
If SomeVariable Then
If Not SomeVariable Then
(the most important bit of calculation happened here)
But for some reason it actually worked. For days I tried to find out what's going on, where the SomeVariable was being changed or how the nesting indentation was actually wrong and didn't match the source, but to no avail. Eventually, though, after many days, I did find the answer.
SomeVariable = 1
Somehow, the makers of VB3 though it would be a good idea for Not X to be calculated as (-1 - X). So if a variable was not a boolean (-1 for True, 0 for False), both X and Not X could be truthy, non-zero values.
Yesterday I upgraded VS Code (insiders version, i.e daily/beta/etc) to the latest version and ran into a minor bug. I reported an issue in the Github repository, and 40 minutes later got a reply saying It was fixed and I can upgrade to the newest version.
Kudos on Microsoft and the VS Code team!5
Everybody's talking about the 50/50 for some reason, so here's my 2 cents. I've been trying to hire another senior front-end engineer for my team for over two months, and not one half-competent candidate passed our tests yet*. The first one to pass, and I don't care whether it's a male candidate, a female one, or a type of asexual sentient mushroom spore, will get the job.
We do prefer a female candidate because our team is all male at the moment. But that's not going to stop us from hiring a male one if we find anyone.
Also, out of 40ish candidates I've interviewed so far, I believe only 3 were female. Might be a fourth one I can't recall at the moment.5