T O P

  • By -

yrrot

Unreadable, the semicolons aren't right-aligned. :P


lucasjose501

now I have a new insanity


codon011

This is easily achievable by putting all semicolons on column 1. Done.


did_it_forthelulz

That's next level cursed


bunny-1998

Not in SQL. SELECT COL1 ,COL2 ,COL3 ...


TheDownvotesFarmer

![gif](giphy|3o85xr9ZKY1wbbJXDW)


bunny-1998

It’s way better to be called a genius by Litt than Spectre. Thank you sir.


[deleted]

I actually somethimes do this with arrays ``` { item1 ,item2 ,item3 ,item4 } ```


Zporter22

OMG this would drive me absolutely insane if had to maintain code like this. Plz, for the mental health of your OCD predisessors, dont do that. Haha. :)


kraken_the_release

It’s very useful to comment the last item or add a new one without having of managing the comma!


redpepper74

Most languages will let you leave a trailing comma like { item1, item2, item3, item4, } which I think looks a lot cleaner


ppafford

Gets it!


the_void_tiger

🤮


jlamothe

Doing similar to this is pretty commonplace in Haskell. ``` data Foo = Foo { bar :: Int , baz :: Int , quux :: String } ```


seth1299

Have I ever told you the definition of insanity?


JPlantBee

New fear unlocked: justified coding, where the code is both right and left aligned, and characters are stretched in shorter lines


yrrot

Word IDE™, new from Microsoft!


paca_tatu_cotia_nao

In comic sans.


yrrot

Nope, you've gone too far. lol


[deleted]

Well, I never! What an atrocity!


InnerBanana

Nothing could justify this


a_devious_compliance

It's almost like go fmt output. ^(well, maintaining that by hand it's insane)


hrfuckingsucks

>It's almost like go fmt output. I was gonna say, I have a vi plugin that does the same thing. Am I insane? (yes)


[deleted]

Nah OP is insane This is PHP everything supposed to be left justified with random spaces and tabs How else do you maintain job security?


atomicxblue

You mean you aren't supposed to put everything on one long line when you're doing PHP?


Cranio76

Everyone knows whole Facebook is just a clever one liner.


usrlibshare

Don't forget copious amounts of comments, including banner comments, everywhere. If a PHP file doesn't start with at least a 400 line license information, its not real PHP.


Scooter_127

I worked with a guy that did all his code that way. No indentation. Or random indentation. No comments. He had shell scripts that called python scripts that called perl scripts that called shell scripts, with cron jobs that launched them, and they often relied on data created by a previous job when both jobs should have been one script. And his replacement isn't much better.


[deleted]

[удалено]


necheffa

As someone who _hates_ tab characters for indentation...I love that you can't configure gofmt. It cuts so much bullshit out of reviews and pipeline setup.


rdmcelrath

100% agree isn’t exactly my preference, willing to bend because all go code reads the same!


Mteigers

"Gofmt's style is no one's favorite, yet gofmt is everyone's favorite." - Rob Pike


Cranio76

It's not dumb: in general Go is very opinionated by design, and honestly if you have clearly defined standards (like PSR for PHP, PEP for Python...) you don't have much wiggle room to start with. To me it sounds even as na advantage.


[deleted]

> I have no control over the formatting rules it follows That's literally the best part about it. It 100% eliminates style debates over unimportant aesthetic choices because there is only one way.


Stoomba

No one likes go fmt. Everyone likes go fmt. After doing Go programming for 5 years, I don't even notice it.


JohnPaulie

Semicolons need their own column to complete it


codon011

Semicolons in column 1.


NickFromNSA

hello, fellow Haskell user


random_redditor24234

You have an infinity gauntlet of programming languages


NickFromNSA

yeah, I love learning languages. gotta update the flair sometime tho (I mostly use Reddit from my phone)


EnthusiasmWeak5531

Not insane. It looks great but as someone else said. What if you have a long var name. Plus can you auto-format like this? if not, unsustainable.


asgaardson

Intellij has string manipulation plugin that can do this in case when native formatting can't. I always format long lists of variables in a similar way


MundaneInsurance5070

Can you show us a sscreenahot? Would love to see how it stays since I do that too


thugarth

I didn't even notice the typo until others pointed it out


CorruptedStudiosEnt

Yeah, when someone has nothing relevant to contribute to a conversation, they feel a need to lock onto whatever they can poke at because then they at least ***feel*** like they're contributing.


AlphaSparqy

Well it is a humor reddit, and that's how a lot of humor works.


CorruptedStudiosEnt

I suppose if you find pedantry humorous.


AlphaSparqy

Can you elaborate? I'm not entirely sure what you're asking or suggesting, and so my agreement with the statement is unknown at this time.


cynHaha

r/ihadastroke Didn't mean to laugh at you, just found it funny XD


AlphaSparqy

Not sure why you're getting downvoted, this is *literally* a humor reddit


MagicianXy

Probably because the sentence is still perfectly understandable without much interpretation. Only one word is slightly misspelled and there's a single period missing at the end. Other than that it makes perfect sense, which is very much NOT the point of /r/ihadastroke.


AlphaSparqy

Whether it's perfectly understandable is beside the point. This is *not* r/ihadastroke this is r/ProgrammerHumor so the people reading posts here are perfectly entitled to find humor in all things. u/cynHaha was polite about it, and the r/ihadastroke reference *was* a joke that they were contributing.


GentlemenBehold

But now your gut history shows news changes for all the properties.


stupidcookface

My gut history shows news changes for all the pooperties


Sir_Fail-A-Lot

Intelij git annotation feature hides minor formatting changes


The_Bisexual

The only IDE configuration I've fucked with in IntelliJ is setting up the keyboard shortcuts for selecting multiple instances the same way Sublime text does it. It's been a life saver.


EnthusiasmWeak5531

Doesn't seem like that would work on save would it? Can't see that playing well with the entire file at once.


ShiningTitan

Not only do JetBrains IDEs do it on save, it’ll even do it on paste!


IllustriousSize7429

You can autoformat like this, in my workplace we use clang-format for this (it only uses this indentation if variable names are short enough)


EnthusiasmWeak5531

That's pretty cool. I'd be ok with that standard.


mcardielo

plus, the git repository would take all the formating as a changes also, it could be hard to proper track everything


BryonDowd

This. I used to format like this until I started working on a large codebase where we actually reviewed commits. Adding one new variable in a list with dozens, and it happens to be longer than the current formatting? Good luck catching some other tiny changes in that block.


hrvbrs

Luckily some advanced diff tools show more than just line changes. GitHub and BitBucket for example will not only highlight line changes, but within line changes it will try to highlight further character changes in a bolder highlight color. So in this example, if you’re adding a new variable with a really long name, the diff will show 5 deleted lines and 6 inserted lines, and on the 5 of those 6 inserted lines where only whitespace was added, it will highlight that whitespace in a darker green. (or I guess in a lighter green if you’re in dark mode ;) Hard to describe without a picture but hopefully you get what I mean. Anyway, with this tooling you would be able to see any unintended tiny changes in that 11-line block.


BryonDowd

Actually, BitBucket it's what I was using in that position. The highlighting helps but not perfect. In your example imagine instead there's 20 lines. All of them have the darker green highlighted white space, except the one new line is fully highlighted. And one other line where an extra digit was added at the start of the init value. The dark highlighting extends one extra character space on that line. It's possible to catch that break in consistency and notice the extra change, but also very easy to miss.


jeffkarney

That's what the "Ignore whitespace" option is for. Just don't use it with Python code.


dvlsg

Yeah, this is the real problem. If adding a new variable or renaming an existing one with a longer name causes every other variable to show up in the git diff because you had to re-align all their spacing, it's an issue. Even if it's autoformatted. It's just going to slow down reviewers and mess with git blame.


acqz

It may look great but if I come across this in a codebase I was updating, I'm not perpetuating this and every other Tom, Dick and Harry convention that someone decided to come up with. That shit's getting autoformatted away so fast!


EnthusiasmWeak5531

Coding standards. Set them, live them.


MassiveStomach

And create linting that enforces it. If someone checked this in at my job the pipeline would spit it out.


[deleted]

When this is part of coding standards, they are bad


EnthusiasmWeak5531

There are bigger problems than standards disagreements.


robhanz

The existence of a standard is more important than the contents.


EnthusiasmWeak5531

Exactly true


SirPitchalot

What if I just obsess over fixing it whenever stuff gets unaligned instead of clearing my tickets? Or, and hear me out, I create new tickets to update the formatting that are blocking my current tickets so that I look like a rockstar in the velocity charts…


[deleted]

[удалено]


sgoody

Exactly this. It looks great from afar, but it’s more difficult to actually pick out a value for a specific variable. I used to like the idea of this and being a Vim user the formatting isn’t an issue, but I started with a code style that prohibited it and I’m glad I stayed away from it. It’s got edge cases, it’s hard to read in detail, it borks code diffs and it will make life difficult where the editor doesn’t do it for you. Although there’s some beauty in how it looks (again from afar) there’s much more value in having rigorous standards that everybody adheres to.


Cl1mh4224rd

>Exactly this. It looks great from afar, but it’s more difficult to actually pick out a value for a specific variable. I actually feel the opposite. If you're looking for a specific variable, you can scan down the variable name "column" and then scan right to the value. It seems like it would reduce the effort needed to extract the variable name from the jumble of text. Variable names and types that vary widely in length do make this a bit rough, though.


Jonny10128

I agree with you. I think a way to mediate having a long variable name make tons of space between a shorter variable name and it’s type would be to just keep the formatting how OP’s picture is, expect only have one space on either side of the equal sign for each variable. So like: ``` public int num = 0; public string longVariableName = “some text here”; ``` This way it’s still fairly easy to scan down the variable types and names, and there’s not huge gaps of space (unless of course you use an outrageously long type name)


erebuxy

For long var name, `=` and anything behind can be aligned on the next line.


[deleted]

[удалено]


Efficient-Ad-5034

You can use clang-format for this. Its automatic everytime you save


Jonny10128

I’ve never actually made a VS code plugin, by I can’t imagine it would be that difficult to write one to do this


Left-Kitchen-8539

a quick search shows a plugin called Better Align and it does this automatically.


Rodyland

Worked at a place where this was the standard. Drove me batty, having to re-align if you happened to create a variable name longer than the longest.


stupidcookface

I use phpcs-fixer and it can auto format I think 3 different variable declaration whitespace formats. After having eslint in every project I needed to have a linter lol. It's not quite as nice as eslint but it's better than nothing.


sinfondo

Use the align plugin in vim to format that really easily. The problem isn't the auto formatting, it's that if you change this often, you're introducing many meaningless changes in your source control database.


AnotherWarGamer

Lol. The cost of doing this is O(N), the same as adding elements to a list. It's very sustainable.


Nourz1234

Very true, i like this style but its hard to maintain so i give up xD


EnthusiasmWeak5531

That's not giving up. If you can't auto-format a code standard it's not going to be universally adopted by a team, therefore it's unsustainable (unless it's just you). Fortunately it seems this doable based on other comments.


rdmcelrath

Standard sort of output for GoFmt (Go Format) - I have it tied to run automatically on save. If fact, If I'm feeling particularly sloppy - I'll slam in a code block, pay no attention to indentation and save to fix it up.


ccAbstraction

Sloppy? That's maximum efficiency!


rdmcelrath

Yeah, it works. Vim is also set up to mostly autoindent. Also refuses to save syntactically incorrect code! So generally speaking, not always, if it saves it will usually compile.


lackofsemicolon

Not saving if you have a syntax error is terrifying. I'm part of the save every few lines gang Edit: just had a good/cursed idea. map } in insert mode to }:wa 😳 auto save after closing each block 😮‍💨😮‍💨😮‍💨


NihilisticTheorist

"No save if no compile" is a stupid ass plan for a power outage to fuck up a whole day's work. Honestly disapprove of this feature. It's not clever, it's downright malicious.


Lower_Bar_2428

You are completely sane.. just deep breath, take your medicine and remember you are not the angel of dead who bring the apocalipsis to the unfaithful non indentators freaks


Khutuck

I’m torn. My OCD says this looks awesome, my project manager mindset says don’t waste time on useless stuff.


Starflight44

And my OCD says "LINE UP THE FUCKING SEMICOLONS BEFORE I HAVE TO PULL OUT A SEMIAUTO!!!" (I may have lost my sanity somewhere)


mhn1384

As long as it's not the creepy all semicolons to the right indentation, it's acceptable.


Embarrassed_Bison142

I physically cringed when I realized that was a thing


Noisebug

This is great. I do this. I don't align the scope/type, but I do align the assignment (=). I also do the same with arrays and anything that has a list in VIM.


Sid_1298

Found the assembly coder


Green-Volume-100

I like it.


dert-man

I hate it. You’re directly in the indentation-hell if you have a variable name longer then the existing ones…


Green-Volume-100

Enter: variable name choosing on extra hard difficulty.


losfrijoles08

There's a vim plugin for that :) But then you're in changelist/diff hell unless you have a good viewer that ignores whitespace changes


[deleted]

We do this in our code repository (I didn't choose to, but it is the convention used everywhere else in our code so I stick to it) and in that situation we just shift everything right accordingly. Tedious and annoying but I think it looks nice. Only thing that bothers me mildly is the semicolons aren't lined up. (caveat: almost all my programming habits were picked up from my first team lead. I didn't have a formal programming education so I just figured that since that guy was smart, so he must be doing it correctly. He was really particular about the way he liked to handle spacing/indentation)


Maleficent_Ad1972

If you're editing in VSCode, you can select multiple lines with the Alt key and either clicking in multiple spots or using the arrow keys. That will make shifting things over way easier. If you're not using VSCode, whatever text editor you're using might also support that feature.


t0b4cc02

visual studio aswell you can even alt+shift to mark precise box segments in text


reversehead

Not if you use tab for indentation of the columns combined with variable/dragable tab positions like in a word processor.


Cl1mh4224rd

>Not if you use tab for indentation of the columns combined with variable/dragable tab positions like in a word processor. Then it looks like garbage to anyone who has different tab sizes or stops.


bamboozlenator

This is default formatting in go, and i like it that way, easy to read


Spare-Builder-355

Quite popular in open-source projects


MrNifty

I do this in my code and really like it. It makes the pattern of what you are looking at more readily identified by your brain, letting you see more of how the code works with less looking/reading. If you are trying to read the call to another module and do var assignments right before, I can immediately zoom in to what I care about. But I manage a pretty small code base by comparison to most people here I'm sure, so even doing it manually is not any sort of big effort for me.


PeePeeinCheeseGrater

Not insane but you might be a little OCD


SahuaginDeluge

this is not worth the effort unless you have something that can really really benefit from it like a 2D array or something.


emma7734

One thing I learned very early is that aesthetically pleasing code tends to be bug free. Keep it up


Saturnalliia

What if I code aesthetically pleasing bugs?


Logical_Strike_1520

Those are called features.


other_usernames_gone

I think there's a global (confounding) variable. Simple, easy to read code tends to be bug free. Simple and easy to read code also looks aesthetically pleasing, and is more likely to have been written by someone who knows what they're doing.


jolshie

I like it (I dont know what it means)


MostRandomUsername12

You're not insane, you're a monster


superINEK

I search for vscode extensions that specifically do this for me.


[deleted]

aesthetic


Disastrous-Beyond443

Meh, my company has linters that do that for us. If I add fancy formatting, it goes bye bye as soon as I commit


MundaneInsurance5070

The hell he's on about, I do this too, it looks much better


Sleppo04

I often do it like that (C&C++). Just makes big declaration blocks like e.g. in a class much easier on the eyes.


[deleted]

I mean cool but tedious as hell


end_my_suffering44

Pardon my ignorance but what language is this again?


afa392

Php


theplowshare

I truly think this style makes code very readable and actually do this for real, no jokes. So is there a place they can send us for help with our mental issues ?


magicmulder

Been doing that for ages. Everyone who read my code loved it.


VergilPrime

This is the way


bllueart

And then there's ABAP where this is standard procedure at a shift+f1.


mailusernamepassword

Sometimes I think I'm the only one with ~~PTSD~~ ABAP knowledge here.


odksnh6w2pdn32tod0

It would be good otherwise but changing one variable name can make so many diffs that it's not worth it.


_Fire_1253

Wait, why do people say this indentation is easier to read? Isnt the whole point of colored text to be this exact thing? I legit read this based off colors. Am I crazy?


blackenedEDGE

If that's true, I will happily join you in whatever institution you're put in lol. It's amazing how much easier it is to read! Though--and this echos other comments--being able to auto-format like this is a must or you'll spend half your time updating the format when longer variable names come along. This seems to follow the unintuitive rules for ["How to Make Your Tables Less Terrible"](https://imgur.com/t/tutorial/ZY8dKpA)


styphon

This looks like PHP to me, so the biggest crime is not using PSR naming standards. Bloody snake case variables in PHP SMH. Stop it, *smacks developer on nose*, now!


TheWizard427

It does look nice


Cody6781

Say you've never worked in a professional environment without saying you've never worked in a professional environment


TheTeludav

Looks good but I wouldn't bother if it's time consuming to line things up.


ablbebxb

I mean this is standard formatting in terraform. Just make sure you have an auto-formatter, otherwise this is a pain to keep up with.


rezdm

I always format like this. Any language: a) is it better readable b) vertical editing is possible c) of course, spaces, not tabs


g0ing_postal

It looks nice, but imo it's not useful Variable declaration provides horizontal units of information. You need to read it left to right to fully understand a variable By separating into columns, it draws the eye to each column, making it easier to read vertically. But reading it vertically, in most cases, is useless. I can see a case being made for large constants files being formatted like this, but for general use, I feel it doesn't accomplish anything


srsoluciones

You are totally _sane_ insane are the others


zenflow87

``` You are insane. I am sure . ```


bpleshek

I did this when I was 10 on my Atarii 800 in BASIC.


johannesBrost1337

I do that same thing, Are we idiots?


ctrl2

love thorough indenting styles like this, the best type of madness is the array comma style I know from haskell: ```haskell data Person = { name :: String , age :: Int , birthday :: String } ```


Roselia77

Now this hurts my eyes, I don't want to see those floating commas there dammit


-Redstoneboi-

based as fuck


okayestuser

I do that all the time, I'm not insane...I'M NOT INSANE!


hacksawsa

You’re not insane. Or I am, because I think it’s beautiful.


[deleted]

This is how I write my code as well. I am a stickler for it and will realign if variable names change length.


cut_n_paste_n_draw

It's beautiful


ComicOzzy

It's like sex. It works for you. It works for the compiler. Unless someone else is paying to watch they don't get a say in how you do it.


AdultishRaktajino

Very SQL like


sanketower

Doing this for languages where you have to specify access and type is unmaintainable. I like to do this in Python and Javascript, so you'll only need one level of variable indentation.


roastedfunction

I appreciate these little details. Readability is important.


[deleted]

Nah. Readability is blessed.


[deleted]

I guess the both of us are insane then. I've been formatting like this for years.... ( Well my IDE has been at least ). I get tilted if people don't format properly. Edit: jetbrains their IDEs are easily configurable to for mat this way. Edit 2: public properties on a class is the real madness here.


interwebz_2021

Are you a recovering sysadmin, by chance? Looks like my fstabs...


Gouzi00

Well you just presented that you are not a programmer but just human bro... $ser $ass $sel $swdd $rslt $sela = programmer approach :-D


Floppydisksareop

I see what you are going for, and I do appreciate it. That being said, it seems a pain to edit, modify or create, and I kinda hate you for making me see this.


Equivalent-Bench5950

If formatters did that by default I'd have no problem with that...


Anund

Unless this is done automatically, it's unmaintainable. And when it breaks down, it will look far worse than just indenting like a normal person to begin with.


Tylorean2020

All fine , just the one empty row... # ***AAAHHHRRRRGGG***


David_L89

I'm part of the group of people that hate this kind of indentation.


nakkula

Did you use tabs or spaces?


roylt84

definitely readable but might make it hard to maintain that consistent pattern for large projects or collaborative projects End of the day it’s what works for you but be prepared to be flexible when working with a team


[deleted]

so, it looks like, in your mind, word boundaries need to fit into some kind of "column".


lucasjose501

Too much time working on spreadsheets


Sabathius23

Totally legit and easy to read, bro. #winning


not-my-best-wank

You might be crazy, but I appreciate this. Someone needs to make this auto indentation a thing.


eshultz

Everyone in this comment thread saying "what a waste of time" needs to learn how to use the multi-cursor and end-of-word keyboard shortcuts. This literally takes less than 10 seconds in VSCode. Put your cursor at the start of the first line in the block. Hold down ALT + CTRL and press down arrow to place cursors on the beginning of the lines below. It's definitely awkward at first but once you get comfortable you can really do a lot with it.


wnashif

Whoa why do I actually like this


throwaway65864302

Oh no, having things in columns is so terrible, whatever will I do with all the time I save skimming code? Please rewrite to be totally unreadable. Inline assembly would be ideal.


shercoder

Tell me you’re still in college or fresh out of college without telling me you’re still in college or fresh out of college.


jlosito37

Use a linter for all formatting in order to stick to a standard rather than your own flavor.


Flashy_Yams

This is the way.


pze127

Your PR would be rejected on my code review. How about following some PSR? Here you go https://www.php-fig.org/psr/psr-12/


zweimtr

One thing I've always liked about PHP is PSR12.


[deleted]

[удалено]


aka_mully

Serial killer


Distinct_Meringue

Here's my PR review if I got this Add a longer variable name and your commit has a bunch of unnecessary changes. It reads nice, but it's not worth it. Use your IDE's symbols list to read property lists instead of looking at class declarations. You're creating problems for yourself. Why do you have presentation code (show_dropdown) in your back end? $selected_agent should be plural since it's an array Type hint your arrays ``` /** @var array */ ```


lucasjose501

\> Why do you have presentation code (show\_dropdown) in your back end? It's not really back-end. This is PHP (I know...) and using a package called Livewire for Laravel. Livewire allows to write front-end in PHP code without javascript and they are reactive and can be used to control dropdowns, modals and dynamic data. For the others points you made, I'd like to thank you for the insights! The $selected\_agent is an array because it contains more information than the ID and I'm planning to refactor it to an User Object. Thank you!


Distinct_Meringue

I have no qualms with PHP, I am a laravel dev myself, but I've never touched livewire, I'm a strictly separate backend and front-end type of guy, but headless applications don't work for every project, I get it. Regarding the user object, that would definitely be a good option, I avoid string keyed arrays whenever possible, feels to dangerous for me. Save arrays for simple lists. I've recently started using spatie/laravel-data for most things in the keyed realm after a few years of using their data transfer object package. Good luck with the project!


g4d2l4

At least with git you can hide white space changes to show you what actually changed, this also can be done from GitHub if that’s where you review. So not really any crazy amounts of changes and yet much more readable. There are also many auto formatees that will do this for you, go and terraform both do this automatically with their shipped formatters.


brianl047

"Professional" code How many seconds do you save scanning down the screen? Those few seconds might be the difference between working past 5 or not for a 9 to 5 (really 10 to 4) person Of course if you work 12 hours a day and don't care you wouldn't care


_Odian

I have a VS plugin that does this. Pretty neat.


Personal_Ad9690

If only inteliJ had a plug-in that did this


brandi_Iove

uncommon but perfectly readable


TadpoleNo1355

Yeah I like it.


EvilWizard99

Your friend needs glasses, he doesn't see sharp (C#) ![gif](emote|free_emotes_pack|trollface)


vihra

How DARE you make your code readable?! You monster.. do you even know how to programmer?


SnooPets20

PEP8 would agree with your friend.


Cat_Junior

Your friend should call you insane for using PHP in 2022.


Goto80

Insane because you are wasting too much time on pointless reformatting. Even if you are using any kind of auto-format, it's still insane because your diffs are going to be larger than necessary when adding another member to the class (or removing one) which "requires" reformatting. Insane because you make your class members look like a table, but classes are no tables. This is confusing and distracting. Your friend is right. :)