Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "readable code"
-
Fucking awesome. The 'encryption backdoor law' in Australia went through!
Now, whenever served with such warrants, companies which are active in Australia will have to pay hefty fines if they don't give encrypted messages to law enforcement in readable form. No matter whether this means just decrypting it with the keys they have or pushing backdoors/inject code into the messaging apps/services in order to extract the contents.
Now let's see how much the big companies really care about their users! (I'd expect them to pull out of Australia but the chance that this'll happen is as tiny as about nothing)34 -
A guy on another team who is regarded by non-programmers as a genius wrote a python script that goes out to thousands of our appliances, collects information, compiles it, and presents it in a kinda sorta readable, but completely non-transferable format. It takes about 25 minutes to run, and he runs it himself every morning. He comes in early to run it before his team's standup.
I wanted to use that data for apps I wrote, but his impossible format made that impractical, so I took apart his code, rewrote it in perl, replaced all the outrageous hard-coded root passwords with public keys, and added concurrency features. My script dumps the data into a memory-resident backend, and my filterable, sortable, taggable web "frontend"(very generous nomenclature) presents the data in html, csv, and json. Compared to the genius's 25 minute script that he runs himself in the morning, mine runs in about 45 seconds, and runs automatically in cron every two hours.
Optimized!22 -
programming languages are not designed to talk to computers, they are designed to be readable by other programmers.
please code like it.7 -
Had a PR blocked yesterday. Oh god, have I introduced a memory leak? Have I not added unit tests? Is there a bug? What horrible thing have I unknowingly done?
... added comments to some code.
Yep apparently “our code needs to be readable without comments, please remove them”.
Time to move on, no signs of intelligent life here.39 -
Code: if(customer.primaryContract)
Boss: "just using a variable as a boolean isn't very readable"
Me:
if(!(!customer.primaryContract != !true).toString() == 'false')13 -
Having PHP as my most useful skill.
I know various other languages, but they're either too exotic for professional use, or my knowledge about them doesn't have the same depth as with PHP.
People joke about how awful PHP is, and it's not entirely true. The incongruous stuff such as confusing parameter ordering can be fixed with libraries. And PHP7 fixed a lot of the ugly stuff. A good dev can certainly write structured, readable, performant PHP code.
But there is a real hard limit. PHP is missing more complex type definitions present in other languages. A weak type system is like building stuff with popsicle sticks and bits of duct tape, it works fast and perfectly fine for small projects, but the lack of strictness is a problem when you have thousands of classes intertwined in all kinds of complex factory, service and repository patterns. And the simple type hints are still newish and fully optional, which means a lot of people don't use them.
So I regret getting stuck in this self reinforcing loop, where I learn more about a very imperfect language through employment, and keep rolling into jobs using that skill because it's what I'm most experienced with.16 -
"Pythonists don't comment, they write readable code."
Yea, tell that to the list comprehension with three lambdas21 -
Manager: 'Please remove this checkbox from that page.'
Me: 'Sure thing, it was stupid anyway. Just gimme a couple of minutes.'
Legacy code: 'LOL the checkbox is wired to everything else and if you simply remove it the backend will shit itself. There is several hundred lines of inline Javascript in the HTML template with some Thymeleaf stuff managing the form data or just are there to make the code less readable. The controller for the page is a bit more than a thousand lines of spaghetti, no easy way to find where is that specific data necessary and where can be easily removed. Class variables declared between methods, dozens of nested if statements checking shit in every method and the data is passed through like half a dozen other classes. Good luck with that!'
Me: '💩.'5 -
Debugging somones hacked site now, you know some developer messed up when the heckers injected code is more readable and structured than the actual sites...
-
SUPERVISOR: You wrote this 140 lines method, it's too long. You should split it up, it's not readable
IHateForALiving: Bruh be serious, this is a single switch-case; I can't split it.
SUPERVISOR: Fine, I'll do it.
HIS CODE: He split the 140 lines method into 2 methods: the first is 4 lines long; it's a try-catch surrounding a call to the other method, 136 lines long.9 -
#2 Worst thing I've seen a co-worker do?
Back before we utilized stored procedures (and had an official/credentialed DBA), we used embedded/in-line SQL to fetch data from the database.
var sql = @"Select
FieldsToSelect
From
dbo.Whatever
Where
Id = @ID"
In attempts to fix database performance issues, a developer, T, started putting all the SQL on one line of code (some sql was formatted on 10+ lines to make it readable and easily copy+paste-able with SSMS)
var sql = "Select ... From...Where...etc";
His justification was putting all the SQL on one line make the code run faster.
T: "Fewer lines of code runs faster, everyone knows that."
Mgmt bought it.
This process took him a few months to complete.
When none of the effort proved to increase performance, T blamed the in-house developed ORM we were using (I wrote it, it was a simple wrapper around ADO.Net with extension methods for creating/setting parameters)
T: "Adding extra layers causes performance problems, everyone knows that."
Mgmt bought it again.
Removing the ORM, again took several months to complete.
By this time, we hired a real DBA and his focus was removing all the in-line SQL to use stored procedures, creating optimization plans, etc (stuff a real DBA does).
In the planning meetings (I was not apart of), T was selected to lead because of his coding optimization skills.
DBA: "I've been reviewing the execution plans, are all the SQL code on one line? What a mess. That has to be worst thing I ever saw."
T: "Yes, the previous developer, PaperTrail, is incompetent. If the code was written correctly the first time using stored procedures, or even formatted so people could read it, we wouldn't have all these performance problems."
DBA didn't know me (yet) and I didn't know about T's shenanigans (aka = lies) until nearly all the database perf issues were resolved and T received a recognition award for all his hard work (which also equaled a nice raise).7 -
Me trying to install a software :
1. Download the binary file
2. Error this file can't be executed
3. Download the source code
4. Compile
5. Error - instruction not supported by this OS
6. Create a new disk partition
7. Download ubuntu
8. Install ubuntu
9. Apt-get install
10. Error - package not readable by this version of ubuntu
11. Kill myself4 -
Why is the ternary operator such a hated thing? I constantly hear people saying it's less readable, confusing, etc.
I think it's a beautiful, useful, and important operator and I use it constantly wherever readability won't be much affected.
How can you justify a repetitive if/else structure over a ternary, given that you're sure you're not going to put anything else in the ifs?
Whatever happened to DRY?
Whatever happened to KISS?
If those guidelines are what you code by, what's the excuse not to use it?
Because you can't read it as well? Familiarity breeds comprehension and legibility, my dudes.15 -
I spent yesterday refactoring a JavaScript file and it was so fucking bad that I wasn't containing my frustration to the point it git blamed it to make sure I wasn't "wtfing" my boss's code, I wasn't so I went on a rampage.
Anyone who looked at me yesterday would see a pissed off dev with the highest rate of wtf/minute to the screen gesturing and force palming constantly.
I'm a back end dev.
I made a front end code have 90% (?!?!?!) less code, more readable and I can say for sure 10x faster.
There was a fucking setTimeout() with 5 seconds delay to do something that doesn't even need to wait...
Fuck this shit lol.2 -
Hey. This code look broken. What should I do?
It isn't broken. It's doing what it's supposed to.
Well, it's hard to follow, but it certainly doesn't look right. And it isn't doing what I expect. Also, why is it calling method(a_class1_or_class2) with a class3?
It isn't hard to follow, and it works just fine. Let me show you. ... huh. looks like it isn't right. and there's a comment here saying the calls aren't clear. but it works just fine. Just copy it over and do it the same way.
I already did that. and it isn't working.
What are you talking about? Of course it works fine. Did you check your code?
------
Really, dude? It doesn't work fine. but, guess what? It works fine* when I change it to call that method with a class2 like it asks for. (Surprise!) But I can't tell him that. Nope. Bossmang get offended. Still won't admit I was right about anything, either.
Ahh... the continual joy of working with (and for) trash.
* well, more fine; the rest of the feature is still wrong. but nope, i'm not allowed to fix it. because why would they want anything to work properly? Already-accepted wrong behavior is good enough. Can't clean up the code, either, because that "muddies the waters." Bitch, I couldn't see the bottom of this sewer if it was half an inch deep! Which is more important: the last contributor entry beside the code, or that code being readable and maintainable? or it, you know, working?
doot doot.
need to scoot.8 -
Deleted over 1'500 lines of code over the last 2 days and replaced it with 80 lines of readable, simple, generic code.
And I'm feeelin' gooood 🎶7 -
Among my fellow developers at work, there is one guy who stands out because he actually strives to write modular, reusable and readable code. He literally saved me weeks of development by making his code modular enough that I can simply use it almost like a mixin where I only need to provide an alternative template. Note that the feature I'm talking about is for a pretty much sophisticated business process related to handling credit card data. Others in my workplace would just couple their logic tightly with their feature/scope's views.
I really wanna hug him and be his BFF now. #nohomo tho.9 -
Fuck off cancerous piece of shit on stackoverflow whose dick is an obvious inverse proposition to ego and incapablility to read.
I asked if there's "clean" way, of doing something. I provided my solution to the problem
Your answer and coments make it pretty obvious that you:
* don't really care about (code) quality
* value your reputation just as much as some teen on facebook sucking cook for likes or whatever they use now
* downvoted my question because you can't handle critique in the slightest
* You immediately replied with "but op said..." even though I am the fucking op and if I say _imo_ a fucking for-loop within function is less readable than 3 chained function-calls it and does not include the feature I asked for, it means you have to justify your answer and not get triggered and downvote my fucking question.
After I confronted him about this shit he just said "If you had studied the language for more than 10 minutes you would have known than you can't do that."
And if you had some a basic reading skill you could improve my workaround or tell me just that, instead of providing me with that useless information you vomited out just to get some ez SO reputation.
Piece of shit didn't even deny the anyyhing.
Shove a vibrator up your ass until it arrives at your skull and activate it. Maybe that will stimulate your brain or hopefully upgrade it.
I don't care how much "reputition" you may have "earned" on the internet. I am not afraid to call your bullshit or your sheer pathetic existence out.
People like this are are the reason SO gets so much hsge and even tough I got an improved version for my workaround (from an other user), I'm nowhere near happiness.
Note, the Useful-to-retarded-ratio is
1: 3rant i want to punch prople over the internet stackoverflow is being a downvote bitch waste of oxygen8 -
Background: I'm proficient at PowerShell, I was told that I got hired to my previous job (as DevOps engineer) mainly because of that skill.
Few months after I started I wrote a script to automate some processes. My boss saw the script and told me that it was too complicated, and that I should make it more simple.
Now I'm all into clean code, meaningful names, small functions.
So the code was readable and maintainable.
I asked him in what way is it complicated. He didn't know exactly. (Later I figured that he didn't know of some of the (built-in) cmdlets and functions I used.)
He raised his hand high and made a gesture and explained that I'm "that high (skill? enthusiasm?)", then lowered his hand to a lower position to mark the bottom line, then raised it up half way up and said that he wants me here - in the middle.
After that he added: "This is not Microsoft! and we don't own the 3 other buildings that can be seen from our office window" and pointed at the window.
I was surprised by his comment, I didn't know how to respond.
I've got more stories to share about that workplace.
I can't believe I stayed at that place for 1 year and 2 months.16 -
This happens to me all the time at my new company, the amount of wtfs I say in some js files, man...1
-
Found a post by G.R. on Linkedln:
"A lazy programmer is also often a good programmer:
- Writes little code to achieve the goal
- Automates all boring jobs
- He does not develop things he does not know yet
- Sleeps at night, then make sure that if the shutdown occurs, the system will restart
- He knows he forgets things, then writes readable and not cryptic code
- Try to reuse what he did
- He does not like copy-paste (too boring to keep)
It takes training to be lazy"
Love this quote11 -
Okay, I love programming - making my code better faster more readable^^ but I am not a nerd, I have no idea what's going on in star wars or star trek, I do not fucking care about Game of Thrones - I prefer to go out in some clubs and so... I hate it when people are so fucking surprised about my job and interests.
There are programmers who are not nerds live with it!21 -
People argue all the time what text editor is the best: VSCode, Sublime, NP++, Emacs, Nano, Vim, etc.
I just remembered when I used to do my HTML, CSS and JS in regular Windows Notepad, as a requirement in my Web Developement classes...
I think some good came from that, I picked up a habit of writing my code very neatly, easily readable.17 -
Ever had the feeling "My code is working fine but I know it's so messy and I should make it readable for others!"
-Never done anything13 -
One thing I learnt after over two years of working as a programmer is that sometimes making your code DRY is less important than making your code readable, ESPECIALLY if you're working on a shared codebase. All those abstractions and metaprogramming may look good in your eyes, but might cause your teammates their coding time because they need to parse your mini-framework. So code wisely and choose the best approach that works FOR YOUR TEAM.7
-
Developers
that
put
every
line
of
code
on
a
new
line
Why??????? Seriously this shit is not making it more readable you know12 -
TL.DR.: Emojis in commit messages + bad commit messages made by Microsoft™ employees.
Yes, I'm looking at you Microsoft. It would be helpful if I can, you know, understand your commit messages instead of trying to guess wtf _that_ emoji means. That is, if it is the same emoji on my machine. We didn't figure that one out yet. And no, "Some 💄 changes ✨" is not a good commit message, even if you interpret it correctly (which depends on your emoji icon set).
idk about you, but that shitty 💄 emoji tends to be (see image) and I happen to associate that with an XLR audio cable. I had to ask someone else to understand a commit message; a message supposed to be explicit—stating what you changed and optionally why you changed it (you can off-load that part to an issue tracker).
Furthermore, that "Some 💄 changes ✨" commit did none of that. "I made cosmetic changes somewhere for some reason without linking to an issue." If you didn't catch that little detail yet: "COSMETIC CHANGES" is vague as fuck. What is a cosmetic change?
* Does a cosmetic change mean adjusting indentation?
* Does it mean deleting unnecessary abstraction to make the code more readable?
* Does it mean refactoring code to add that beauty factor?
* Does it mean all of the above? Or perhaps a specific combination of these?
Human communication is shit enough, don't make it worse than it already is.22 -
CR: "Add x here (to y) so it fits our code standards"
> No other Y has an X. None.
CR: "Don't ever use .html_safe"
> ... Can't render html without it. Also, it's already been sanitized, literally by sanitize(), written by the security team.
CR: "Haven't seen the code yet; does X change when resetting the password?"
> The feature doesn't have or reference passwords. It doesn't touch anything even tangentially related to passwords.
> Also: GO READ THE CODE! THAT'S YOUR BLOODY JOB!
CR: "Add an 'expired?' method that returns '!active'?"
> Inactive doesn't mean expired. Yellow doesn't mean sour. There's already an 'is_expired?' method.
CR: "For logging, always use json so we can parse it. Doesn't matter if we can't read it; tools can."
CR: "For logging, never link log entries to user-readable code references; it's a security concern."
CR: "Make sure logging is human-readable and text-searchable and points back to the code."
> Confused asian guy, his hands raised.
CR: "Move this data formatting from the view into the model."
> No. Views are for formatting.
CR: "Use .html() here since you're working with html"
> .html() does not support html. It converts arrays into html.
NONE OF THIS IS USEFUL! WHY ARE YOU WASTING MY TIME IF YOU HAVEN'T EVEN READ MY CODE!?
dfjasklfagjklewrjakfljasdf5 -
Well, if your tests fails because it expects 1557525600000 instead of 1557532800000 for a date it tells you exactly: NOTHING.
Unix timestamp have their point, yet in some cases human readability is a feature. So why the fuck don't you display them not in a human readable format?
Now if you'd see:
2019-05-10T22:00:00+00:00
vs the expected
2019-05-11T00:00:00+00:00
you'd know right away that the first date is wrong by an offset of 2 hours because somebody fucked up timezones and wasn't using a UTC calculation.
So even if want your code to rely on timestamps, at least visualize your failures in a human readable way. (In most cases I argue that keeping dates as an iso string would be JUST FUCKING FINE performance-wise.)
Why do have me parse numbers? Show me the meaningful data.
Timestamps are for computers, dates are for humans.3 -
As someone in charge of reviewing this code, how would you react to this function that contains, what could be, the longest ever readable return statement.19
-
I have a junior who really drives me up a wall. He's been a junior for a couple of years now (since he started as an intern here).
He always looks for the quickest, cheapest, easiest solution he can possibly think of to all his tickets. Most of it pretty much just involves copy/pasting code that has similar functionality from elsewhere in the application, tweaking some variable names and calling it a day. And I mean, I'm not knocking copy/paste solutions at all, because that's a perfectly valid way of learning certain things, provided that one actually analyzes the code they are cloning, and actually modifies it in a way that solves the problem, and can potentially extend the ability to reuse the original code. This is rarely the case with this guy.
I've tried to gently encourage this person to take their time with things, and really put some thought into design with his solutions instead of rushing to finish; because ultimately all the time he spends on reworks could have been spent on doing it right the first time. Problem is, this guy is very stubborn, and gets very defensive when any sort of insinuation is made that he needs to improve on something. My advice to actually spend time analyzing how an interface was used, or how an extension method can be further extended before trying to brute-force your way through the problem seems to fall on deaf ears.
I always like to include my juniors on my pull requests; even though I pretty much have all final say in what gets merged, I like to encourage not only all devs be given thoughtful, constructive criticism, regardless of "rank" but also give them the opportunity to see how others write code and learn by asking questions, and analyzing why I approached the problem the way I did. It seems like this dev consistently uses this opportunity to get in as many public digs as he can on my work by going for the low-hanging fruit: "whitespace", "add comments, this code isn't self-documenting", and "an if/else here is more readable and consistent with this file than a ternary statement". Like dude, c'mon. Can you at least analyze the logic and see if it's sound? or perhaps offer a better way of doing something, or ask if the way I did something really makes sense?
Mid-Year reviews are due this week; I'm really struggling to find any way to document any sort of progress he's made. Once in a great while, he does surprise me and prove that he's capable of figuring out how something works and manage to use the mechanisms properly to solve a problem. At the very least he's productive (in terms of always working on assigned work). And because of this, he's likely safe from losing his job because the company considers him cheap labor. He is very underpaid, but also very under-qualified.
He's my most problematic junior; worst part is, he only has a job because of me: I wanted to give the benefit of the doubt when my boss asked me if we should extend an offer, as I thought it was only fair to give the opportunity to grow and prove himself like I was given. But I'm also starting to toe the line of being a good mentor by giving opportunities to learn, and falling behind on work because I could have just done it myself in a fraction of the time.
I hate managing people. I miss the days of code + spotify for 10 hours a day then going home.11 -
Sad. Got a new job. Apparently, readable code is not a priority. My suggestions were being ignored. Does the benefits of condensing an if-else to a simple one-line return statement really that hard to understand? Does making clean and readable code should be an optional thing to consider? It doesn't help that I'm the youngest, they felt like I don't have enough street cred. I'm starting to hate my job.11
-
Dev: Ok refactor this following block of code to make it more readable/maintainable while still ensuring the tests pass
*** Block is an absolute mess of nested ternaries, poorly named functions, single letter variables and outdated comments. An underhand pitch if there ever was one ***
Interview Candidate: Why would you refactor code if the tests are already passing?
Dev: …… NEXT.7 -
SICK AND TIRED OF READABILITY VS. EFFICIENCY!!!!!!!
I HAD TO SEPARATE A 4 LOC JSON STRING, WHICH HAD AN ARRAY OF A SINGLE KEY-VALUE PAIRS (TOTAL OF 10 OBJECTS IN THE ARRAY).
ITS READABLE IF YOU KNOW JSON. HOW HARD IS TO READ JSON FORMAT IF YOU GET YOUR STYLE AND INDENTATION PROPERLY?!?
SO I HAD TO
BREAK THE POOR FREAKING JSON APART TO A FUCKING DIFFERENT YAML FILE FORMAT ONLY SO I CAN CALL IT FROM THERE TO THE MAIN CONTROLLER, ITERATE AND MANIPULATE ALL THE ID AND VALUES FROM YAML BACK TO MATCH THE EXPECTED JSON RESPONSE IN THE FRONT END.
THE WHOLE PROCESS TOOK ME ABOUT 15 MINUTES BUT STILL, THE FUCKING PRINCIPLE DRIVES ME INSANE.
WHY THE FUCK SHOULD I WASTE TIME AT AN ALREADY WORKING PIECE OF CODE, TO MAKE IT LESS EFFICIENT AND A SLIGHTLY BIT MORE READABLE?!? FML.5 -
Last week our department drama queen was showing off Visual Studio’s ability to create a visual code map.
He focused on one “ball of mud”, vilifying the number of references, naming, etc and bragging he’s been cleaning up the code. Typical “Oooohhh…this code is such a mess…good thing I’m fixing it all..” nonsense. Drama queen forgot I wrote that ‘ball of mud’
Me: “So, what exactly are you changing?”
DK: “Everything. It’s a mess”
Me: “OK, are any of the references changing? What exactly is the improvement?”
DK: “There are methods that accept Lists. They should take IEnumerables.”
Me: “How is that an improvement?”
<in a somewhat condescending tone>
DK: “Uh…testability. Took me almost two weeks to make all the changes. It was a lot of work, but now the code is at least readable now.”
Me: “Did you write any tests?”
DK: “Um…no…I have no idea what uses these projects.”
Me: “Yes you do, you showed me map.”
DK: “Yes, but I don’t know how they are being used. All the map shows are the dependencies.”
Me: “Do you know where the changes are being deployed?”
DK: “I suppose the support team knows. Not really our problem.”
Me: “You’re kinda right. It’s not anyone’s problem.”
DK: “Wha…huh…what do you mean?”
Me: “That code has been depreciated ever since the business process changed over 4 years ago.”
DK: “Nooo…are you sure? The references were everywhere.”
Me: “Not according to your map. Looks like just one solution. It can be deleted, let me do that real quick”
<I delete the solution+code from source control>
Me: “Man, sorry you wasted all that time.”
I could tell he was kinda’ pissed and I wasn’t really sorry. :)2 -
Is it just me who sees this? JS development in a somewhat more complex setting (like vue-storefront) is just a horrible mess.
I have 10+ experience in java, c# and python, and I've never needed more than a a few hours to get into a new codebase, understanding the overall system, being able to guess where to fix a given problem.
But with JS (and also TS for that matter) I'm at my limits. Most of the files look like they don't do anything. There seems to be no structure, both from a file system point of view, nor from a code point of view.
It start with little things like 300 char long lines including various lambdas, closures and ifs with useless variables names, over overly generic and minified method/function names to inconsistent naming of files, classes and basically everything else.
I used to just set a breakpoint somewhere in my code (or in a compiled dependency) wait this it is being hit and go back and forth to learn how the system state changes.
This seems to be highly limited in JS. I didn't find the one way to just being able to debug, everything that is. There are weird things like transpilers, compiler, minifiers, bablers and what not else. There is an error? Go f... yourself ...
And what do I find as the number one tipp all across the internet? Console.log?? are you kidding me, sure just tell me, your kidding me right?
If I would have to describe the JS world in one word, I would use "inconsistency". It's all just a pain in the ass.
I remember when I switcher from VisualStudio/C# to Eclipse/Java I felt like traveling back in time for about 10 years. Everyting seemd so ... old-schoolish, buggy, weird.
When I now switch from java to JS it makes me feel the same way. It's all so highly unproductive, inconsistent, undeterministic, cobbled together.
For one inconveinience the JS communinity seems to like to build huge shitloads of stuff around it, instead of fixing the obvious. And noone seems to see that.
It's like they are all blinded somehow. Currently I'm also trying to implement a small react app based on react-admin. The simplest things to develop and debug are a nightmare. There is so much boilerplate that to write that most people in the internet just keep copying stuff, without even trying to understand what it actually does.
I've always been a guy that tries to understand what the fuck this code actuall does. And for most of the parts I just thing, that the stuff there is useless or could be done in a way more readable way. But instead, all the devs out there just seem to chose the "copy and fix somehow-ish" way.
I'm all in for component-izing stuff. I like encapsulation, I'm a OOP guy by heart. But what react and similar frameworks do is just insane. It's just not right (for some part).
Especially when you have to remember so much stuff that is just mechanics/boilerplate without having any actual "business logical function".
People always say java is so verbose. I don't think it is, there is so few syntax that it almost reads like a prose story. When I look at JS and TS instead, I'm overwhelmed by all the syntax, almost wondering every second line, what the actual fuck this could mean. The boilerplate/logic ration seems way to off ..
So it really makes me wonder, if all you JS devs out there are just so used to that stuff, that you cannot imagine how it could be done better? I still remember my C# days, but I admin that I just got used to java. So I can somehow understand that all. But JS is just another few levels less deeper.
But maybe I'm just lazy and too old ...4 -
maybe I'm really pedantic, but I fucking hate people who write code without a consistent form or style... putting spaces or breaks randomly or not at all is SO fucking annoying and I'm wasting time converting it to a more readable form... THEY FUCKING COULD HAVE DONE THAT IN THE FIRST PLACE FOR FUCK SAKE!!13
-
Just read an article that really grinds my gears. Its about coding in other languages. Not programming languages, but literally other languages.
Btw I learned to code in Spanish and I'm not against coding in programming languages using variable names in other languages.
That's fine.
What pissed me off was that the author claimed that we should be able to code Fucking JavaScript in SWAHILI or other languages available. What kind of PC bullshit is that!
Coding is barely fucking readable and now we have to make standards for Multilanguage support. Just learn the less than 60 reserved words you lazy fuck and code with them! I leaned to code with shitty tutorials in Spanish and theres no 1000x resources out there and this author claims you can't code unless you know english.
Granted. It's easier but wtf not just learn it. When I coded in Java in Spanish, I didn't know wtf a Class was or ags meant. So what. I memorized that shit. How? By coding!
Why bring this PC shit to programming? The author thinks there are few programmers bc we don't support fucking SWAHILI in JavaScript. Fuck no!
Now if you want to support this initiative. Think of this,
...legacy code
...in 32+ languages.
Have fun debugging this thing.14 -
What the f...
minified and obfuscated javascript code is more readable then the c# code of my colleague jeez...👹😡 what the f4 -
That moment when you replace
If (blablabla) {
return Yes;
}
else {
return No;
}
with
return blablabla;
And it not passed code review because "We should have readable code"2 -
Languages like python and R are some-what high level languages, with an easy syntax and very readable code. This useful essentially to make it easier for non-programmers to use it. For me as a software developer with +4 years of professional programming. I started with Assembly, Quick-Basic to C++, Java then C#, I found Python super convenient, and at times way too convenient.
At first it felt like I was cheating, and would not consider myself actually writing code, more like pseudo-coding.
After a year or so, I got used to it and it became my default, but it still does not feel right .. is anyone else feeling the same?
I do believe that coding the hard way is not always the right way, but I am just wired that way.17 -
Today on "How the Fuck is Python a Real Language?": Lambda functions and other dumb Python syntax.
Lambda functions are generally passed as callbacks, e.g. "myFunc(a, b, lambda c, d: c + d)". Note that the comma between c and d is somehow on a completely different level than the comma between a and b, even though they're both within the same brackets, because instead of using something like, say, universally agreed-upon grouping symbols to visually group the lambda function arguments together, Python groups them using a reserved keyword on one end, and two little dots on the other end. Like yeah, that's easy to notice among 10 other variable and argument names. But Python couldn't really do any better, because "myFunc(a, b, (c, d): c + d)" would be even less readable and prone to typos given how fucked up Python's use of brackets already is.
And while I'm on the topic of dumb Python syntax, let's look at the switch, um, match statements. For a long time, people behind Python argued that a bunch of elif statements with the same fucking conditions (e.g. x == 1, x == 2, x == 3, ...) are more readable than a standard switch statement, but then in Python 3.10 (released only 1 year ago), they finally came to their senses and added match and case keywords to implement pattern matching. Except they managed to fuck up yet again; instead of a normal "default:" statement, the default statement is denoted by "case _:". Because somehow, everywhere else in the code _ behaves as a normal variable name, but in match statement it instead means "ignore the value in this place". For example, "match myVar:" and "case [first, *rest]:" will behave exactly like "[first, *rest] = myVar" as long as myVar is a list with one or more elements, but "case [_, *rest]:" won't assign the first element from the list to anything, even though "[_, *rest] = myVar" will assign it to _. Because fuck consistency, that's why.
And why the fuck is there no fallthrough? Wouldn't it make perfect sense to write
case ('rgb', r, g, b):
case ('argb', _, r, g, b):
case ('rgba', r, g, b, _):
case ('bgr', b, g, r):
case ('abgr', _, b, g, r):
case ('bgra', b, g, r, _):
and then, you know, handle r, g, and b values in the same fucking block of code? Pretty sure that would be more readable than having to write "handeRGB(r, g, b)" 6 fucking times depending on the input format. Oh, and never mind that Python already has a "break" keyword.
Speaking of the "break" keyword, if you try to use it outside of a loop, you get an error "'break' outside loop". However, there's also the "continue" keyword, and if you try to use it outside of a loop, you get an error "'continue' not properly in loop". Why the fuck are there two completely different error messages for that? Does it mean there exists some weird improper syntax to use "continue" inside of a loop? Or is it just another inconsistent Python bullshit where until Python 3.8 you couldn't use "continue" inside the "finally:" block (but you could always use "break", even though it does essentially the same thing, just branching to a different point).19 -
I (don't) like how some people say "If your code needs comments, your code is probably ugly and should be rewritten".
Well, asshats. You have never considered complex calculations/functions or "temporary" workarounds, right?
Sometimes, you have to do it in a not-very-readable way for efficiency. There is no way around that in that case, and comments that either explain the code below or provide alternative, slower code that's commented really help others understand your code.
If I ever work with you and you don't bother commenting your code at all (or rather use slow code because more efficient code doesn't appeal to your "muh code dun need comments" approach), I will hate you.6 -
that feeling when your (thrice) refactored code executes literally 1000 times faster.
loading excel ranges into vba arrays and process these is much faster than comparing the ranges themselves. also much more readable. please don't throw rocks at me for don't knowing this in advance.6 -
So.... yeah, making a Scratch clone (with more features) is frustrating and super hard.
Major problems include
- Drag&Drop from listbox to usercontrol - stress level : 3/10
- connect blocks when two blocks are close to each other - stress level : 10/10
- generate live code when there was a change in blocks editor - stress level : 9/10
- write a compiler or some interpreter that converts block code to real c# code - stress level : 10/10
- generate output by calling csc.exe - stress level : 1/10
- make code at least readable - stress level : 7/1014 -
young user @Mizukuro asked days ago for ways to improving his javascript skills.
I wasn't sure what to say at the moment, but then I thought of something.
Lodash is the most depended upon package in npm. 90k packages depend on it, more than double than the second most depended upon package (request with 40k).
Lodash was also created 6 years ago.
This means lodash has been heavily tested, and is production ready.
This means that reading and understanding its code will be very educational.
Also, every lodash function lives in its own file, and are usually very short.
This means it's also easy to understand the code.
You could start with one of the "is..." (eg isArray, isFunction).
The reason for such choice is that it's very easy to understand what these functions do from their name alone.
And you also get to see how a good coder deals with js types (which can be very impredictible sometines).
And to learn even more, read the test file for that function (located in tests/<original file name>.js. For the most part they are very readable and examples of very good testing code.
Here's the isFunction code
https://github.com/lodash/lodash/...
Here's the test for isFunction
https://github.com/lodash/lodash/...
The one thing you won't learn here is about es5, 6, or whatever.3 -
Katie, we get it, you know and like Scala. You mention this often.
It doesn't make you superior to everyone else. And it certainly doesn't mean you have to pretend every language is Scala, ignore any language-specific paradigms and conventions, and bastardise every bit of code you write until it's done in the most weirdly Scala-ish functional way possible even when it makes zero sense to do so.
Stick with the conventions of the existing language & codebase you muppet. Yeah, it's boring and won't turn you on, but it's a hell of a lot more readable than a random bastardised mixin in the middle of another existing inheritance hierarchy.8 -
Just because you can do things in one line and throw in ternary operators everywhere, doesn't mean you should.. other people will touch your code. Make it readable instead of making it harder to maintain8
-
!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 -
I never thought clean architecture concepts and low complicity, maintainable, readable, robust style of software was going to be such a difficult concept to get across seasoned engineers on my team... You’d think they would understand how their current style isn’t portable, nor reusable, and a pain in the ass to maintain. Compared to what I was proposing.
I even walked them thru one of projects I rewrote.. and the biggest complaint was too many files to maintain.. coming from the guy who literally puts everything in main.c and almost the entire application in the main function....
Arguing with me telling me “main is the application... it’s where all the application code goes... if you don’t put your entire application in main.. then you are doing it wrong.. wtf else would main be for then..”....
Dude ... main is just the default entry point from the linker/startup assembly file... fucken name it bananas it will still work.. it’s just a god damn entry point.
Trying to reiterate to him to stop arrow head programming / enormous nested ifs is unacceptable...
Also trying to explain to him, his code is a good “get it working” first draft system.... but for production it should be refactored for maintainability.
Uggghhhh these “veteran” engineers think because nobody has challenged their ways their style is they proper style.... and don’t understand how their code doesn’t meet certain audit-able standards .
You’d also think the resent software audit would have shed some light..... noooo to them the auditor “doesn’t know what he’s talking about” ... BULLSHIT!9 -
I'm a contractor at a product company and today I had the pleasure of working with some jQuery.
A function needed to be called before another function, hard work right?
So I moved the call to the function 3 rows higher, checked it in, set the task as ready for test and started to look for other tasks.
Within a couple of minutes I get a direct message from another dev, let's call him Steve.
Steve wanted me to set the task to ready for code review instead of test, so I did just that and tried to move on.
Some minute or two later Steve contacts me again:
"It would be great if you'd move the comment so it'd be over the call to the function"
Well, I'm not one of those who likes comments... If you need a comment, it's probably not good/readable code. In some cases sure, it might be a complex block coming up.
Sorry, lost my train of thought.
I answered Steve : "Are you sure, I could just remove it instead?"
(for readability S will be Steve and M will be me)
S: Well, it's always good to have comments
M: In this case I think it will be alright.
S: But it's nice to see what the function is doing.
M: I'll do it if you really want me to.
S: It's better to have the comment than to not have it and needing it.
M: Okay then
The name of the function : LoadOrganizationTree()
And this is the comment :
//Load organization tree6 -
As a pretty solid Angular dev getting thrown a react project over the fence by his PM I can say:
FUCK REACT!
It is nigh impossible to write well structured, readable, well modularized code with it and not twist your mind in recursion from "lift state up" and "rendercycle downwards only"
Try writing a modular modal as a modern function component with interchangeable children (passeable to the component as it should be) that uses portals and returns the result of the passed children components.
Closest I found to it is:
c o d e s a n d b o x.io/s/7w6mq72l2q
(and its a fucking nightmare logic wise and readability wise)
And also I still wouldn't know right of the bat how to get the result from the passed child components with all the oneway binding CLUSTERFUCK.
And even if you manage to there is no chance to do it async as it should be.
You HAVE to write a lot of "HTML" tags in the DOM that practically should not be anywhere but in async functions.
In Angular this is a breeze and works like a charm.
Its not even much gray matter to it...
I can´t comprehend how companies decide to write real big web apps with it.
They must be a MESS to maintain.
For a small "four components that show a counter and fetch user images" - OK.
But fo a big webapp with a big team etc. etc.?
Asking stuff about it on Stackoverflow I got edited unsolicited as fuck and downvoted as fuck in an instant.
Nobody explained anything or even cared to look at my Stackblitz.
Unsolicited edit, downvote, closevote and of they go - no help provided whatsoever.
Its completely fine if you don't have time to help strangers - but then at least do not stomp on beginners like that.
I immediately regretted asking a toxic community like this something that I genuinely seem to not understand. Wasn't SO about helping people?
I deleted my post there and won't be coming back and doing something productive there anytime soon.
Out of respect for my clients budget I'm now doing it the ugly react way and forget about my software architecture standards but as soon as I can I will advise switching to Angular.
If you made it here: WOW
Thank you for giving me a vent to let off some steam :)13 -
Gotta love kotlin!
@osiris1337 the refactoring is going great
I had a 80 lines long model class with all the getters and setters and Parcelable interface implemented
and all of that converted to kotlin like this
@-psr another reason, small and readable code ^_^1 -
After noticing 4 operations in a single line, I comment a pr stating the line is not simple to read as there are many operations which can be, especially in the eyes of a junior, hard to read.
I proceed to suggest a better solution.
Colleague: “what??? How is this not readable??? Is it [op1], [op2], [op3] or [op4]? 🤷♂️”
I kindly explain this person that it’s not about the single operations, but the fact they are all on a line. Inside an object assignment.
Colleague: “you should learn stuff! (4 links to websites giving that snippet of code”
Ah yes, the oldie: “but other people are jumping off a cliff, why don’t WE do it???”5 -
My internship company does not believe in the concept of 'commenting'. They just tell me: "Ahh just write readable code!
Yeah that's cool until I need to read out thousands of lines of javascript without a single comment!5 -
Code languages should stay within their designated file extensions! I'm having to work with SQL in .resx files at the moment! Then there's HTML which is like a skitty little travelling monkey that I've found blundering about in SQL strings before, let alone people trying to sneak it into .js files, which is one reason I chose Angular over React btw (and don't give me that bullshit of separations of concerns vs separation of technologies).
It is mostly trivial to work with separate files across languages and doing so gives you the benefits of that languages support in the text editor or IDE you are using. It becomes easier to work with, the behaviour is predictable and it is formatted in a readable manner, ultimately reducing the potential for mistakes. Stop trying to make me put everything in strings!!1 -
I’m all for writing boolean statements that are readable, quick to grasp the real life case they’re representing and align with the spec rather than being ultra-reduced, but sometimes the spec is written by someone who clearly can’t reduce logic. So when the spec says “if it’s not the case that any of them are false” and you write:
!(!a || !b || !c || !d)
then I think you should try harder. At least put a note against the spec to say “i.e. if they’re all true” and then write the sensible code. Just think of the poor developer that might have to augment your code at a later date and has to follow and intercept that shite. -
!rant
I figured out a way to make your code readable!
The main idea: make everything into a function. Each function should be small and you should gradually use past functions to build future functions.
Depending on the language and the size of your code you should make your functions with different sizes, but always keep them small.
This function splitting allows for debugging small parts of your code, avoids repetition and abstracts your code, each making it more readable.13 -
Enlightened my colleague on the concept of JS promises, chaining of events, multiple deferrals...
Ah, his code is looking much readable already! -
writing a whole god damn function in one single line doesn't make it "one liner" and it DOESN'T make your code better and more readable!!!2
-
String someStr = "your name";
// but i wanna capitalize it
someStr.capitalize(); // <-- operation has no effect
// ughh, fine 😒
String cappedStr = someStr.capitalise();
// wish I could just do this:
someStr .= capitalize(); // but it throws error 😩16 -
TL;DR:
JuniorDev ignores every advice, writes bad code and complains about other people not working because he does not see their result because he looks at the wrong places.
Okay, so I am really fed up right now.
We have this Junior Dev, who is now with us for circa 8 months, so ca. a year less than me. Our first job for both of us.
He is mostly doing stuff nobody in the team cares about because he is doing his own projects.
But now there's a project where we need to work with him. He got a small part and did implement that. Then parts of the main project got changed and he included stuff which was not there anymore. It was like this for weeks until someone needed to tell him to fix it.
His code is a huge mess (confirmed by senior dev and all the other people working at the project).
Another colleague and me mostly did (mostly) pair programming the past 1-2 weeks because we were fixing and improving (adding functionality) libraries which we are going to use in the project. Furthermore we discussed the overall structure and each of us built some proof-of-concept applications to check if some techniques would work like we planned it.
So in short: We did a lot of preparation to have the project cleaner and faster done in the next few weeks/months and to have our code base updated for the future. Plus there were a few things about technical problems which we need to solve which was already done in that time.
Side note: All of this was done not in the repository of the main project but of side projects, test projects and libraries.
Now it seems that this idiot complained at another coworker (in our team but another project) that we were sitting there for 2 weeks, just talking and that we made no progress in the project as we did not really commit much to the repository.
Side note: My colleague and me are talking in another language when working together and nobody else joins, as we have the same mother tongue, but we switch to the team language as soon as somebody joins, so that other colleague did not even know what we were talking about the whole day.
So, we are nearly the same level experience wise (the other colleague I work with has just one year more professional experience than me) and his work is confirmed to be a mess, ugly and totally bad structured, also not documented. Whereas our code is, at least most of it, there is always space for improvement, clean, readable and re-useable (confirmed by senior and other team members as well).
And this idiot who could implement his (far smaller part) so fast because he does not care about structure or any style convention, pattern or anything complains about us not doing our work.
I just hope, that after this project, I don't have to work with him again soon.
He is also one of those people who think that they know everything because he studied computer science (as everybody in the team, by the way). So he listens to nothing anybody explains to him, not even the senior. You have to explain everything multiple times (which is fine in general) and at some points he just says that he understood, although you can clearly see that he didn't really understand but just wants to go on coding his stuff.
So you explain him stuff and also explain why something does not work or is not a good thing, he just says "yes, okay", changes something completely different and moves on like he used to.
How do you cope with something like this?6 -
I have always believed that clean code is readable code, and if your code is readable, then it shouldn't require masses of comments to explain it. However, in the course I am being taught, we are being told that in programming, comments are massively important to help another developer understand your code and what it does. So what is the consensus of the dev community?
Do you feel comments are key, or redundant if your code is written well?20 -
(I guess the Question category is the best for this)
Do you believe that someone can be a good dev even if they write shit code?
I personally do, if that person acknowledges the fact that their code is shit, wants to improve it, is humble, is always in the search for constructive, etc as in to make their code better and more readable, I'd think they are a pretty good dev.2 -
Tried to reply to @Fast-Nop who had replied to someone wondering if C would be a good first language.
IMHO C should have been put to sleep ages ago. A few years ago I downloaded the latest, greatest C Standard. For a language billed as small and simple (by many) it was over 800 pages long. Still there's a lot that's unspecified like order of evaluation of function arguments. Int etc is implementation dependent. And error handling, let's not go there. The macro assembler throws away all the semantics leaving behind a cryptic value. It's a complex language due to the innumerable interactions possible.
It's been called assembly language for the PDP-11 minicomputer. Recently learned that even the VAX-1 was built from SSI chips like the 4-bit 74181 ALU. The VAX.
Anyway I had several excellent books on programming style written by Henry Ledgard. He despaired of making C look readable. I commend his books which are so old that the code is UPPERCASE A lot of he wrote had to do with program design, naming things, writing good comments and that the visual shape of a program assists mental clarity.23 -
It's a constant battle of getting the code finished, and having it look readable. It's so easy to fall into the downward spiral of bad coding.
-
So.... a while ago my non tech friends asked me to help with their game... As all of the devs out there who wish to make a game or work in HW company I decided to say YES....
Basicly the game was a 2D infinite runner and when I looked at it it seemed like it was allmost ready, but it was not :D
The codebase was horrible.... Non of those two knew how to write scripts properly.... Half of the time I spent trying to teach both of them how to code properly and make the code readable for other coders..... After that most of the time went in troubleshooting 3rd-party plugins regarding google play services and fixing anoying performance issues.....
And last friday we launched it for Android https://goo.gl/MZpjf9
I'm really proud of my non tech friends because they withstood my complaining about the sourcecode and learned a lot of new thing these past months!!! It was a pleasure making this with them..... I know that the game is simple and it could have been done in much shorter time, but part of the expirience is fun and making things happen with your friends!!!1 -
!rant
if you're someone who grades code, fuck you, you probably suck. Turned in a final project for this gis software construction class as a part of my master's degree (this class was fuck all easy, I had two weeks for each project, each of them took me two days). We had to pick the last project, so I submitted final project proposal that performs a two-sample KS test on some point data. Not complex, but it sounds fancy, project accepted. Easy money.
I write the thing and finish it, it works, but it doesn't have a visualization and that makes the results seem pretty lame, even though its fully functional. SO I GO OUT OF MY FUCKING WAY to add a matplotlib chart of the distribution. To do that, at the very bottom of the workflow, I define a function to chart it out because it made the code way more readable. Reminder, I didn't have to do this, it was extra work to make my code more functional.
Then, this motherfucker takes points off because I didn't define the function at the very beginning of the code... THE FUCK, DUDE? But, noobrants, it's "considered best prac--" nope, fuck you, okay? This class was so shit, not once was code style addressed in a lesson or put on any rubric - they didn't give a shit what it looked like - in fact, the whole class only used arcpy (and the csv mod once), they didn't teach us shit about anything except how to write geoprocessing scripts (in other words, how to read arcGIS docs about arcpy) and encouraged us to write in fucking pythonwin. And now, when the class is fucking over, you decide to just randomly toss this shit in, like it was a specific expectation this whole time? AND you do this when someone has gone out of their way to add functionality? Why punish someone who does extra work because that extra work isn't perfect? Literally, my grade would have been better without the visualization.
I'm not even mad at my grade - it was fine - I just hate inconsistency in grading practices and the random raising and lowering of expectations depending on how some grader's coffee tasted that morning. I also hate punishing people for doing more - it's this kind of shit that makes people A) wanna rip their eyeballs out, and B) never do anything more than the basic minimum expectation to avoid extra unwanted attention. If you want your coders to step up and actually put work in to make things the best they can be, yell at a grader to reward extra work and not punish it.4 -
We have a new hire, and he doesn't know much so he is receptive when given feedback on better ways to handle a situation...Or at least, he appears that way. Until the next time and he didn't listen at all.
Today I'm working on the front end to match his API calls. I ask him about a list of options for one of the fields, as he didn't provide that info initially. No worries, there was a lot, easy to miss. He responds with a list of ~100 options, which he copied and pasted from, I'm assuming, their documentation. I tell him that's too many options to hard code, as there is an easy chance to have an error or for there to be one added or deleted, and ask if there is an API endpoint to get the list.
He then asks if I need the key and value, or just key. I tell him if he needs the value(human readable) then he can send me just the value, otherwise both. He says he just needs the key, so I let him know that I need both then, as the value is human readable. He says okay.
He proceeds to make the endpoint, I test it. Then I look at the code he wrote. Not only did he not send me both, he just sent the keys, but he hard coded all 100 keys as opposed to making the call to the external API.3 -
I'm curious..
When does programming suck for you, and when is it fun?
Like I hate programming, when I run into an obscure use case that opens up some serious errors with my some, or gasp, all, of my architecture and forces me to rethink everything - especially DB design, ugh.
I love programming when my architecture and DB design create naturally readable code and everything falls into place and I feel like a genius.
I guess, in short.... plan before you code?
And then, plan again.
But don't plan too much.
The love/hate of my programming life summed up right there I think.
How about you?10 -
My insta story: Hey geeks, I started a new project. It will be the AI code human readable maker and simplifier. Coding started,will be up soon..
Project progress:8 -
Fuck pep8 in general. Fuck harder anything to do with line limits. Fuck with a rusty spatula those who tie it into their git precommits or CI tests.
What's that, it's 2018 and even the shittiest walmart-tier computers have 1080p OR BETTER at a 16:9 aspect ratio?
"lol, 80 character line limit."
Eat a bucket of rancid dicks.
Oh, and since we're forcing you to be so economical with your characters, we're going to force four space tabs. Yknow, rather than simple single tab characters, which could mean everyone can set their preferred level of spacing without bloating the code with whitespace.
Because, yknow, it's entirely reasonable to chew up 1/8 of a line because you're editing a function inside a class definition. God Almighty forbid you try to do a for loop inside that function! Fuck you!
"Oh but you can't have two editors or terminals open side by side without that limit!"
BULL FUCKING SHIT. Here's my shitty 1280x1024 display on my shitty computer with two Sublime editors open side by side. You'll notice the break is at 100 characters. You'll notice I don't have to scroll horizontally to do two things at once. You'll notice I even have room for COMMENTS!
If your code standards require you to make your code *less* readable and *less* clear and take up *more* space to accomplish the same tasks, YOUR CODE STANDARDS SUCK!
Enough with this stupid meme. We're not in the 80s anymore and it's high time to start fucking acting like it.7 -
How do you debate the "it's more complex in my opinion" statement?
So, some months ago I was looking at some code which has stuff as 300 lines of code function(s) and I could feel the bad smell irl...
I analyze it a bit and there is a lot of stuff which is misplaced, repeated or unsafe.
I first re-arrange it and remove redundancy, then break it down in about five functions (plus a caller), all is now readable and assignIcon k(made-up name) only assigns an icon, it doesn't also send a rocket in space.
But then I put the code in review and the previous author of the code says that it's now unreadable, because s/he has to look as multiple functions. I counter by showing how s/he does not need to read 300 lines of code to find a bug, but approximately 60, and I point at how misleading having an `assignIcon` function which also sends rockets in space is.
The counter? "But it looks confusing to have smaller functions, revert it."
How would you debate that? I am shy and hate myself a lot, so I have issues debating good points, but I am really really sure a lot of bugs I encountered were due to stuff like this so I would like to be able to explain my point in a more efficient way, for future teams.12 -
Recently, I had to make a minor modification to some Node.js code a coworker wrote a year ago which buffers stringified JSON into Kinesis. I just needed to add a new key to the input object, it took minutes to make the change, but hours to make sense out the absolute trash spaghetti code this guy wrote. After spending half a day trying to make his code readable, I just got so pissed off. I replaced his 15 files/+1,500 lines of uncommented code, filled with classes, factory functions, poorly named functions and vars, and so, so many spelling mistakes.
We now have a single, well commented, 300 line file that does the same thing.
Get that shit code out of here. -
It is easy to believe something is over-engineered as a junior. You open a solution and get slapped in the face with a wet fish of many classes, with strange names, doing very little, with everything coming together in ways you don't understand.
My advice is to learn about design patterns, clean code, clean architecture, and model driven design. Until that point I don't think you can make such a distinction. And indeed once knowledgeable of patterns and techniques as well as the domain, the same solution can look obvious, elegant and readable.
In a field where everyone is saying 'dont over-engineer', one must be able to tell if something is actually bad, or just uses techniques you don't recognise.
Telling your senior you think something is over done just because you don't understand it is not good. First learn techniques, understand the code, then form opinions that are at least relevant then.
From someone who committed that crime.4 -
The primary concept of reactive programming is great. The idea that things just naturally re-run when anything they rely on is changed is amazing. Really, I think it's the next step in programming language development and within a decade or two at least one of the top 5 programming languages will be built entirely on this principle.
BUT
Expecting every dependency to be used unconditionally is stupid. Code that checks everything it might need all the time even if a decision can be made from much less information is simply bad, inefficient code. If you want to build a list of dependencies automatically, you have to parse the source.
And I really hate that there are TONS of languages that either make the AST readable at runtime or ship with a very powerful preprocessor that could be used to analyse expressions and build dependency lists, but by its sheer popularity the language we're trying to knead into something it was never and still isn't meant to be is JavaScript.3 -
const abc: string = 'Hi';
Can we take a moment to appreciate how retarded it is that TSlint throws a warning here that the string type is inferred and unnecessary.
I want to put the type there because it looks more readable. Code looks better if every variable has a type, irrespective of whether it's a constant. I know the fucking type is inferred you braggart linter bitch. What the fuck does it expect? A fucking award because it inferred that a string constant is of the fucking type string? How the ever loving fuck does that warrant a squiggly ass yellow warning line, reminiscent of that smartass 10 year old in class who has to yell out every answer when the teacher never asked a question.5 -
I've created a code review for merging someone else's code, coz they were signed off sick for the last month.
They're making comments about how it's wrong.
It's code they wrote, but restructured to be more readable.
They wrote incorrect code that was just so illegible they didn't realise.
How do I explain this diplomatically?10 -
That moment when, after you've spent days trying to refactor your code to be clean and readable, you look at what you've made and you honestly feel like you actually made things worse than before.1
-
Just because OO exists, it's not mandatory.
Some code would be 10(+) times simpler, more readable and more maintainable without it.7 -
I've been offline from devrant for a while now but damn, I need to vent this shit
One of my colleagues can't describe tickets well enough, so I often have to speak to my colleague about it what he/she ments with their description (usually the ticket description is one line… that's all)
But yesterday the ticket was quite ok, I got were he/she was going for
Conveniently my colleague walked by at the end of yesterday and asked me how it was going
I responded quite energetic 'quite well, ticket is almost done'
And when I showed my colleague the result he/she said, well I got some feedback this morning, and we need to move X to Y with Z data
But you don't get the full story, this project exists of a very old abandoned framework (2013). Hacked together to work for more than one customer (but still copied over to run standalone) with the last year of development being focused on fast results (no time given to workout bugs or refactoring for cleaner/readable code)
So now I have to (on a feature that already took me 3 days to build) remove roughly 25% of the code and hacks, and hack a solution together..
This shit is demotivating as fuck...1 -
I'm curious, what was the most ridiculously otherworldly, the least understandable, eye-opening code you have every seen?
BUT, I mean that in a good way. And what did you learn from it?
For me personally, I would probably say some of the c++ stdlib implementations. Just totally not English in some places. I mean seriously, sometimes asm is more readable than c++15 -
Wrote this little script to generate a Rant of a given user based on his Existing Rants
Code:
https://gist.github.com/theabbie/...
REST Endpoint:
https://devrant-gefgjr8gnr28.runkit.sh/...
Rant won't be very readable though.35 -
Use that Tab button. It's there for a reason. If you are too lazy to use it then use an IDE that formats the code.
Also learn to comment your code wherever needed and in English. If you don't know where it's needed, Google is your friend if not your senior. -
Work rant :
I once had a code review and remembered I forgot to comment my code and said sorry I forgot to comment it out.
The reply I got?
Don't worry, here we say your code should be readable enough and no comments are required.
Im still amazed, like... Even if the code is readable, fuck this I need a tl;Dr comment for the long ass fucking code... What the fuck5 -
Some cheapskate insists on writing a guide to selfhost <software> on Heroku and wants to add it to the official documentation, promising to maintain it (since none of the other devs are using or planning to use Heroku). I volunteer to give them a chance on grounds of it being high quality and maintained by that person in the future which they both promise.
Our docs are written as markdown files on github.
So here we go:
Starts a pull request: uploads their """guide""" as a docx. The content is completely unformatted, basically just an enumerated list.
Tell them to format it as markdown, suggest using github gists.
They go ahead and copy pasta their unformatted list into a gist.txt "allright i made it into gist for ya"
Tell them that they did not format it as markdown.
"sorry updated it in markdown :P"
I look at the file, it is still raw text in a gist.txt. Maybe a bit more spaced out, not that I would care to notice any changes at this point.
Tell them it is still not markdown and link them to a perfect example of another guide that takes advantage of code fragments for commands etc and is properly rendered since it uses .md
"I updated it to the markdown this time XP Can you give me some suggestions on how it looks?"
"How it looks"... "how it LOOKS"... I click the link for the 5th time and IT IS STILL JUST A RAW FUCKING GIST.
Jfc that person has some serious reading/thinking disability. To imagine them to be proactively keeping their guide up to date in the future is absolutely impossible. At that point I pulled out my support for the request since it was already taking more effort to even get a readable version of guide than I estimated for the whole process of adding it.
Oh, and one of the steps originally suggested in the """guide""" was adding the credentials file into the vcs.2 -
I need to vent or I'm going to fucking explode like a car filled with bombs in motherfucking Iraq...
A couple of months ago I inherited a project in development from our team leader who was the sole developer on it and he was the one who designed every single thing in it.
I was told the project is clean, follows design patterns, and over all the code is readable and easy.
Those were all fucking lies.
See throughout the period he was working on it, I saw some of the code as it was going through some pull requests. I remember asking the dev why he doesn't comment his code? His response was the most fucking condescending shit I've ever heard: "My code is self-documenting"...
Now that I have full control over the code base I realize that he over engineered the shit out of it. If you can think of a software design pattern, it is fucking there. I'm basically looking at what amounts to a personal space given to that dev to experiment with all kind of shit.
Shit is way too over engineered that I'm not only struggling to understand what the hell is going on or how the data flows from the database to the UI and in reverse, I'm now asked to finish the remaining part and release it in 8 weeks.
Everything is done in the most complicated way possible and with no benefits added at all.
Never in my career have I ever had to drag my sorry ass out of bed to work because I always woke up excited to go to work... well except for the last 2 weeks. This project is now taking a mental toll and is borderline driving me crazy.
Oh, did i tell you that since he was the only dev with no accountability whatsoever, we DO NOT EVEN KNOW WHAT IS LEFT TO BE IMPLEMENTED?
The Project Manager is clueless.. the tickets board is not a source of truth because tickets set to resolved or complete were actually not even close to complete. FUCK THIS SHIT.
For the last week I've been working on 1 single fucking task. JUST 1. The whole code base is a mine field. Everything is done in the most complicated way and it is impossible for me to do anything without either breaking shit ton of other features (Loosely coupled my ass) or getting into fights with all the fucking libraries he decided to use and abuse.
1 whole week and I can't even get the task done. Everyday I have to tell the project manager, face to face, that I'm still struggling with this or that. It's true, but i think the project manager now thinks i am incompetent or just lazy and making excuses.
Maybe I'm not smart enough to understand the what and why behind every decision he made with this code. But I'm sick to my stomach now thinking that I have to deal with this tomorrow again.
I don't know if I'll make the deadline. But I'm really worried that when this is released, I'll be the one maintaining that nightmare of a code base.
From now on, if i hear a fucking developer say their code is "self-documenting" I will shove my dick + a dragon dildo + an entire razor gaming keyboard up their ass while I shoot their fucking knees off.
oh... and there are just a couple of pages of documentation... AND THEY ARE NOT COMPLETE.2 -
!rant
All computers are great and not all people are compilers
please use a Semicolon for God's sake
Though coding is competence
I believe in readable code2 -
Well this is the thing. I have been starting to replace a lot of my shit with Golang. I think it is a great language because of one small fact: it is a boring language.
With this I don't mean that it is not incredibly fun to use. It is and honestly I feel that a lot of the concepts that I had from C passed quite nicely with some additions. The language does not do anything special and there is no elegant code. It works in a very procedural fashion without taking into consideration any of the snazzy things found in JS, Python, c# etc etc. Interfaces and struct make sense to me, way more than oop does in other languages. I don't need generics with the use of interface parameters and I have hadly found a situation in which I have to strive too far away from the way things are done with Go to be happy with it, then again my projects are not hard or by any means groundbreaking (most of them deal with logistics or content management and a couple of financial apps that I am rewriting in Go from work)
The outcome is fast and easy to read since idiomatic go is for the most part very readable(no people...single letter variable names are by no means a standard and they should feel ashamed from it)
I miss the idea of a framework, but not so much and the docs and internal code for Go is just way top inviting. I believe the code to be readable enough than anyone that has gotten used to the syntax and ideas of the language can just jump in and start learning. This is the first language that I have learnt from studying the code as it is inside of the standard lib, the same I cannot say for any other language or framework.
Also, it play beautifully nice with vs code.
I dunno man, I feel that I am doing something wrong. I have projects built in Node, php, python, ruby and spring java as well as .net core and I still find Golang way more appealing simply because it goes harder than Python with "one preferred way" to do things.
The lang does not make me feel like a pro, i certainly develop in it at pro speeds, but it was made with beginners in mind to built fast and concurrent apps, with the most minimal syntax possible.
I guess my gripe with it is that it gets shunned from this, saying that it ignored years of lang research to make it as dumbed down as possible. Which it did, lack of generics amongst other things certainly make it seem like, but I will not say that it was poorly designed. Not at all, I believe it is a testament of amazing engineering. To be able to create such a simple yet amazingly powerful language.
Wish there were more to it. Wish there was a nice gui lib or a ml framework comparable to the ones offered by python and java. But I guess such things will come with time.
I feel stupid with this language.
And that is fine.5 -
I'm writing a ML course that explains concepts by going through/getting the reader to write simple implementations of concepts. I've written a decision tree in 250 lines of code (including plotting it), that is 100 times faster than another (hilariously bad) attempt at a simple decision tree, and it's far more readable than anything else I've seen.
I'm having a good day.6 -
That cringeworthy moment when you end up updating code you wrote two years ago as an amateur. Sigh, massive OCD attack settling in, I have a feeling I'm going to put in a few extra hours just so I can turn this blob of sticky code into something decent/readable.
-
I get really angry when my friend (has only ever taken a web design class in high school that taught only basic html) tries to preach to me that you shouldn't have to worry about writing readable code along with documenting it so long as it works the way you want it to.1
-
Just a quick rant on JavaScript,
So there’s a lot of people hating javascript, and while not a long time ago i was part of them, but I changed my opinion a little.
I think JavaScript is a great way to deal with website programming as it is quick and efficient, but I would not say to program directly on it, use a js-compilable language (CoffeScript, TypeScript, Kotlin(I think), etc.), but then you might say: “Well, no need for js then, compile it in byte code”. That would break the point of how I see web design/dev. The main intent behind webpages is to have an easy and fast way to send code to other computers to render them, that’s why it is interpreted: “Easy to send” and “*All* computers can handle it” with the proper browser. You need to be able to change the way the website is rendered and/or works sometimes, for diverse reasons like copy/pasting data, make it render properly or use plugins/add-ons to change that code to suit your needs.
I think js should be kept as a “readable byte-code”, so that means: {
Keep comments when compiling the js-compilable code,
Add standardized machine-readable comments that will indicate to smart code viewers how to show a particular thing (Like have a higher-end function compiled in js shown as a minimized code with explanations of the function)
Keep it nicely formated and don’t obfuscate (coz that’s annoying)
Etc.
}
So you bypass the quirks and all that pesky js stuff, while keeping it’s good sides.
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Part 2:
Web design for non-web:
Ok so things like node.js, electron, react-native and all that stuff; I won’t say they’re bad but...
Why we have this is because web designers wanted to make desktop apps and were like “Hey! Making web pages is easy! Let’s port it to desktop”, the problem is: Web technologies were made to work on a restricted canvas, aka a browser. It’s good on web for reasons mention earlier and more. But it’s not on desktop! You’re trying to push it outside of those boundaries. It’s difficult to make it break that canvas and go outside, make something that really works! For social media clients and that kind of stuff that you want to make a little more inclusive, yes! it’s a great idea (hello devrantron ;), but not if it’s an exact same copy of the website, just use the website. But for things that are supposed to really make use of YOUR computer; no!
I see those PWA (progressive webapps aka mobile app, but it’s an offline website”), I stand for the same positions, social media and those sort of things: yes, great idea! Games? 🤢.
I have way more to say but I have difficulties to remember them while reading, so feel free to comment your thoughts
Lol, “just a quick rant”1 -
Dear devs, making your software "work" is the least thing you do as a dev. Write tests, write readable, maintainable, extensible code, and ensure that your code runs sufficiently fast and efficiently. Also consider using the right tech for your use case and nature the of the software. It's your job to ensure that your software runs efficiently and effectively, and stop saying "it works" and end there. God forbid you use bubblesort and say it works or do some dumb **** like that.1
-
Always make your code readable before you stop working on it.
Not just for other people to learn from but also for yourself.
Context: just lost about 3 months of progress because everytime I look at this file I feel like starting over... -
When I was in school I was in a vocational school and my program was a Computer Service and Networking class and that’s what it taught it’s pretty self explanatory. BUT we also did some programming.
I was the only one interested in programming really considering everyone else loved the hardware. But when they would ask for help it was awful.
The book we used didn’t format the python properly on the page so you can’t really tell if there’s an indent if you dont know python well (they didn’t) which is okay.
But what isn’t okay is asking me for help and SENDING ME A FUCKING VIDEO OF THE COde LIKE FUCKING WHAT THE HELL MAN THAT SHIT ISNT EVEN READABLE AND YOUR HAND IS SHAKING LIKE YOURE HAVING A STROKE AT LEAST SEND ME THE CODE OR WORST CASE A PICTURE.
This happened more than once. 😤6 -
My friend sent me this as WYSIWYG
/* A simple quine (self-printing program), in standard C. */ /* Note: in designing this quine, we have tried to make the code clear * and readable, not concise and obscure as many quines are, so that * the general principle can be made clear at the expense of length. * In a nutshell: use the same data structure (called "progdata" * below) to output the program code (which it represents) and its own * textual representation. */ #include <stdio.h> void quote(const char *s) /* This function takes a character string s and prints the * textual representation of s as it might appear formatted * in C code. */ { int i; printf(" \""); for (i=0; s[i]; ++i) { /* Certain characters are quoted. */ if (s[i] == '\\') printf("\\\\"); else if (s[i] == '"') printf("\\\""); else if (s[i] == '\n') printf("\\n"); /* Others are just printed as such. */ else printf("%c", s[i]); /* Also insert occasional line breaks. */ if (i % 48 == 47) printf("\"\n \""); } printf("\""); } /* What follows is a string representation of the program code, * from beginning to end (formatted as per the quote() function * above), except that the string _itself_ is coded as two * consecutive '@' characters. */ const char progdata[] = "/* A simple quine (self-printing program), in st" "andard C. */\n\n/* Note: in designing this quine, " "we have tried to make the code clear\n * and read" "able, not concise and obscure as many quines are" ", so that\n * the general principle can be made c" "lear at the expense of length.\n * In a nutshell:" " use the same data structure (called \"progdata\"\n" " * below) to output the program code (which it r" "epresents) and its own\n * textual representation" ". */\n\n#include <stdio.h>\n\nvoid quote(const char " "*s)\n /* This function takes a character stri" "ng s and prints the\n * textual representati" "on of s as it might appear formatted\n * in " "C code. */\n{\n int i;\n\n printf(\" \\\"\");\n " " for (i=0; s[i]; ++i) {\n /* Certain cha" "racters are quoted. */\n if (s[i] == '\\\\')" "\n printf(\"\\\\\\\\\");\n else if (s[" "i] == '\"')\n printf(\"\\\\\\\"\");\n e" "lse if (s[i] == '\\n')\n printf(\"\\\\n\");" "\n /* Others are just printed as such. */\n" " else\n printf(\"%c\", s[i]);\n " " /* Also insert occasional line breaks. */\n " " if (i % 48 == 47)\n printf(\"\\\"\\" "n \\\"\");\n }\n printf(\"\\\"\");\n}\n\n/* What fo" "llows is a string representation of the program " "code,\n * from beginning to end (formatted as per" " the quote() function\n * above), except that the" " string _itself_ is coded as two\n * consecutive " "'@' characters. */\nconst char progdata[] =\n@@;\n\n" "int main(void)\n /* The program itself... */\n" "{\n int i;\n\n /* Print the program code, cha" "racter by character. */\n for (i=0; progdata[i" "]; ++i) {\n if (progdata[i] == '@' && prog" "data[i+1] == '@')\n /* We encounter tw" "o '@' signs, so we must print the quoted\n " " * form of the program code. */\n {\n " " quote(progdata); /* Quote all. */\n" " i++; /* Skip second '" "@'. */\n } else\n printf(\"%c\", p" "rogdata[i]); /* Print character. */\n }\n r" "eturn 0;\n}\n"; int main(void) /* The program itself... */ { int i; /* Print the program code, character by character. */ for (i=0; progdata[i]; ++i) { if (progdata[i] == '@' && progdata[i+1] == '@') /* We encounter two '@' signs, so we must print the quoted * form of the program code. */ { quote(progdata); /* Quote all. */ i++; /* Skip second '@'. */ } else printf("%c", progdata[i]); /* Print character. */ } return 0; }6 -
Title: The problem with "good enough" code
Body:
I'm a software developer, and I've seen my fair share of "good enough" code. You know the kind of code I'm talking about: it works, but it's not pretty, and it's not very maintainable.
The problem with "good enough" code is that it's a slippery slope. Once you start writing "good enough" code, it's easy to fall into the trap of always taking the easy way out.
Before you know it, your code is a mess of hacks and workarounds. It's hard to understand, it's hard to maintain, and it's a nightmare to debug.
I've seen projects go down in flames because of "good enough" code. The code was so bad that it was impossible to fix, and the project had to be scrapped.
I'm not saying that you should never write "good enough" code. Sometimes, you just need to get something working, and you don't have the time or resources to do it perfectly.
But if you're going to write "good enough" code, you need to be aware of the risks. And you need to make sure that you're only writing "good enough" code for a short period of time.
Once you have a working prototype, you need to start refactoring your code and making it better. You need to make it more readable, more maintainable, and more testable.
If you don't, you'll eventually regret it. Your code will become a liability, and it will hold you back.
So next time you're tempted to write "good enough" code, think twice. It might save you some time in the short term, but it will cost you in the long run.7 -
I felt so good after revisiting a project and everything runs ok
Code readable
Managed to pick off where I left off and fixed some existing bugs
Added new features and uploaded the update2 -
My biggest influence on coding style is working with other people's code. I know the temptation to write "clever" code and I've been (and probably still occasionally am) guilty of it myself, but it's not until you have to debug someones oneliner iterator which has !(i-j) as the stop condition that you start to appreciate dumb, boring, obvious code.
If having a series of if checks in a long list makes it readable, keep it that way. If it makes it more readable to rewrite it into a nested switchcase with a couple of ternary bits, go ahead. Just don't spend half a day wrapping it up into two layers of abstraction that will require an onboarding process for the rest of the team.2 -
I always do reformatting my code to keep it clean and readable, so I have a reflex of doing it a lot of time.
Even on a file with thousand of lines with several persons working on it
but I hate to see that in my changes, 95% of my changes are random tabs that my auto reformatting erases.2 -
I need some opinions on Rx and MVVM. Its being done in iOS, but I think its fairly general programming question.
The small team I joined is using Rx (I've never used it before) and I'm trying to learn and catch up to them. Looking at the code, I think there are thousands of lines of over-engineered code that could be done so much simpler. From a non Rx point of view, I think we are following some bad practises, from an Rx point of view the guys are saying this is what Rx needs to be. I'm trying to discuss this with them, but they are shooting me down saying I just don't know enough about Rx. Maybe thats true, maybe I just don't get it, but they aren't exactly explaining it, just telling me i'm wrong and they are right. I need another set of eyes on this to see if it is just me.
One of the main points is that there are many places where network errors shouldn't complete the observable (i.e. can't call onError), I understand this concept. I read a response from the RxSwift maintainers that said the way to handle this was to wrap your response type in a class with a generic type (e.g. Result<T>) that contained a property to denote a success or error and maybe an error message. This way errors (such as incorrect password) won't cause it to complete, everything goes through onNext and users can retry / go again, makes sense.
The guys are saying that this breaks Rx principals and MVVM. Instead we need separate observables for every type of response. So we have viewModels that contain:
- isSuccessObservable
- isErrorObservable
- isLoadingObservable
- isRefreshingObservable
- etc. (some have close to 10 different observables)
To me this is overkill to have so many streams all frequently only ever delivering 1 or none messages. I would have aimed for 1 observable, that returns an object holding properties for each of these things, and sending several messages. Is that not what streams are suppose to do? Then the local code can use filters as part of the subscriptions. The major benefit of having 1 is that it becomes easier to make it generic and abstract away, which brings us to point 2.
Currently, due to each viewModel having different numbers of observables and methods of different names (but effectively doing the same thing) the guys create a new custom protocol (equivalent of a java interface) for each viewModel with its N observables. The viewModel creates local variables of PublishSubject, BehavorSubject, Driver etc. Then it implements the procotol / interface and casts all the local's back as observables. e.g.
protocol CarViewModelType {
isSuccessObservable: Observable<Car>
isErrorObservable: Observable<String>
isLoadingObservable: Observable<Void>
}
class CarViewModel {
isSuccessSubject: PublishSubject<Car>
isErrorSubject: PublishSubject<String>
isLoadingSubject: PublishSubject<Void>
// other stuff
}
extension CarViewModel: CarViewModelType {
isSuccessObservable {
return isSuccessSubject.asObservable()
}
isErrorObservable {
return isSuccessSubject.asObservable()
}
isLoadingObservable {
return isSuccessSubject.asObservable()
}
}
This has to be created by hand, for every viewModel, of which there is one for every screen and there is 40+ screens. This same structure is copy / pasted into every viewModel. As mentioned above I would like to make this all generic. Have a generic protocol for all viewModels to define 1 Observable, 1 local variable of generic type and handle the cast back automatically. The method to trigger all the business logic could also have its name standardised ("load", "fetch", "processData" etc.). Maybe we could also figure out a few other bits too. This would remove a lot of code, as well as making the code more readable (less messy), and make unit testing much easier. While it could never do everything automatically we could test the basic responses of each viewModel and have at least some testing done by default and not have everything be very boilerplate-y and copy / paste nature.
The guys think that subscribing to isSuccess and / or isError is perfect Rx + MVVM. But for some reason subscribing to status.filter(success) or status.filter(!success) is a sin of unimaginable proportions. Also the idea of multiple buttons and events all "reacting" to the same method named e.g. "load", is bad Rx (why if they all need to do the same thing?)
My thoughts on this are:
- To me its indentical in meaning and architecture, one way is just significantly less code.
- Lets say I agree its not textbook, is it not worth bending the rules to reduce code.
- We are already breaking the rules of MVVM to introduce coordinators (which I hate, as they are adding even more unnecessary code), so why is breaking it to reduce code such a no no.
Any thoughts on the above? Am I way off the mark or is this classic Rx?16 -
I hate it when someone says 'syntactic sugar' and on the other hand wants code to be readable. For me it seems that this are wheels which chain together.1
-
A prototype being used as production code written in procedural PHP with the code drawn using echo and MySQL (not MySQLi) all mixed together and the configuration with world readable database stored as config.inc.
All backed by a database with no foreign keys or data integrity of any kind. -
Classmate: I'm done with this
I read his code
Me: Good. But could you make that a little bit more.. readable?
Classmate: Eh..what?
Me: Or use one or two lists less.. and the naming
Classmate: But I need them all!
It's a square around a coordinate within given borders, not rocket science.1 -
For all things, for all men, that a man compliments a thing does not imply that this man at least attempts to understand this thing. However, for all men, that a man criticises a thing implies that this man at least attempts to understand this thing.
For all computer programs, that a computer program is terrible implies that scrapping the current implementation of this computer program and beginning anew may be the best method of fixing this computer program.
With few exceptions, for all programming languages $l$, given sufficient effort, $l$ source code can be human-readable.
The UNIX philosophy never became outdated.
For all computer programs $p$, $p$ should be written sufficiently well that the author of $p$ can be prideful of $p$.
For all computer programs $p$, a specification for $p$ should be written before $p$ is created.
For all good computer programs, a good computer program can run on terrible hardware.
Every clock cycle is valuable.8 -
My company ex-IT Maintainer, left a long automation script in c++, bit of python 2, and bash for our server which developed long before i went to junior high school. and now, the system is outdated, and have a compability problems. so i got task to give it a fix.
when i opened the source code up. i was like; holy shit who the hell write a code especially c++ all aligned to the left, Yes All of it, not a single line are indented. but in the other side the code seems maintainable, and after autoformat, autoindent and couple of fix later, it was readable. I am just wondering who the hell in the world write a code with a style like that ???? i knew he was aware of code style and indentation since he wrote couple of python scripts. Unbelievable.
sadly i cannot show you the pict cuz of company things. -
!!rant
Today I wanted to finish a feature in some Python code I. Working on instead I scope creeped myself a bunch times adding "other cool features" and refactoring working and readable code that didn't need refactoring. Oh and learning about random things on SO and finally giving up on making any more progress for the day and reading devrant.
ADHD Self:"Coding is love, coding is life. Plus I'm getting paid."
....
Responsible self: "Wait no, go home sleep, spend time with your wife"
Remembering self:" she's out with friends"
Responsible self: "ah, carry on, she's probably spending more money than you're making" -
I am working in a cool company where during our coding principles conversation , I was giving a walkthrough of my code. I accepted some valid criticism. Shit hit the fan, when my I tried to explain it to them why I have written modules and the necessity of them in this application. So instead of writing several functions , I have created a common module for handling these tasks . After a lengthy argument , I am told that I should write understandable and lengthy code instead of complex and small one. This is what I think so too, that code should be readable by human but at some point , one also has to look decide if this practice is suitable for every carse or not. Man this is fucking killin me. Then I am also told that to rewrite the code and write it in such a way that's naive and easy to understand
-
Today I‘ve been investigating a freeze in our app. It took me many hours to narrow it down to the textfield validation regex. And it turned out to be a "catastrophic backtracking" issue.
I‘m a regex noob so I don‘t have a clue how it occurs exactly. But I‘m a bit perplexed about what a seemingly innocent regex can cause.
For me it became another argument against regex now.
I‘ve rewritten the regex into readable code and the freeze is gone.
I could try to fix the regex but… nah. The code is better anyway.7 -
Although iv only been developing in android for around 7 months yet I fail to see the appeal of Kotlin.
It has no real advantage over Java. In my opinion its fucking lazy code. It might look pretty but that's about it. So I don't see why employers are opening their arseholes for people with Kotlin experience.
Im pretty sure they are doing it because its "the next big thing". If you can write solid Java I dont know what the big deal is.. Maybe someone can shed some light on this..
Android studio can convert Java to Kotlin with one click. So No Mr employer I do not see your reason why you employed someone over me because he has Kotlin experience. Its fucked!! So that project I handed you... the one where I had pride in my ability to apply solid Java... Yes remember fucking Java everyone?!... well it works exactly the fucking same and in my opinion is much more verified and readable. SOOOO FUCK YOUUUU MR EMPLOYER!!!!! Go FuckYourStupidLittleKotlinBumChumsRightInTheirShitRiddenFuckHoles!!!!!!
Rant over...3 -
Talking with my dad about a program he's been working on at his company. He doesn't work on it directly, he works with parts on the side to show to clients. He's basically a sales rep that shows some cool features.
Me: is this that the program where it converts scanned items into readable text?
Him: yes but it does a little bit more than that.
*promptly goes into detail about how it works*
Basically merges documents together based on some criteria that it needs to meet. There are 5 cases and all of it is coded in sql, the 5 cases aren't coded based upon logic but based on each possible outcome of a scenario. And it would brute force it's way to a solution. The way he explained it made me think it was just mountains of spaghetti code.
I couldn't help but think something like this
00000
00001
00002
00003
It just sounded messy. And I haven't even looked at it.
Me: 😬 why would you design it that way?
Him: because it works.
Me: but the code has to be so unmaintainable
Him: well I don't have to look at it full time.
Me:... (flawless logic... But why¿¡¿¡¿😢) -
Today, coworker looked at some code of mine and asked me why I was repeating code and doing things foolishly, I told him I just wanted it to work and would make it pretty after. It felt really good making my code readable after knowing that it already worked.1
-
Reading code takes time!
Everytime I read:
"var" or "auto" Add: 10s
- Just use the type
Everytime I read:
if(Expression1 && Expression() ? GetNumber() : 0 > 0) Add: 30s
- Just write two if statements or create two bools the line above.
Everytime I read:
delegate = () => {} Add another 5 minutes of reading time.
- Just write a separate function for it. It helps with searching and understand what it does
Please code like the person that needs to check your code or change it just knows basic coding skills and logics.
I do know all these concepts I just never use them because it makes the code unreadable. hard to follow, mistakes that can happen everywhere. difficult to search.
And it frustrates that I need to read 10 extra lines to understand code flow or hover my mouse in an IDE to figure out what type object it is.
It's properly just me... I just like clean readable code. that is logical and failsafe and strict and deterministic with its behavior9 -
From today, I'm gonna post infrequent-devLogs of the project i am currently doing, I have been thinking about it the past couple of months, and I am finally moving it into action!
I wish writing devLogs will make me to finish the project, at least a working prototype.
It is a C# block coding application that is made in 100% C# that generates human-readable C# code for C# begineers.
If you want to follow me along, make sure to subscribe to my rants by going to my Profile (cozyplanes) > More icon in top right > Subscribe
All devLogs posted directly via devRant API integration from CZedit, a simple edit program for geeks
=========================
devLog #0 - Block coding in C#
Done:
- Made the console output to redirect to textbox
- Ability to save output to external storage
WIP:
Compile C# code directly at runtime with Roslyn
Notes:
open-source??5 -
Purposely obfuscating your readable code because it's your PMs responsibility soon and he can feel your pain for a while.
-
We have 4k Monitors and SSDs with more than 120 GB, why there are still new projects that use a formatting style that doesn't have a clear relation of the opening { and corresponding closing }. i.e. put them either on the same line or column?
Please don't write code where the imaginary line between the { and } goes diagonally over other parts of the code. It makes it unreadable and my brain hurts from looking at it. Its better to have readable code and "waste" some lines and bytes for code that is easier to read.10 -
I wrote a RESTful(ish) API today and it was beautiful. The API looks exactly how I wanted it, the logic is clean and readable, it has some extensibility built-in without cluttering the code.
There are parts I'm not thrilled about but that's mostly due to having to interact with legacy systems. Super proud of myself!2 -
Glad that I've worked about 2½ days on an angular component, with all the struggles, brainstorming and meticulous care for "good" and "readable" code, just to find out that I misunderstood the requirements. Had to completely rewrite it...1
-
I really find it quite annoying when my colleague refactors my code. I personally don't see the point because I find my code more readable, easy to main and intuitive. That of course is a subjective view. Problem is, there aren't any competent colleagues who can weigh in their opinion on disagreements in the team. In fact, I'm pretty sure they aren't even developers, and have some how infiltrated their way in claiming to be a software developer.
Oh yeah, the manager doesn't review our performance or keep up to date with the work people are doing.
I'm not even exaggerating.1 -
I just met real life Wally from Dilbert.
Semi retired, works a few hours a week with excellent pay because he is the only one who understands the legacy mainframe.
Learning from his example we now plan to obfuscate all code before check-in. Only readable code version will be on our encrypted personal drives. -
I. Fucking. Hate. Tests.
I am writing a module according to a standard and this standard has a test suite. Awesome...this should make development go pretty smoothly especially since their human-readable "specification" is severely lacking.
I get the module passing most of the tests...however there are few I just can't get my module to pass, no matter what...well fuck.
I go digging deeper into the test cases, compare it to source code. What's this? The tests are fucking wrong. There are several other implementations that use this test suite, how the fuck have they not caught this?
Also come to find out, it is not possible to pass *all* the tests in the suite because some are for older versions that have different functionality.
Got to love a test suite that is incorrect and can't be passed 100%
Maybe they need tests to make sure the tests are working correctly.3 -
Ok I fucking give up, does anyone know of any tutorials on adding custom languages and syntax highlighting to VS code, I followed what little readable documentation overlord Microsoft has given and still no fucking clue, help!3
-
There is a particular power move when you take someone's shit code, refactor it to make it faster, safer and more readable and then request a review from them on your PR. "See how I dunked on you, bitch. This is what superiority is about." And at the same time you can be perfectly polite with "oh you know this part of the code well, I wouldn't want to break anything there" with the "bitch" just strongly implied.3
-
A reality that most people are not ready to accept, is that if you work too hard or work too smart as a freelancer, you're going to hurt yourself financially.
I have given my clients amazing code which runs fast, is optimised, and is readable to the point where you can hire a fresher to maintain it.
Doing that has resulted in stable systems but those clients walked away from me and have never come back, means no more money.
But some of the companies I have worked for, I have seen some retarded-ass devs barely able to make a system run and write code, have retained clients for years. They pretty much have a "submit ticket resolve ticket" kinda mechanism.
It's situations like these where it makes me question, what's the point of learning best practices if I'm gonna get hurt financially for it.5 -
We work with multiple platforms, a legacy language and c#. This dev uses underscore between variables in c# and camel case in the legacy platform. The thing is the legacy system has used underscores since 1981 and I've never seen a readable example of c# using them between words.
I also told him I was working on learning to use patterns and how the process of software development should work by training. His response... Why would you want to do that?
He also copies and pastes code everywhere and pays no attention to scope.
And worst of all I'm his coverage when he is gone. If I have to debug one more sloppy bug I am going to face desk. -
Working on complex invoicing systems. For once, the code is clear, elegant, readable and unit-tested... but I keep forgetting how reality works. If only tax laws were self-documenting.
-
1) Had to fix severe bugs in a dynamic UI (configuration-driven forms) component.
Recognized undocumented Copy/Paste/Modify/FuckUp driven variations of the same component all over the project. Unsurprisingly, the implementations covered 99% of the antipattern catalog on wiki.c2.com and could compete with brainfuck in regard to human-readable code.
Escalated the issue, proposed a redesign using a new approach, got it approved.
Designed, Implemented, tested and verified the new shared and generic component. Integrated into the main product in the experimental branch. Presented to tech lead/management. Everyone was happy and my solution opened even more possibilities.
Now the WTF moment: the product with the updated dynamic UI solution never has been completely tested by a QA engineer despite my multiple requests and reminders.
It never got merged into baseline.
New initiatives to fix the dynamic UI issues have been made by other developers. Basically looking up my implementation. Removing parts they do not understand and wondering why the data validation does not work. And of course taking the credit.
2) back in 2013, boss wanted me to optimize batch processing performance in the product I developed. Profiling proved that the bottleneck ist not my code, but the "core" I had to use and which I must never ever touch. Reported back to him. He said he does not care and the processing has to get faster. And I must not touch the "core".
(FYI: the "core" was auto-generated from VB6 to VB.Net. Stored in SourceSafe. Unmaintainable, distributed about a bunch of 5000+ LoC files, eye-cancer inducing singlethreaded something, which had naive raw database queries causing the low performance.) -
Kinda often, the ecosystem around C/C++ kinda sucks
Compilers will give you hieroglyphs instead of readable errors.
Including a separate library, or a code generator, into your project is generally hell on earth to set up.
The language server often needs several seconds to come up with suggestions, some of which are complete nonsense.
The language itself lacks many basic features. C++20 will give us so many fancy things but we still can't convert an enum to a string.
I've programmed in C# and lately in Rust, and damn the developer experience there is just so much nicer overall.31 -
All summer I've been working at a company doing some full-stack development. Starting my last year in university, I really wanted some real life experience that ties into my studies.
I did not expect to find horrible, undocumented, code that has been written 5 years ago, where the senior developer who wrote it doesn't even know what it does. The worst part? They are STILL not documenting! I tried to document, but got this in return "you don't have to document everything. Especially if it is understandable". But they don't even understand their old code!
Monday morning, we had a meeting and they asked what I thought of working here, seeing as I am done this week. I respectfully told them that their code is not readable, and it will make it hard for new employees to understand. The boss in return says "you're the third newly hired employee this summer to say this... Maybe we do have a problem then"..
No shit. Please for the love of God, comment your code!2 -
Anyone here currently employed as a perl developer? I wanted to know how your experience with the language and the environment has been? I have been going on and off in the perl world for a while know. Currently some interesting perl jobs have been comming up. I have always liked the language but I know that there is a major difference between liking a language for basic scripts and using it in a work environment.
Currently, I have experimented with a few web projects using Perl and I am really digging what I see, the code can be as hacky as you want it to be or as elegant and readable as you make it, such freedom and flexibility is great. -
What's better for finding candidates for a development role: having the candidate solve a complex whiteboard problem or have the candidate refactor some code (maybe a couple of small modules) while explaining as he/she goes through each step?
I personally feel both are good, but I think refactoring is a very much needed skill when you're dealing with the complexity of millions and millions lines of code, so being able to change your inital design to make it more readable and flexible later on is crucial. And refactoring usually goes hand and hand with having tests in place.
An interesting exercise would be to give the candidate a test suite with the corresponding code that's tested in a working state and let the candidate decide how much refactoring needs to be done. In the process the candidate would need to break and fix tests of course while changing things... it'll give a good measure of their ability to take code and change it to a "better" state of design and flexiblity.
On the other hand I do think there is a place for cliche white boarding problems because it really shows one willingness to tackle complex problems which do arise in most development jobs. Asking the questions and being persistent goes along way and can really help when you're collaborating with other developers to solve an issue at hand.
Overall I think there should be a white board problem, but I don't think that should be the deciding factor. Rather couple it with other very practical skills you should have as a developer already; among those being refactoring.1 -
I hate it when my teacher underestimates my skills in programming, he/she tells me to rewrite again even though its just the same logic... I got shorter lines of code, he/she wants longer and readable code 😠😠11
-
Test studying tool. Load your questions and answers in a human-readable format. Take a test. Get summary of results. My pet project at the university, 98% of code is mine. http://gronostajo.github.io/drill2/3
-
!rant
Currently I am studying "applied computer science" in Berlin and most of my modules are easy as fuck for me. Most of the time I don't even have to study for the exams. My programming professor even told me that I am the best student in terms of clean/readable code and he was amazed when I handed in on of my homeworks where I used MVC. Today I failed my math exam for the second time. It's the only module that I suck at, mainly because I don't give a fuck about it. I can easily grasp the concept of anything that I am interested in, but if I am forced to learn something my brain just shuts down. I truly fear that I will drop out of university because of math. I am still at my first of three math modules and I don't know how to handle this problem properly, having in mind that I still need to participate in two more modules. The saddest part is that I am not the only one with those problems and fears. I will link a news article of the German newspaper "Tagesspiegel" in the comments.
I know this is neither a rant or a question, but I just wanted to tell you guys about my problems and maybe start a conversation about the importance of math in our modern times and why school's aren't able to teach basic math in a way that young people are excited for it or at least are able to grasp the basic concepts.3 -
HTML Writers Guidelines
When designing your web site you want to make the visiting experience as enjoyable as possible and at the same time make it so that if the site needs to be changed in any way, the changes are not too difficult to make. You want the look to be as appealing as possible for all browsers and also make the site accessible to users with disabilities. In order to accomplish all this there are some general guidelines when creating your HTML code.
1. The first thing that will really make your life easier is through the use of Cascading Style Sheets (CSS) - CSS is used to maintain the look of the document such as the fonts, margins and color. HTML directly on the page is not a good choice to handle these aspects because if say, the font color you are using for certain paragraphs needs to be changed from blue to red, you would have to go in and change each color tag manually. By using CSS you can designate the color for each of those paragraphs just once in the CSS file. That way if you have to change the font color from blue to red you make one change instead of the countless number of changes you might have to make, especially if your web site contains hundreds of pages. This is a big time saver and a must for all professionally designed web sites.
2. Don't use the FONT tag directly in your HTML code - This becomes a problem when using some cheap authoring tools that try to mimic what a web page should look like by using excessive FONT tags and nbsp characters. These tools end up creating web pages that are impossible to keep maintained. There is a program you can use, if you've created one of these disaster pages, called the HTML Tidy Program which you can actually download here . This will clean up your code as well as possible.
3. You want your web pages readable to people who have disabilities - People who surf the Internet depend on speech synthesizers or Braille readers to interpret the text on the page. If your HTML markup is sloppy or isn't contained in CSS the software these people use to read pages have a difficult time in interpreting these pages. You should also include descriptions for each image on your page. Also, don't use server side image maps. If you are using tables you should include a summary of the table's structure and also associate table data with the correct headers. This gives non visual browsers a chance to follow the page as they go from one cell to another. And finally, for forms, make sure you include labels for form fields.
By following just these three guidelines you give your visitors, especially disabled visitors the best chance of having an enjoyable visit to your site while at the same time making it so that if you have to make changes to your site, those changes can be made easily and quickly.2 -
I'm wondering if there is a way to use Machine Learning algorithm to optimize games like Screeps.com, which is a game that you control your game by writing JS code. Letting the algorithm write human readable code might be too challenging, but optimizing some aspect of the game should be possible, like the best scale up route optimization using re-enforced learning.3
-
Sydochen has posted a rant where he is nt really sure why people hate Java, and I decided to publicly post my explanation of this phenomenon, please, from my point of view.
So there is this quite large domain, on which one or two academical studies are built, such as business informatics and applied system engineering which I find extremely interesting and fun, that is called, ironically, SAD. And then there are videos on youtube, by programmers who just can't settle the fuck down. Those videos I am talking about are rants about OOP in general, which, as we all know, is a huge part of studies in the aforementioned domain. What these people are even talking about?
Absolutely obvious, there is no sense in making a software in a linear pattern. Since Bikelsoft has conveniently patched consumers up with GUI based software, the core concept of which is EDP (event driven programming or alternatively, at least OS events queue-ing), the completely functional, linear approach in such environment does not make much sense in terms of the maintainability of the software. Uhm, raise your hand if you ever tried to linearly build a complex GUI system in a single function call on GTK, which does allow you to disregard any responsibility separation pattern of SAD, such as long loved MVC...
Additionally, OOP is mandatory in business because it does allow us to mount abstraction levels and encapsulate actual dataflow behind them, which, of course, lowers the costs of the development.
What happy programmers are talking about usually is the complexity of the task of doing the OOP right in the sense of an overflow of straight composition classes (that do nothing but forward data from lower to upper abstraction levels and vice versa) and the situation of responsibility chain break (this is when a class from lower level directly!! notifies a class of a higher level about something ignoring the fact that there is a chain of other classes between them). And that's it. These guys also do vouch for functional programming, and it's a completely different argument, and there is no reason not to do it in algorithmical, implementational part of the project, of course, but yeah...
So where does Java kick in you think?
Well, guess what language popularized programming in general and OOP in particular. Java is doing a lot of things in a modern way. Of course, if it's 1995 outside *lenny face*. Yeah, fuck AOT, fuck memory management responsibility, all to the maximum towards solving the real applicative tasks.
Have you ever tried to learn to apply Text Watchers in Android with Java? Then you know about inline overloading and inline abstract class implementation. This is not right. This reduces readability and reusability.
Have you ever used Volley on Android? Newbies to Android programming surely should have. Quite verbose boilerplate in google docs, huh?
Have you seen intents? The Android API is, little said, messy with all the support libs and Context class ancestors. Remember how many times the language has helped you to properly orient in all of this hierarchy, when overloading method declaration requires you to use 2 lines instead of 1. Too verbose, too hesitant, distracting - that's what the lang and the api is. Fucking toString() is hilarious. Reference comparison is unintuitive. Obviously poor practices are not banned. Ancient tools. Import hell. Slow evolution.
C# has ripped Java off like an utter cunt, yet it's a piece of cake to maintain a solid patternization and structure, and keep your code clean and readable. Yet, Cs6 already was okay featuring optionally nullable fields and safe optional dereferencing, while we get finally get lambda expressions in J8, in 20-fucking-14.
Java did good back then, but when we joke about dumb indian developers, they are coding it in Java. So yeah.
To sum up, it's easy to make code unreadable with Java, and Java is a tool with which developers usually disregard the patterns of SAD. -
The moment when I started programming and I was told that I could use tabs to indent my code and make it readable...1
-
Imagine the nooblet hell it would create if Python would throw actual errors all over the place if pep8 has been violated...
If only...
sidenote: I post this rant because I had to help my girlfriend and her project partner (for her study) because partner refuses to write readable code (no comments in the code at all as well) and both refuse to write in compliance with pep8 "because it's useless"5 -
Oh when you refactor the complete project structure and give for build the first time !!!
It's like you are sitting with your heart on your hand and praying to God that at least let the errors be readable(I am no genius to think I will be able to produce error free code the first time😝😝) -
Ah, the joy of finding code that looks like a never-ending stream of characters. Because hitting "Enter" is just too much effort, right?
Who needs readable chunks when you can have an eye strain-inducing monolith?3 -
Salt is awesome, no questions about that. YAML is giving me headaches, but it's my fault and eventually I'll get used to it. But this being my first encounter with jinja, WHO THE HELL THOUGHT THIS PIECE OF CRAP DESERVES TO LIVE! Instead of writing python inside {% %} you have to write kinda pseudo python and I just spend over hour trying to build list inside for. Yes, great idea, scoping fors, and lets make it hard to escape scoping, beacause it would be a shame if somebody COULD ACTUALLY DO SOMETHING USEFULL. I though several times of using different renderer, but I want to keep my code readable and mainrainable and in the end I found a workaround, but still, Jinja, YOU SUCK!4
-
Me, taking a coding class in uni:
Purposely cramping everything in as few lines as possible, making the code barely readable, just to screw with the guy who had to correct this mess.
In my defence, the assignment they gave us was garbage. The task descriptions were often ambiguous or even contradictory to what actually was the case ("The InputStream will contain a string of csv data, each element starts in the next line" -> was a malformed single line string) and the automated tests they wrote to check our output where either completely unhelpful because of their meaningless error messages, or sometimes even plain wrong, telling us our output was wrong, even though it definitely wasn't. -
Should I be bothered if I have added 200 lines of badly written code to my Android project (which had readable, organized code before) to make it almost unreadable? BTW the app's memory usage is still low like before.3
-
Objective-C syntax is more readable than Swift.
The verbose naming conversations feel natural in Objective-C, but in Swift they look rather nasty to me.
Also Swift syntax feels inconsistent in many parts of the language, which forces you to memorize when you can and when you can't use a certain feature (i.e where, case).
Am I the only one that thinks Objective-C looks a lot cleaner than Swift code?
Note: This is an opinion, not trying to start a war. Just curious if I'm alone on this.9 -
[CONCEITED RANT]
I'm frustrated than I'm better tha 99% programmers I ever worked with.
Yes, it might sound so conceited.
I Work mainly with C#/.NET Ecosystem as fullstack dev (so also sql, backend, frontend etc), but I'm also forced to use that abhorrent horror that is js and angular.
I write readable code, I write easy code that works and rarely, RARELY causes any problem, The only fancy stuff I do is using new language features that come up with new C# versions, that in latest version were mostly syntactic sugar to make code shorter/more readable/easier.
People I have ever worked with (lot of) mostly try to overdo, overengineer, overcomplicate code, subdivide into methods when not needed fragmenting code and putting tons of variables.
People only needed me to explain my code when the codebase was huge (200K+ lines mostly written by me) of big so they don't have to spend hours to understand what's going on, or, if the customer requested a new technology to explain such new technology so they don't have to study it (which is perfectly understandable). (for example it happened that I was forced to use Devexpress package because they wanted to port a huge application from .NET 4.5 to .NET 8 and rewriting the whole devexpress logic had a HUGE impact on costs so I explained thoroughly and supported during developement because they didn't knew devexpress).
I don't write genius code or clevel tricks and patterns. My code works, doesn't create memory leaks or slowness and mostly works when doing unit tests at first run. Of course I also put bugs and everything, but that's part of the process.
THe point is that other people makes unreadable code, and when they pass code around you hear rising chaos, people cursing "WTF this even means, why he put that here, what the heck this is even supposed to do", you got the drill. And this happens when I read everyone code too.
But it doesn't happens the opposite. My code is often readable because I do code triple backflips only on personal projects because I don't have to explain anyone and I can learn new things and new coding styles.
Instead, people want to impress at work, and this results in unintelligible, chaotic code, full of bugs and that people can't read. They want to mix in the coolest technologies because they feel their virtual penis growing to showoff that they are latest bleeding edge technology experts and all.
They want to experiment on business code at the expense of all the other poor devils who will have to manage it.
Heck, I even worked with a few Microsoft MVPs.
Those are deadly. They're superfast code throughput people that combine lot of stuff.
THen they leave at you the problems once they leave.
This MVP guy on a big project for paperworks digital acquisiton for a big company did this huge project I got called to work in, which consited in a backend and a frontend web portal, and pushed at all costs to put in the middle another CDN web project and another Identity Server project to both do Caching with the cdn "to make it faster" and identity server for SSO (Single sign on).
We had to deal with gruesome work to deal with browser poor caching management and when he left, the SSO server started to loop after authentication at random intervals and I had to solve that stuff he put in with days of debugging that nasty stuff he did.
People definitely can't code, except me.
They have this "first of the class syndrome" which goes to the extent that their skill allows them to and try to do code backflips when they can't even do code pushups, to put them in a physical exercise parallelism.
And most people is like this. They will deny and won't admit, they believe they're good at it, but in reality they aren't.
There is some genius out there that does revoluitionary code and maybe needs to do horrible code to do amazing stuff, and that's ok. And there is also few people like me, with which you can work and produce great stuff.
I found one colleague like this and we had a $800.000 (yes, 800k) project in .NET Technology, which consisted in the renewal of 56 webservices and 3 web portals and 2 Winforms applications for our country main railway transport system. We worked in 2 on it, with a PM from the railway company.
It was estimated 14 months of work and we took 11 and all was working wonders. We had ton of fun doing it because also their PM was a cool guy and we did an awesome project and codebase was a jewel. The difficult thing you couldn't grasp if you read the code is if you don't know how railway systems work and that's the only difficult thing.
Sight, there people is macking me sick of this job11 -
I keep myself motivated by reading about new technologies, language features and constantly trying to improve my code.
I see great reward in having fast and readable code. -
Coworker: let's use Result monads in the project so that we're forced to deal with exceptions
Me: okay, sounds great!
Me: *implements Result monads *everywhere**
Coworer: how about we don't use results anymore in half the project? It makes the code look ugly. Let's just use exceptions.
Me: ...
Really? Why in your mind is it okay to only force us to handle a few exceptions and others we can just say fuck it and let them wander around?
Oh you want to use try-catch for these other exceptions.
So now we're back at square one, which is trying to remember/figure out which exceptions any method can throw (since the compiler doesn't do shit, not even warnings), but now we also have inconsistent and much less readable code. Isn't it great?
(╯°□°)╯︵ ┻━┻
I also can't do much about it, because I'm just a fucking intern and I do not want to cause trouble, so I just try to say that I disagree with it in the most polite of ways and that's that.4 -
As an android dev when I inherited a shitty project thats when I realized what really means to write readable and most importantly testable code. Codebase I inherited wasnt even really that bad it was quite readable, but boy it was not suited for any unit/instrumented tests. im talking spaghetti code.
Nowadays I refactor apps to make sure they are testable instead of spending weeks writing tests for a shitty codebase which was done without thinking about separation of concerns. Clients hate the extra couple weeks on top of request but what can I do, if they want tests they need to work with TDD approach or give extra time for refactors. -
Tech Lead: I looked at their API code, their devs are so smart. They wrote the whole thing in three lines.
Me: I bet it's super readable!
Tech lead: that doesn't matter they are really smart.
Me: I'm sure they are ... 😒1 -
Here's a fun fact (which actually will be accompanied with a source) about node.js. When you import or require a module it will be imported as a singleton. Or put another way, ```export const Foo = { };``` is one of the simplest* and most readable singletons you can have in that runtime. And of course here's the thing you always should be asking for when people make a claim like this https://nodejs.org/api/...
So why write this? Well some of you might feel inclined to write a medium (or other) post about "design patterns in Javascript" where you basically just translate the GOF book from Java to Javascript and now you have something that isn't just awkwardly translated Java code! -
That would be lambdas in C++11, nice way to implement callbacks and make them quite generic while keeping code readable :-)
-
Cleaning up some old. NET code and found this gem. At least it might be readable once it is rendered to the browser.1
-
I'm building an Android app from ground up targeting to have functionalities added without much effort in succeeding phases.
What I'm pissed about mobile development at the moment though, is its lack of structured code base that is easy to follow. Unlike web where codes are modularized and well placed, in mobile, I kept going back and fort in different modules to see how they are used in all places in the project which made it tedious as time goes.
So I kept a notepad keep track of detailed flow. However, once I go back at the notes to place them on top of your head, the almost spaghetti-like structure just becomes very hard to track. For me it doesn't follow a pattern and that developers are free to do what ever they wish so as long as it can run in the device or emulator.
For instance, implementing concurrency as well as dependency management and a Clean architecture is such a pain. I hope i can relate to someone here.
If only there is a standardized way of structuring codes in android in Java or Kotlin (haven't tried this), there would be hope for me. So if anyone can provide a good, readable, reliable android project that I can start building my project on top of, your help will be greatly appreciated! Thanks for reading. -
ES6 is like a new different language ... Although it seems cool, but I always find ES6 converts the readable code into puzzles you need to solve!7
-
Do you guys think students should get points for bad code?
For me once or twice it really saved my grades when I wrote the ugliest, least efficient and least readable code because my brain stuck during a exam.. It worked so I got full points.
Since I'm relatively inexperienced compared to you people it's hard for me to tell which is the very best approach to a problem. But I know when my code is just shit and I shouldn't be rewarded with good grades for it.
Is 'basically working' worth anything outside of school?7 -
Oh, look at Mr. Fancy over here with his "consistent indentation" and "readable code."
Let's just put the opening curly brace wherever we feel like it and let the next dev deal with a migraine. Brilliant!4 -
Yo, DevRat! Python is basically the rockstar of programming languages. Here's why it's so dope:
1. **Readability Rules**: Python's code is like super neat handwriting; you don't need a decoder ring. Forget those curly braces and semicolons – Python uses indents to keep things tidy.
2. **Zen Vibes**: Python has its own philosophy called "The Zen of Python." It's like Python's personal horoscope, telling you to keep it simple and readable. Can't argue with cosmic coding wisdom, right?
3. **Tools Galore**: Python's got this massive toolbox with tools for everything – web scraping, AI, web development, you name it. It's like a programming Swiss Army knife.
4. **Party with the Community**: Python peeps are like the coolest party crew. Stuck on a problem? Hit up Stack Overflow. Wanna hang out? GitHub's where it's at. PyCon? It's like the Woodstock of coding, man!
5. **All-in-One Language**: Python isn't a one-trick pony. You can code websites, automate stuff, do data science, make games, and even boss around robots. Talk about versatility!
6. **Learn It in Your Sleep**: Python's like that subject in school that's just a breeze. It's beginner-friendly, but it also scales up for the big stuff.
So, DevRat, Python's the way to go – it's like the coolest buddy in the coding world. Time to rock and code! 🚀🐍💻rant pythonbugs pythonwoes pythonlife python pythonprogramming codinginpython pythonfrustration pythoncode pythonrant pythoncommunity pythondev4 -
My programming class kinda sucked. Here's why.
1. They taught C++. To students who had never seen a line of code in their lives. The language with 90+ keywords.
2. The teacher. We had to use switch statements to do something. It took around 300 loc. I used an array and shortened it to 5. He took some points away for not doing it correct. IT LITERALLY WORKS THE SAME AND IS SHORTER. This was not the first time I had shortened something/made it more readable and been docked points on the assignment.
3. Commenting. He told us to comment as much as possible, which is not correct. Comment what needs commenting. Not everything.
4. The compiler. We worked on windows with an online compiler. He decided teaching us to set up a compiler was too hard. We used onlinegdb, which isn't inherently bad. However, onlinegdb is based on Linux. He compiled our programs with a windows compiler.
Maybe these are just problems because I've programmed before that, but I still think they are red flags. What do you think?3 -
For those who are on my team, arguing on not putting comments in their code:
How much ever (un)readable your code is, any peer / reviewer / future team member can only understand what that code snippet is doing, but not why was it written in the first place or what the hell you were thinking while writing that logic. So, it'll be awesome if you write that as comments or at least link to the story/design doc which warranted that code.3 -
Hi guys, If you are front end dev (especially react dev) please read this and share your thoughts.
I recently started with react.js. But I didn't like the idea of nesting components. I know this is too early to talk about it. I'm not halfway through tutorials. But I'm loosing motivation to learn react.js
This never happened to me. I learned few frameworks in past. Django and codeigniter. They follow MVC/MVT architecture. And writing code in it looks cleaner and simpler.
In react JSX is confusing at first. You have to read same line twice or thrice to understand. I'm not saying JSX is bad, but it's not readable enough.
In early lessons I learnt that in react everything is component. And every component comes under one root component. Don't you guys think this well get messy for large application. You are dealing with number of nested components from one file into another.
I'm not against react. But the way react is forcing you to write code, is not something I enjoy. Let me know your thoughts. Maybe I'll get some kinda booster to continue react.1 -
My coding style is mostly influenced by good old personal preference, but also because of a certain internship where there was a lot of gain to be had by making everything as reusable and testable as possible.
I guess you could say my motto is usability, readability and flexibility:
I like tidy, reusable code with an emphasis on keeping code readable. I've always liked modular things I guess...
And I despise two things: curly brackets on the next line and spaces for indentation... But way worse is having no brackets at all (looking at you Python): it's clearer to have lower-level code inside some sort of "container" markers i.e. brackets (also gives more IDE functionality like color-coding hierarchically).
Indentation should always be tabs so anyone can have their own width of indentation set through their IDE, making it way more accessible to fellow colleagues!
And I also like having parameterized code over hard-coded functions: way more flexible. -
student: eh, eslint is only to enforce our code to be more readable to you, you're a lazy teacher!
*sigh*2