Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

vodkat posted:

i use folding all the time op because gently caress splitting all of my lovely html parsing code into separate files, better to keep that garbage contained

wish your posting was contained 2 this thread lmao

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
just like the Japanese masters, I fold my code hundreds of time to ensure it is as strong as possible.

gonadic io
Feb 16, 2011

>>=
all the time op. although in C# it's called Aggregate.

exe cummings
Jan 22, 2005

Shaggar posted:

just like the Japanese masters, I fold my code hundreds of time to ensure it is as strong as possible.

tazjin
Jul 24, 2015


I fold org-mode files but not code.

Shaggar posted:

just like the Japanese masters, I fold my code hundreds of time to ensure it is as strong as possible.

It's impossible to fold code more than 7 times

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

one thousand coded cranes

LP0 ON FIRE
Jan 25, 2006

beep boop

tazjin posted:

It's impossible to fold code more than 7 times

crusader_complex
Jun 4, 2012
im looking at the word fold over and over and its weird. fold. fold.

Cybernetic Vermin
Apr 18, 2005

LP0 ON FIRE posted:

my theory is, if you need to fold your code, then your code is too complex and needs to be split into methods/functions and different files

"if you X then your code is too complex and needs to be refactored" turns out to be true for all "X" according to stackexchange

There Will Be Penalty
May 18, 2002

Makes a great pet!
all code is poo poo

Inexplicable Humblebrag
Sep 20, 2003

crusader_complex posted:

im looking at the word fold over and over and its weird. fold. fold.

flod

Amethyst
Mar 28, 2004

I CANNOT HELP BUT MAKE THE DCSS THREAD A FETID SWAMP OF UNFUN POSTING
plz notice me trunk-senpai
Interesting topic. I've never really thought about it as a sign of poor code quality and the plain utility seems like it should override such vague considerations. I guess if you are a dyed in the wool OO acolyte who insists on X amount of lines per individucal file you could get caught up with this bug if you ban people from using it you will just annoy a lot of FP programmers.

Jeff Atwood had some interesting thoughts on the matter:

hen you join a team, it's important to bend your preferences a little to accommodate the generally accepted coding practices of that team. Not everyone has to agree on every miniscule detail of the code, of course, but it's a good idea to dicuss it with your team and decide on overall approaches and philosophy beforehand. It promotes team harmony, and more than that, it's just common courtesy. As they say, when in Rome, do as the Romans do.

I've always been wary of cowboy coders who rolled into an ongoing project on fresh horses and immediately started dictating terms. It's a very short trip indeed from there to Who Wrote This Crap, and the predictable, inevitable finger-pointing at the foolhardy programmers who came before you begins. Don't be that guy or gal. Work with your team, not against it.

Folding is used to sweep code under the rug. Got a bunch of boring boilerplate code that makes your eyes water? A slew of ugly, gnarly code that nobody in their right mind wants to look at? Hide it in a region and fold that sucker into oblivion! Problem solved, right? Hardly. Your project is now full of crappy code that you can't see. That's worse. Much worse! Code that hides from you is code that will rot in the most putrescent and painful way possible. Your code should be front and center at all times -- exposed to as many programmers' eyes, and as much healing light, as possible.

Folding is used to mask excessive length. The presence of folded code can lull developers into a false sense of what clean code looks like. Under the cover of folding, you can end up writing long, horrible spaghetti code blocks. If the code needs the crutch of folding to look organized, it's bad code.
Folding can hide deficiencies in your editor. The presence of so-called "standard" boilerplate regions like "Public Constructors" and "Public Properties" and "Events" is not a feature. It's a bug. The editor should automatically offer to fold up these common structural blocks for you! I'm continually amazed that programmers spend time doing this scutwork when they could be writing useful code. Or at least demanding a smarter code editor.
I urge developers to write code that doesn't need folding to be readable, clear, and concise. I'm sure there are sane uses for code folding out there somewhere, but I rarely see them.

I hope everyone found this post informative.

power botton
Nov 2, 2011

Always fold because if you're coding you've already lost

power botton
Nov 2, 2011

power botton posted:

Always fold because if you're coding you've already lost

nrook
Jun 25, 2009

Just let yourself become a worthless person!

gonadic io posted:

all the time op. although in C# it's called Aggregate.

Why does C# have weird names for all its functional programming constructs anyway

I can't believe I spent a year of my life saying "oh yeah, I'll call Enumerable.Select here. This is a normal name for this function. I can see why it's called this and not Map."

gonadic io
Feb 16, 2011

>>=

nrook posted:

Why does C# have weird names for all its functional programming constructs anyway

I can't believe I spent a year of my life saying "oh yeah, I'll call Enumerable.Select here. This is a normal name for this function. I can see why it's called this and not Map."

because monads

return0
Apr 11, 2007

nrook posted:

Why does C# have weird names for all its functional programming constructs anyway

I can't believe I spent a year of my life saying "oh yeah, I'll call Enumerable.Select here. This is a normal name for this function. I can see why it's called this and not Map."

probably to make it sounds like an sql query

return0
Apr 11, 2007
i never fold ever, and in fact hate those who do

The Leck
Feb 27, 2001

Power Ambient posted:

lol if you ever have so much code in one file that you need to fold it
so a 6000 line class - too big?

Bloody
Mar 3, 2013

linq takes names more from sql than dumb math poo poo

Bloody
Mar 3, 2013

hence select, where, aggregate instead of map, filter, fold

There Will Be Penalty
May 18, 2002

Makes a great pet!
linq more like stinq

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

Bloody posted:

hence select, where, aggregate instead of map, filter, fold

select where you fold your aggregated filter maps (it's your butt lmao)

Adbot
ADBOT LOVES YOU

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

suffix posted:

every time i encounter a file where some idiot has added fold markers i waste a minute finding the 'open all' shortcut

Control+M, Control+S

  • Locked thread