Author Topic: Religious technical opinions  (Read 11902 times)

0 Members and 2 Guests are viewing this topic.

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8433
  • Country: fi
Re: Religious technical opinions
« Reply #75 on: February 26, 2022, 12:37:38 pm »
I use as little indent as possible so that 10th indent is still sort of around.

Sometimes (I mean, with some special languages or weird edge cases; I can't think of any example right now, so it's not a common requirement) you need those deep indentations, of course, but if you are doing this with the usual programming languages, then the 10th (actually already the 5th or so) indentation is a severe warning sign you need to restructure your code.

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. Experienced programmers were telling me to refactor the code, utilizing those fancy features like functions to divide the bigger task into smaller subtasks. And indeed they were right, the problem solved itself, and now I'm just using tab width = 8 and do not see any problem with it.

But I still remember my beginner days, and the problem with poorly structured code with deep nesting is that it tends to also suffer from long pieces of code with various levels of nesting. You can't afford large tab width because your lines end up too far right. Also you can't afford small tab width because then you easily lose track on what piece of code is on what indentation level. You just paint yourself into corner.

But when writing proper, high quality code, suddenly you see that small details like tab width / number of spaces becomes far less relevant.

Similarly, strong dependence on fancy editor features is a warning sign something is wrong with the code. With proper code, they can be helpful of course, but are again not that important.
« Last Edit: February 26, 2022, 12:41:19 pm by Siwastaja »
 

Offline m k

  • Super Contributor
  • ***
  • Posts: 2307
  • Country: fi
Re: Religious technical opinions
« Reply #76 on: February 26, 2022, 01:13:41 pm »
You can easily comment those nested functions of functions away and have more meaningful descriptions than countless cryptic names.

Functions are not the answer, structures are, and objects of course.

With Microsoft you're also better of if you do wrappers.
Advance-Aneng-Appa-AVO-Beckman-Danbridge-Data Tech-Fluke-General Radio-H. W. Sullivan-Heathkit-HP-Kaise-Kyoritsu-Leeds & Northrup-Mastech-REO-Simpson-Sinclair-Tektronix-Tokyo Rikosha-Topward-Triplett-Tritron-YFE
(plus lesser brands from the work shop of the world)
 

Offline billbyrd1945

  • Regular Contributor
  • *
  • Posts: 203
  • Country: us
Re: Religious technical opinions
« Reply #77 on: February 26, 2022, 02:36:05 pm »
You're right of course (that the Apple laptop thing is merely product placement). Being slightly paranoid, thinking that most of the world thinks I should be more Apple-like in my politics, it just seems more like a nudge to get right with the world: hug someone, get more green, embrace new pronouns, all that woke stuff. All in my head I'm sure. And what does this have to do with spaces and tabs? Probably nothing. Or it could be the same thing-- a tendency to glom on to certain mindsets.
 

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 496
  • Country: us
Re: Religious technical opinions
« Reply #78 on: February 26, 2022, 06:54:39 pm »
I'm not so sure that Apple is as socially progressive as they would have you think. Remember those TV ads that got Justin Long started? The ones where he would be the Apple guy, all cool and friendly while Microsoft was represented by a stodgy business man in a grey suit?

Well, I've done contract work for both Apple and Microsoft. Apple would bully us into whatever they felt they wanted. IT was truly insulting sometimes, but they didn't care. We had to put in a completely separate shared network drive just for the stuff we did for them. This was literally different hardware from the network shares that we used for everything else. The only people that could access the drive were the ones that they authorized. Visiting their campus at 1 Infinite Loop was much like visiting a military base. There were not groups of armed soldiers marching around, but there were plenty of visibly armed security personnel. Getting into any building required showing identification. Getting into any room required an employee with a swipe card to serve as chaperone. While there, the project manager pointed to each of us one by one and said, "I like you, I don't like you, I don't like you..." WTF? I would be fired for doing something like that, but it was evidently SOP there.

Meanwhile, working with Microsoft was a very enjoyable experience. I recall one engineer saying, while on a conference call, "I hope you guys are having as much fun with this as we are." Visiting their campus was like visiting a vacation resort. There were small park-like spots scattered around outside with benches and decorative plants for a little bit of privacy. Inside there were gyms and workout rooms. They were obviously interested in their employees well being and even suggested that we could use the recreational facilities while in town.

Please make note that I am not commenting on the stuff that either Apple or Microsoft sell, or the way they treat those of us that use that stuff. I'm just commenting on the way we were treated as contractors and the general environment they set up in their workplace.

If you want my personal opinion, I am not fond of Microsoft and don't trust them, but I will never, ever support Apple in any way. Again, that is not based on their products but entirely on my view of the corporation itself.
90% of quoted statistics are fictional
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22127
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Religious technical opinions
« Reply #79 on: February 26, 2022, 11:51:41 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. Experienced programmers were telling me to refactor the code, utilizing those fancy features like functions to divide the bigger task into smaller subtasks. And indeed they were right, the problem solved itself, and now I'm just using tab width = 8 and do not see any problem with it.

I think the longest function I currently maintain (in my unimpressively sized personal codebase) is something like this:
https://github.com/T3sl4co1l/Reverb/blob/master/console.c
probably not a big sin in the grand scheme of things -- and also I'm not really sure how else to do it -- but it has that inelegant smell.  Maybe that's just how it has to be, overlapping a state machine with a character decoder.  I guess the insight then would be to split off the state machine.  The two switchs could maybe be split, but they also share variables so a few things would be duplicated or passed around.  Not to mention the goto... ;D

Oh, I should probably abstract away the serial calls, so it can do abstract IO calls instead.  Though probably at some overhead (pointer function calls).

Shrug, things to think about next time I have it open.  Oh, come to think of it, this version hasn't been patched with the couple bug fixes I've found since then, either, heh.

Anyway, a possible advantage to smaller functions, is better optimization.  The compiler can only afford so much time to optimize sections of code, and large, interdependent stretches may perform quite poorly.  That is, high complexity (in terms of number of clauses, cyclomatic complexity, AST depth, etc.) may limit the number of passes.  (IANA compiler designer; this is probably at the right sort of thing, but not actually the most representative quantity.)  These will be one-off functions not used anywhere else, so the compiler will happily inline them all for you -- presumably with whatever sequence of optimizations it finds beneficial.  Hopefully including some before inlining?  Anyway, even if you have to like pass around a dozen variables, or make a struct of your master-function local variables or something; once it's inlined, that's either trivial (register level), or you have enough that they go on the stack anyway so are only slightly less trivial to access remotely.

My one example of "compiler throws up its hands" was a 24 to 16-bit conversion macro, i.e. for 5-6-5 LCD color.  I initially wrote everything out in one uber-expression, using a few macros to expand a fairly simple expression into, something like 5 or 6 lines all written out.  GCC didn't like that. :-DD  At least not for AVR.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22127
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Religious technical opinions
« Reply #80 on: February 27, 2022, 12:47:23 am »
I'm not so sure that Apple is as socially progressive as they would have you think.

Ya nah.  They're "woke" in ads, it's performative.  See also all the companies that change their logos to rainbows in Oct.  But who also sell products in Russia, Arabia, various parts of Asia, etc.  And who, suspiciously, for some reason, don't also change their logos in those locations...

I mean look at their revenues, they're as hardcore a neoliberal company as you can get.  They have to be, almost by law; they're publicly traded.  Well, maybe that still counts as "liberal" to someone that's fallen off the deep (right) end in the US, but it's at best a very centrist position in the broader scheme of things.  Where it really matters is this: how much of their money do they give to support progressive organizations?  Lobbying for progressive causes?  Giving to charities helping the poor, homeless, etc.?  Supporting unionization within their organization, or elsewhere?  (Not much of an issue for the most part, with the freedom of movement enjoyed by most in the tech industry, but video games have seen some organization in recent years, and also, the inequality between C-suite and the worker has still only continued to rise, regardless of whether those workers are doing shop work or engineering.)

The same happened to Google, what used to be a fair and open minded company ("Do no evil!"), quietly dropped its tagline a long time ago and joined the behemoths in being, about par for the course as far as megacorps go.  That said... (continued below)


Quote
Well, I've done contract work for both Apple and Microsoft. Apple would bully us into whatever they felt they wanted. IT was truly insulting sometimes, but they didn't care. We had to put in a completely separate shared network drive just for the stuff we did for them. This was literally different hardware from the network shares that we used for everything else. The only people that could access the drive were the ones that they authorized. Visiting their campus at 1 Infinite Loop was much like visiting a military base. There were not groups of armed soldiers marching around, but there were plenty of visibly armed security personnel. Getting into any building required showing identification. Getting into any room required an employee with a swipe card to serve as chaperone. While there, the project manager pointed to each of us one by one and said, "I like you, I don't like you, I don't like you..." WTF? I would be fired for doing something like that, but it was evidently SOP there.

Yeah, that sucks...  I see their interest for secrecy -- inevitably, the next iPhone 667 or whatever gets leaked before release; schematics and other design files drop out of supply chains; etc.  It's critical to their marketing strategy, to protect that.  So it makes sense to lock up contractors carefully that way, even if it means duplicating effort (what might be avoided by having stronger communication between employees and contractors, better visibility into internal projects, etc.).  And I mean, they're not exactly hurting for profits, they can handle that.

That PM sounds like something HR should've heard about though.  Whether or not HR would take their side, who knows, or if they'd care what some menial contractor has to say.  Think I'd want to at least scribble that interaction in my notepad, maybe ask the PM later about it (say to confirm they said what had been written down -- will they double down for it?), though that's probably too direct/confrontational; maybe take it to another higher-up or to HR.  Something else to put on their file if nothing else.

Assuming there wasn't other context of course.  A simple "like/not like" isn't exactly grounds for dismissal, and could make sense in context, if maybe not being a very professional thing to say, even in context.  I'm assuming from your impression, this wasn't the case.


Quote
Meanwhile, working with Microsoft was a very enjoyable experience. I recall one engineer saying, while on a conference call, "I hope you guys are having as much fun with this as we are." Visiting their campus was like visiting a vacation resort. There were small park-like spots scattered around outside with benches and decorative plants for a little bit of privacy. Inside there were gyms and workout rooms. They were obviously interested in their employees well being and even suggested that we could use the recreational facilities while in town.

(continuing from above)... That's good.  Probably, they've been around this for long enough, that they know better than to dig in too deep.  Can't exactly crunch-time something as important as a whole-ass operating system, and it doesn't make sense anyway for things like continuous development or the like (e.g. might also consider Windows Updates as a coarser kind of CD).

And there's Facebook, which as far as I know is more or less generally okay with management of workers, but you also have their involvement in the manipulation of now several countries' political processes, on top of the glaring privacy issues, unfair ad marketing, etc.).  They pay quite highly these days, so I've heard, and with good reason, still having high turnover despite that pay.  (I mean, no idea what the overall numbers are, but many treat it as a shiny badge to stick on the resume, so, just work there for a year or two, do a few projects, learn how to do things at truly world scale... then get away from that mess.)

Or Amazon, as far as I know very much on the grind from top to bottom.  Software side maybe not as bad as warehouse but still under constant/implied threat of PIP.  (Performance Improvement Plan: give worker unrealistic expectations as grounds for termination.)


Quote
If you want my personal opinion, I am not fond of Microsoft and don't trust them, but I will never, ever support Apple in any way. Again, that is not based on their products but entirely on my view of the corporation itself.

As a rule, it's a good idea not to trust any large company.  They make too much money in too many ways and places, to have any kind of ethics, or transparency.  Trust is earned, not given.  Similarly, it may not be possible to avoid exploitation in a capitalist society, but we can at least try to reduce our individual impacts on that.  Using Amazon, Alphabet, MS or other services, at all, is not a moral failing but an unfortunate inevitability given their scope.  The best we can do then, is to reduce our use of them.

I mean, if you want to get all ethical about it.  Or political.  At least it's not religion, amirite?...

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Bassman59

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
Re: Religious technical opinions
« Reply #81 on: February 27, 2022, 12:48:33 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.)

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.

As for tabs vs space, I honestly don't care. The editor sorts that out.
 
The following users thanked this post: tooki, newbrain

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1745
  • Country: se
Re: Religious technical opinions
« Reply #82 on: February 27, 2022, 01:43:06 am »
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.
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.
For the same reason of ease of reading, i use Allman style: the vertically matched braces help my comprehension.

Using 4, though, is not an excuse to for crazy nesting depths: I think the deepest in my code is 5 (in a bitmap font drawing function for LCDs) - refactoring the inner part as a function would need to pass too much state for very little gain in readability.

But indenting and formatting are mechanical operations, and, guess what, computers are good at those.
So I leave them to clang-format, usually through VS (Code or full), with the following style:
Code: [Select]
{
    BasedOnStyle: LLVM,
    UseTab: Never,
    IndentWidth: 4,
    TabWidth: 4,
    BreakBeforeBraces: Allman,
    IndentCaseLabels: false,
    ColumnLimit: 0,
    AccessModifierOffset: -4,
    AlignConsecutiveAssignments: true,
    AlignConsecutiveDeclarations: true,
    AlignConsecutiveMacros: true,
    AlignEscapedNewlines: true,
    AlignTrailingComments: true,
    AllowShortIfStatementsOnASingleLine: true,
    PointerAlignment: Right
}

That said, at work I witnessed a piece of open source code with McCabe complexity of 138 |O: no formatting or indentation could save it.
Luckily, I was not the person that had to modify it.
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6643
  • Country: fi
    • My home page and email address
Re: Religious technical opinions
« Reply #83 on: February 27, 2022, 02:03:41 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.)
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.
Yup.  One is protective of the things they love and cherish, and there is not much that is as close to ones roots and culture and heart as food is.

Consider Finnish mämmi.  It looks disgusting.  The malted rye taste is weird, and when mixed with cream, even weirder.  I like it.  However, it is not the taste, but the cultural roots behind it, that makes it 'important' to Finns.  It is something utterly typical to Finns: in the olden times, in spring – Easter –, we had no fresh fruit or berries or anything like that left for sweet desserts, so discovering the rather interesting chemical process that produces such complex and sweet flavours at just 2% sugar content is a testament to the tenacity and inventiveness of Finns.  The first part of the process, 'imellyttäminen', does not have a proper translation to English at all, and is usually translated as "natural sweetening process" or "caramelization", and occurs when enzymes convert starch to maltose (which provides the sweetness).  The second part is the Maillard reaction during baking, providing the complex flavours.

If you know the history, then it is a completely different thing to try and taste mämmi: it's about how humans without many resources in rather harsh natural conditions found ways to celebrate; and nowadays is a way to connect to ones cultural roots generations back.  And the way it is made, it's safe to eat, too. (You can get an upset stomach if you eat too much.  Complete maltose intolerance is exceedingly rare.)  Not telling someone any of this, and making them taste mämmi, is cruel and ignorant, in my opinion.
 
The following users thanked this post: Siwastaja

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27500
  • Country: nl
    • NCT Developments
Re: Religious technical opinions
« Reply #84 on: February 27, 2022, 02:16:43 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.)

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.
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)

Meanwhile in Italy: https://florianscafe.it/menu/ Random pizzeria in Rome, Italy where they have pizza Hawaii on the menu.  :popcorn:
« Last Edit: February 27, 2022, 02:18:54 am by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15030
  • Country: fr
Re: Religious technical opinions
« Reply #85 on: February 27, 2022, 02:23:35 am »
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.
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.

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

For the same reason of ease of reading, i use Allman style: the vertically matched braces help my comprehension.

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.

 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6643
  • Country: fi
    • My home page and email address
Re: Religious technical opinions
« Reply #86 on: February 27, 2022, 03:28:59 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.)

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.
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)
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.
« Last Edit: February 27, 2022, 03:35:39 am by Nominal Animal »
 
The following users thanked this post: PlainName

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6643
  • Country: fi
    • My home page and email address
Re: Religious technical opinions
« Reply #87 on: February 27, 2022, 04:05:32 am »
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?
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8433
  • Country: fi
Re: Religious technical opinions
« Reply #88 on: February 27, 2022, 07:48:18 am »
8 is ridiculously large IMHO.

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.
 

Online PlainName

  • Super Contributor
  • ***
  • Posts: 7061
  • Country: va
Re: Religious technical opinions
« Reply #89 on: February 27, 2022, 08:30:23 am »
Quote
I've always disliked the TBS thingy

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]
« Last Edit: February 27, 2022, 08:35:24 am by dunkemhigh »
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6643
  • Country: fi
    • My home page and email address
Re: Religious technical opinions
« Reply #90 on: February 27, 2022, 08:45:54 am »
I have also dropped the amount of sugar I put in coffee from ridiculous 4 teaspoons(!) per cup* to maybe a half teaspoon.
None for me, but with milk, please.  With tea, I like some liquid honey.  (The crystallized stuff is often sugary; that is, is not actually honey, but a mix of sugar and honey.  Crystallized honey is okay, though.  Never plain sugar; don't like the taste.)

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.
I agree.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12222
  • Country: ch
Re: Religious technical opinions
« Reply #91 on: February 27, 2022, 08:56:04 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.)

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.
OK, that actually gives me one positive thing to say about New Jersey!  ;D

(I joke about New Jersey, but mostly because my friends from New Jersey have encouraged it! :P )
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 12222
  • Country: ch
Re: Religious technical opinions
« Reply #92 on: February 27, 2022, 09:15:27 am »
I'm not so sure that Apple is as socially progressive as they would have you think.

Ya nah.  They're "woke" in ads, it's performative.  See also all the companies that change their logos to rainbows in Oct.  But who also sell products in Russia, Arabia, various parts of Asia, etc.  And who, suspiciously, for some reason, don't also change their logos in those locations...

I mean look at their revenues, they're as hardcore a neoliberal company as you can get.  They have to be, almost by law; they're publicly traded.  Well, maybe that still counts as "liberal" to someone that's fallen off the deep (right) end in the US, but it's at best a very centrist position in the broader scheme of things.  Where it really matters is this: how much of their money do they give to support progressive organizations?  Lobbying for progressive causes?  Giving to charities helping the poor, homeless, etc.?  Supporting unionization within their organization, or elsewhere?  (Not much of an issue for the most part, with the freedom of movement enjoyed by most in the tech industry, but video games have seen some organization in recent years, and also, the inequality between C-suite and the worker has still only continued to rise, regardless of whether those workers are doing shop work or engineering.)

The same happened to Google, what used to be a fair and open minded company ("Do no evil!"), quietly dropped its tagline a long time ago and joined the behemoths in being, about par for the course as far as megacorps go.  That said... (continued below)

FWIW, I worked at the fruit stand (Apple retail) many years ago, and while it had its issues (like any workplace), they honestly treated their retail workers way, way better than average. I certainly don’t believe it’s “all performative” — my experience with the company is that, for the most part, they really did believe in the things they said they do.

And yes, the secrecy within Apple runs through and through. I worked the launch of the original iPhone, which was the biggest product launch in the company’s history. The Sunday night before launch, we had an all-hands meeting (in our case, amusingly held outside the store by moonlight on the fiberglass dinosaurs in the mall playground because there was a power outage!). The inventory for launch day arrived in advance, kept in lockers, without anyone in the store except the inventory specialist knowing about it. On launch day, we had to close the store at 4pm, then had two hours to redecorate the entire store (something normally done over 4-6h as an overnight shift) and get our only hands-on experience before opening at 6pm to let the crowds in. Biggest launch in company history and we got to see it a whopping two hours before selling it.

I also worked the launch of the MacBook Air at the Macworld expo in 2008. Even as someone who’d be working the Apple booth, literally demoing the thing to both media and the public, we didn’t get any advance notice of the products being launched, we watched the keynote just like everyone else, then went across the street to the booth and got to work.

As an Apple employee, I was able to get my own badge to enter the Apple headquarters unescorted, but obviously everything interesting requires special access permissions.
 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 4713
  • Country: au
    • send complaints here
Re: Religious technical opinions
« Reply #93 on: February 27, 2022, 11:20:19 am »
vim is the only editor, vim is the best editor, if you disagree you've not really tried it (or using emacs which is fine) <vim makes me forget tabs vs spaces is a thing>
Citation needed  ;) [...]
I've had a hard time finding research on the subject, but every poll I looked at, vim is on top :)
But you said it made you forget tabs vs spaces. Another poster thought their choice of editor magically fixed it, how does vim make the problem easier?
 

Offline m k

  • Super Contributor
  • ***
  • Posts: 2307
  • Country: fi
Re: Religious technical opinions
« Reply #94 on: February 27, 2022, 12:10:45 pm »
My text has many indents, couple nested cases and it's over 10.
Then if innermost has a Widows API call its parameters are far far away right.
I'm also from Pascal land and can't stand end of line begins.

But what kind of a professional offers totally unneeded functions eating time of possibly millions of unneeded calls.

One must also wonder what makes a know-it-all, self-righteousness, religiousness or something else.
Advance-Aneng-Appa-AVO-Beckman-Danbridge-Data Tech-Fluke-General Radio-H. W. Sullivan-Heathkit-HP-Kaise-Kyoritsu-Leeds & Northrup-Mastech-REO-Simpson-Sinclair-Tektronix-Tokyo Rikosha-Topward-Triplett-Tritron-YFE
(plus lesser brands from the work shop of the world)
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27500
  • Country: nl
    • NCT Developments
Re: Religious technical opinions
« Reply #95 on: February 27, 2022, 12:37:37 pm »
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.)

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.
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)
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.
We should have conquered the Finns as well and fix their sarcasm detection skills.  >:D
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8433
  • Country: fi
Re: Religious technical opinions
« Reply #96 on: February 27, 2022, 01:04:48 pm »
My text has many indents, couple nested cases and it's over 10.
Then if innermost has a Widows API call its parameters are far far away right.
I'm also from Pascal land and can't stand end of line begins.

But what kind of a professional offers totally unneeded functions eating time of possibly millions of unneeded calls.

Function call overhead is really small. Furthermore, with compiler optimization, automatic or guided (even forced) inlining, you can decouple optimization from writing good code. Only very rarely needs code quality suffer because of performance, and then it's about something else than dividing work into functions (which can be inlined after all).

It sounds like you just "can't" write good code, you know this yourself, and are making up excuses (to yourself, no one else!) to keep doing what you do.

And don't get me wrong, I'm not claiming to be a great coder myself, either, and I still sometimes write really crappy code in stressful situations, which I can see myself. But improvement starts from admitting you have a problem (to yourself; no need to admit it to anyone else if and when it's hard to one's ego).

But I think (I'm not sure of course, there are many contributing factors, too) that using wide tab width has kinda forced me to break down the code to smaller modular pieces, or think about how something is implemented, because indentations longer than 4-5 tabs then start to really stand out, in a bad way. 3D loop inside a function still looks OK, but if I then add a switch-case inside it, eye pain makes me think: maybe this switch-case should become parse_token(...)? And then, the magic happens: I realize I need to parse_token() somewhere else, too, and don't need to copy-paste the code. Even better, maybe parse_token() can go through some configuration struct instead of being a massive switch-case.

The point is, if minor workflow details like indentation width or IDE autocompletion features seem to become massive pain points (instead of just tiny convenience factors), that's definitely an alarm sign, IMHO.

But "I need to write crappy code because of performance" actually is quite religious. I know very well because I have resorted to that argument, myself. I have been shown to be wrong by more experienced people, and have learned as a result.
« Last Edit: February 27, 2022, 01:11:14 pm by Siwastaja »
 
The following users thanked this post: langwadt

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6643
  • Country: fi
    • My home page and email address
Re: Religious technical opinions
« Reply #97 on: February 27, 2022, 01:36:52 pm »
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.)

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.
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)
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.
We should have conquered the Finns as well and fix their sarcasm detection skills.  >:D
Never!  We'll fight to the last polar bear before we'll learn small talk and social skills.  >:(
 
The following users thanked this post: Siwastaja, tooki

Online langwadt

  • Super Contributor
  • ***
  • Posts: 4607
  • Country: dk
Re: Religious technical opinions
« Reply #98 on: February 27, 2022, 01:59:44 pm »
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.)

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.
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)
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.

back in the 80's everyone here was building a sauna as part of their bathroom, most of them was used once or twice and then used to store toiletpaper and lawn furniture in the winter ...

 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22127
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Religious technical opinions
« Reply #99 on: February 27, 2022, 02:10:48 pm »
Never!  We'll fight to the last polar bear before we'll learn small talk and social skills.  >:(



Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: hans, Thomas, nctnico, PlainName, Siwastaja, tooki, Nominal Animal


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf