Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Get a devDuck
Rubber duck debugging has never been so cute! Get your favorite coding language devDuckBuy Now
Search - "annotate"
I was only seventeen back then and I was a Java Developer Intern, not knowing much about enterprise oriented coding.
The project leader in our dev team saw a lot of potential and passion in my work, but was convinced I wasn't taught enough to do the right thing.
I was mainly doing shitty mappers and services back then, which were somewhat used but never lasted long and were ditched a few months later, which always bummed me out. I wanted to make an impact on REAL projects that would deploy into production.
So Mister Mentor (GDPR forbid to use the actual name), who was always first to come and last to leave the office, taught me what it means to code for real.
We stayed after 5pm until 7-8pm multiple times a week and he taught me in a deeply understanding and calm way how to:
- Git (SVN)
- Unit Test
And most importantly:
- How to debug like an absolute BOSS
(We even debugged native Java Libraries just for fun to see if we could break them)
Fast-forward a month later and little intern me made his first commit on production.
Without Mister Mentor, I wouldn't be half as good of a developer as I am today.3
Week 26 advice - you all probably know this but good to refresh!
Annotate your code
Use version control properly
Keep yourself in check with project management tools
Your peers are your friends... And competition.
As much as your boss is an idiot respect them and your life will be easier.
With great power comes great responsibility; don't touch that keyboard until you think through what you are doing chances are your first idea is not the best.
Don't write quick fixes and say you will go back to clean it up later on when you have time. That time will never come.3
I'm currently rewriting perfectly clean and functioning Scala code in Java (because "Enterprise", yay). The amount of unnecessary boilerplate I have to add is insane. I'm not even talking big complicated code but two liners or the lack of simple things like a range from 5 to 10.
Why do I have to write
List<Position> occupiedPositions = placedEntities.stream()
.flatMap((pe) -> pe.occupiedPositions().stream())
instead of simply
val occupiedPositions = placedEntities.flatMap(_.occupiedPositions)
Why on earth does `occupiedPositions.distinct` suddenly become a monstrosity like `occupiedPositions.stream().distinct().collect(Collectors.toList())` where the majority of code is pure boilerplate? And this is supposed to be the new and better Java8 api which people use as evidence that Java is now suddenly "functional" (yeah no, just no).
Why do APIs that annotate parameters with @Nullable throw NullPointerExceptions when I pass a null? Why does the compiler not help prevent such stupidity? Why do we use static typing PLUS those annotations and it still crashes at runtime like every damn dynamic, interpreted language out there? That's not unfortunate, it's a complete waste of time.
Why is a simple idea like a range from x to 10 (in scala literally `x to 10`) not by default included in Java? There's Guava's version of Range which does not have a helper for integer ranges (even though they are the most used ones). Then there's apache.commons version which _has_ a helper for integers, but is strangely not iterable (wtf I don't even...).
Speaking of Iterable: How difficult could it be to convert an abstract Iterable<T> into a concrete List<T>? In scala it's surprisingly `someIterable.toList`. I found nothing like that so I took to stackoverflow where I found a thread in which people suggested everything from writing your own ListUtils helper class, using Guava (which is a huge dependency!) to using the new Java8 features inline (which is still about three lines long). I didn't know this was such a hard problem in computer science, TIL.
How anyone can be productive in this abomination of a language is beyond me now, even though I've used it for many years while learning to code (back then I didn't know there were much better ways to do things). The only good part is that I have to endure this nonsense for only about 3 days longer then I'm free again!12
Day 1 at internship:
Manager: Can you get this RFID tracking system working? We have the full source we just need it installed.
Me: Sure thing, shouldn't take too long if it's a working system.
Me: (opens VS project)
Code is a sprawling abyss devoid of any intelligible structure, commented with broken one-liners which serve only to annotate method names.
For the record the system was broken, took me several weeks to track down all the issues.4
We had this new guy working and we assigned him some work to do. We gave him some time to find the way into the code and figure things out on his own.
Instead of doing that, he wrote a paper of 20 pages why WPF would be way better than what we are doing now. There were many flaws in his document as well. Also on day 2 he used resharper to format some code file. Bye bye annotate! His argument was that resharper knew better. But, our code also uses some reflection, so that got broken. He didn't knew what reflection was and assumed resharper "fixed" it.
He doesn't work here anymore now, he felt he wasn't taken seriously. This is just one of many examples of him though 😂2
When, after trying and debuggin everything else, I realized in the shower, that I forgot to annotate my method.
I don't get why annotations are even allowed for local variables.
Reflection doesn't even work for local variables.
What's the entire purpose to annotate!!!
Am I missing something!!!1
Is there any free software or website one can use where it takes a screenshot or page and you can mark areas on it, then add comments to those areas? (kind of like powerpoint comments, but without the awkward canvas limitation)
Then later the viewer sees instead of huge message bubbles, only those marked areas on top of the screenshot and when he hovers them - sees the comment pop up somewhere.
I remember QA having something like that, but don't remember anything about it. (I think it had a palmtree logo?..)
It would be amazingly useful for clients to just go through screenshots and marking on it "that looks nasty, put ajit pai on it".8
At work, when I try to find the best place to implement some code, I read the current code to get why it's here, and if I'm at the right place to do my stuff.
Sometimes the previous dude writes a shitty code because, well, Drupal 8 and he didn't have much choices to make his stuff work.
But some other times just reading the code feels like double checking if I did all my vaccinations. When these moments occure, I activate the annotate mode in PHPStorm so I can see who wrote this piece of dumb shit code, so I can insult him in my head while doing my stuff.
Sorry pal, I'm not paid enough to write a WORKING code for you at your place, but at least you'd know that if you were drowning, I'd share my point of view about this planet's overcrowding. Fucker.
I always print out a hard copy of whatever code I'm working on, then go through the code and annotate it with a pen until I feel that I have some insight... it's usually either that or I'll just walk away and come back later2
Worst experience: Learning how data is stored in segments in a middleware application called PMS on mainframe and how to manipulate that data.
Best Experience: Building a app that lets you pull down any set of segment data from mainframe and figuring out a way to automatically annotate the data so you could just hover over it and you know what the data is exactly. This way I didn't have to constantly refer back to a reference manual to see what a field name is in a segment, or having to go talk to a mainframe developer to go look at their code. Btw, did I mention I made it searchable by field name??