[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: simpler question about my script
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: simpler question about my script |
Date: |
Fri, 18 Feb 2022 19:28:33 +0100 |
On Fri, Feb 18, 2022 at 6:53 PM Sysadmin Lists <sysadmin.lists@mailfence.com>
wrote:
> > Message: 2
> > Date: Thu, 17 Feb 2022 21:11:42 -0500
> > From: Greg Wooledge <greg@wooledge.org>
> > To: help-bash@gnu.org
> > Subject: Re: simpler question about my script
> > >
> > > That's an excellent list except for the (qualified) part about
> cleverness, IMO. If you read through old (I mean 70s and 80s) code, it's
> stuffed with cleverness. Being clever forces a deeper understanding of the
> language in use, forces brevity, and forces tight flow-control. It doesn't
> take away from readability if you comment your code well (which is also a
> dying art probably tied to the advice about cleverness). I see "avoid being
> clever" becoming "be lazy" in the real world.
> >
> > I agree with Dennis here. What you think is "clever" today is
> "unreadable
> > gibberish, what the hell was I thinking" 6 months from now. You're just
> > hurting yourself.
> >
> > Also bear in mind that programs written in the 1970s may have needed to
> > work on extremely limited or bizarre systems. Couple that with compiler
> > optimizations being quite poor, and you had people trying desperately
> > just to get *anything* to work. It's not a fair comparison to today's
> > needs.
>
> I suspect we're not operating with the same definition of "cleverness"
> here. I've yet to see genuinely clever code that looked like gibberish;
> I've seen plenty of gibberish that was meant to be clever and wasn't. There
> is nothing more satisfying than a brilliantly written recursive function --
> yet the "don't be clever" dictum would suggest not writing them. I've seen
> complex sed and awk scripts written in dozens-of-lines that today would
> take a dozen pages. The modern lack of mental rigor is telling.
>
> And in many cases, lack of brevity leads to lack of readability. I've seen
> far too many bash and shell scripts that were twice as long as they needed
> to be. It's clear when forethought was lacking during their creation.
>
> The "don't be clever" advice is one of those "feels good to say" mantras
> that get passed around in this industry, like "there's no right or wrong
> way to do things in [*nix|programming]." But there are good ways and bad
> ways to do things, and some good ways are better than others. I suppose the
> people that need to hear "don't be clever" are the ones that obey it
> anyway, so no harm done there.
>
thank you for somewhat defending my point
i didnt do wrong, i coded short nice stuff ( ok with bugs and comments )
and in the result it looks weird and not much readable but, it does what it
should do, the commands it should do
greetings
> --
> Sent with https://mailfence.com
> Secure and private email
>
>
Re: simpler question about my script, Sysadmin Lists, 2022/02/17
Re: simpler question about my script, Sysadmin Lists, 2022/02/18
Re: simpler question about my script, Sysadmin Lists, 2022/02/20