sm-lib-apt-tools r1094
Lat
Status: Interested
Joined: 11 Apr 2008
Posts: 29
Reply Quote
Hi, was sm-lib-apt-tools modified by accident trying to copy paste to sm-lib-package-removal in r1094, or the new lines has something to do with anything? I don't see any change between r1094 and r1082 in sm-lib-apt-tools.


code.google.com/p/smxi/source/detail?spec=svn1101&r=1094 or
code.google.com/p/smxi/source/diff?spec=svn1101&r=1094&format=side&path=/trunk/sm-lib-apt-tools
Thank you
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4128
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
r1094 simply got rid of a one liner and put in proper expanded code syntax.

I've been discovering consistently, especially on the infobash->inxi project, that ALL one liners hide bugs, obfuscate code and logic, and are in general basically unreadable.

So I've been cleaning them up as I find them. Since this particular cleanup and expansion didn't change any logic at all, as you noted, I didn't up the version number on sm-lib-apt-tools.

I shouldn't admit this, but in fact, the reason I left that awk line like that for so long was that awk simply was a mystery to me, and i was afraid to break it, but since I had to learn it much more in inxi, I now feel more comfortable working with awk code.

In inxi, because of how absurdly complex it is, I had to go through it several times and expand ALL one liners, to make the code instantly readable, clear, and maintainable. Otherwise I kept getting bugs and little errors and glitches based on something tagged along the end of a logic statement.

Here's what I've now learned after almost 10 years of programming at various levels: everything I was told by my best teacher is true.

Putting in a condition with a statement on the same line is largely unreadable, with a very small group of exceptions, the <test> || error_handler being the most useful on in Bash, and about the only one I use anymore as a one liner.

I have been consistently astounded at how much a group of one liners especially can hide the intended logic of a series of tests, in one case, in smxi, when I got rid of all the one liners, which were of course all different lengths, I realized I was actually looking at a single case event, with different cases, not 5 or 8 different tests.

That's just one example of why I never use one liners anymore.

note that a one liner doesn't mean not using piped stuff in bash where appropriate, or where it really is the best way to do it, as long as it's fairly readable.

I moved this to the smxi dev forums because your question is strictly a dev thing.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours