General > General Technical Chat
Religious technical opinions
<< < (18/22) > >>
SiliconWizard:

--- Quote from: newbrain on February 27, 2022, 01:43:06 am ---
--- Quote from: Siwastaja on February 26, 2022, 12:37:38 pm ---I used to do indentation width of 4 and thought that 8 is absolutely ridiculous, the proof being that my lines wander up so far right.

--- End quote ---
I still find 4 as the goldilocks indentation step: any less and my eyes lose track of the nesting, any more (i.e. 8  - I never met anything like 6 or odd numbers!) and the jumps are too wide and disrupt the flow of my reading. Not being 4 the standard tab size, I prefer spaces.

--- End quote ---

I don't like having to deal with spaces for indent, as I said earlier. But I agree with the width of 4 being the sweet spot.
2 is really too little to be useful as indentation IMO and, last time I used that was in the 90s when screen estate was still at a premium.

8 is ridiculously large IMHO. It's then funny to see that this is the default width used for displaying code in github, and many other similar web sites.
It's either as though they just have no taste (to quote Steve Jobs  :-DD ), or they just do that on purpose to kind of push people to use spaces instead of tabs. You know, as a way to show the world that people using tabs are doing it wrong. Either way, there's something twisted there. ;D


--- Quote from: newbrain on February 27, 2022, 01:43:06 am ---For the same reason of ease of reading, i use Allman style: the vertically matched braces help my comprehension.

--- End quote ---

Same. I've always disliked the TBS thingy. Which is "true" for whoever coined the term anyway. Sure there is personal preference in that, and then habit and "education".
Some people have been exposed to TBS from the get-go and just don't know any better, and are used to that. I wasn't actually, because back when I learned C, despite being the style seen in the K&R book, it was actually rather rarely used at my uni - and in a lot of open source stuff that existed back then that I was exposed to. But of course your own experience may vary.

But these days, it seems like another kind of "war" for many, which is just so dumb.

Nominal Animal:

--- Quote from: nctnico on February 27, 2022, 02:16:43 am ---
--- Quote from: Bassman59 on February 27, 2022, 12:48:33 am ---
--- Quote from: Nominal Animal on February 26, 2022, 05:56:11 am ---As to tabs/spaces, I don't have any trouble using whatever the project I'm working on.  I do have a personal preference, but it's about as strong as my preference for ice cream flavours, or pizza.  (I don't get fazed by pineapple on pizza, either.)
--- End quote ---

See, I'm from New Jersey, and if you even mention "pineapple on pizza" in New Jersey, you'll be met with an armed response, and not just from the made guys sitting in the back of the pizza shop with their little notebooks counting out cash.

--- End quote ---
And how & why would people from New Jersey get upset about an Italian dish? Due to lack of a local cultural heritage they may feel connected to Italy because their ancesters came from there a couple of centuries ago but most likely they don't even know where Italy is.  8)
--- End quote ---
That's just thick coming from someone in the Netherlands.  Haven't conquered enough indigenous peoples around the world, eh?  Then go smoke something, won't you.

The snide remark aside, it is a well known phenomenon that specific cultural heritage details are strengthened in emigrants, exactly because of their emotional ties.  Food is a typical one; a specific dish or type of food is often more popular among specific emigrant population than in the originating country, because it is the cultural-emotional tie.  Sometimes it is religious or traditional garb used in specific ceremonies.  Or, say, a lady TV presenter having traditional face tattoo.  As time progresses and the emigrants integrate into and become part of a local culture, a specific dish originating half a world away can easily become the 'food landmark' of a region.  So, people in New Jersey today having a specific dish they associate with like that, is perfectly normal.

It's like Finns always building a sauna wherever they live.  Even Finnish peacekeepers always build saunas.  Even in the middle of deserts.  As locals visit and try it out, they sometimes take a liking, and you end up with small regions that have lots of saunas, with no Finns (or Nordics) at all.  You'd think it's weird, but it's not: that's how influences naturally spread.  I think it is a good, interesting thing.

Culture is not just "we were a huge power once, with amazing music and architecture and arts"; it is what ties people together at any point in time.  Their values and customs.  Food is a very typical thing where the unique features of each culture tend to pop up.  Their actual historical origins can be quite funky and weird and distant: that too is typical to us humans.
Nominal Animal:
The Wikipedia indentation style article has a point about statement insertion, that makes me keep the opening brace of conditional and loop blocks at the end of the line containing the controlling statement, as opposed to on a new line aligned with the corresponding close brace as in the Allman style.

Which means that for my own code, I guess I prefer the 4-character tab version of the Linux kernel indentation style with unlimited line lengths?
(In truth, it is just what seems most readable to me.)

When I work with existing codebases, I use whatever they use.  It is much more important that the style is consistent, than what that style actually is.  (I don't like the GNU style because of the "half-indents" and function return type being on its own line; I read such code slower than code written in other styles, even though I'm very familiar with the style.  I do not dislike the style enough for it to affect my opinion on any code using that style, though.)

After all, coding style – including spaces vs. tabs – is only a 'thing' because consistency makes reading and maintaining code easier.  They all work, the preference just varies from person to person.

Indeed, coding style 'wars' are ridiculous arguments, because we do have automatic tools like indent to change the style if necessary.  Usually it is not necessary, and is just a 'war' over flavour... bike-shedding.
Would anyone really refuse to work on a code base because of its indentation style?
Siwastaja:

--- Quote from: SiliconWizard on February 27, 2022, 02:23:35 am ---8 is ridiculously large IMHO.

--- End quote ---

It's funny how a human being adapts to anything. Like if you halve the amount of salt you put in food, it tastes ridiculously... tasteless. It just can't be right. Yet, in a few months, it starts tasting completely normal. I have also dropped the amount of sugar I put in coffee from ridiculous 4 teaspoons(!) per cup* to maybe a half teaspoon.

*) coffee cup = 250ml

I used to think that 8 is ridiculously large indentation, too, and messes up with the "flow" like newbrain said. Yet, for some reason I don't remember, I just started using tab and not configure my editor beyond defaults. I don't remember how long it took, but probably not more than half a year, until 8 started to look completely normal, and 4 (what I had been using for 15 years or so) a bit weird, instead.

At that point, I realized the "sweet spot" is actually a surprisingly wide range. Inside that range, it's only a personal preference which is not much more than what you are used to. From purely physiological/psychovisual viewpoint, I think anything between 2-10 does the job.
PlainName:

--- Quote --- I've always disliked the TBS thingy
--- End quote ---

Had to look that up  :palm:

Er, that's what I do. Originally I used the Allman style but it wastes two lines unless you have a single indented line and no braces. I didn't like K&R/TBS because the braces don't line  up, but then I I figured the closing brace was the important bit and easily matched to the opening statement, and most important it could be consistent: one line or many lines you always use one extra for that last brace.

The consistency is important to me. With Allman style there is a huge temptation to skip the braces if you only have one code line, but that can lead to conditional lines being executed when they shouldn't be if the code is modified. For that reason I consider always using braces, and the only scheme that doesn't waste lots of lines in TBS.

Not completely sure whether indenting the brace (Ratliff) is good or not. Not indenting (K&R) lines it up with the start of the statement, but it's then adrift from the indented code. If the brace is indented there's a solid straight line of everything so easy to follow. Same issue with Allman/GNU style and currently I am favouring not indenting (that is, the brace lines up with the start of the statement).

Having said that, I am currently porting some code I wrote in '96 which used indented Allman and it's pleasingly readable. Hmmm.

[Edit: checking the wikipedia entry it seems I got the styles mixed. Updated]
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod