¿ªÔÆÌåÓý

Re: Coding styles


 

Art,

before the moderators shut down this trip down memory lane¡­..but, I think it is relevant¡­as coding is a part of the BitX family and its experimentation¡­..

we all have stories¡­..

the last ¡®move¡¯ in programming I made was to attempt to work with one of those hoarders¡­to implement some modernization and a new system¡­.while simultaneously helping him maintain old code (later the CIO told me it was to learn what he was doing as I was stubborn enough and everyone else had failed)..he was a mid level IT manager by default¡­.he was on call overnight every night ¡®rescuing' his department in a much larger corporation. He had so many kludges that he wouldn¡¯t share with me¡­..not with 3 years of working ¡®with¡¯ him¡­..he had a mental breakdown and split¡­.and even though I was in the search for a neurological dilemma myself¡­..I was able to work on his garbage in the last year, by coming in every other day at noon with a workplace accommodation (partly because they couldn¡¯t get anyone else to willing work on cleaning up his garbage)¡­..so while in the hobby world¡­..some newbies might say¡­..what is all the fuss about ¡®style¡¯ and comments¡­..if the code works, who cares?¡­..we know better¡­.

the real story is my first two weeks in this department¡­.he told me¡­..take a few days and walk through the code and get an idea of what our department does¡­.we all have done this¡­.so I started documenting what was happening¡­..it had one of the biggest sins in coding in my estimation¡­¡­thousands of lines of supposively ¡®UNUSED¡¯ code¡­..old supposed retired code, retired business rules¡­¡­but the code was left in place¡­..it wan¡¯t running¡­..or so they thought¡­.or better¡­.hoped.

and none of that was going to change¡­.

I found one subroutine that I really didn¡¯t like¡­..it looked like it would run on a pretty regular basis and prevent billing¡­..but, it would take an hour to explain why by showing the multiple ¡®retired¡¯ paths that got you there¡­..if you brought that up you were either trusted¡­..or he had to give you a blackboard and stack of green bar¡­..and an hour¡­..

I stood my ground for two weeks¡­..refusing to do anything else¡­..if I was going to be in the same area with him for any time he was going to trust me and ¡®work with me' or I was going to walk¡­..

short version¡­..he reluctantly implemented my commenting out the old code in an appropriate place¡­..that department then had the best month of collections they had ever had¡­..everyone was happy¡­.except my boss¡­.and I lived through 3 more years of that jerk¡­..it didn¡¯t help my relationship with him that it was around Christmas time and the company was drawing names from attaboy slips every month¡­..that month¡­.my name on that slip was $1000 Samsung big screen¡­.

oh¡­..style, comments, unused code¡­..change management, lions, tigers, and bears, oh my

so, not to scare anyone away from coding¡­..its just worth doing it right the first time, which doesn¡¯t mean doing exactly like anyone else, but, to just make it easy for everyone else and yourself

Craig
KM4YEC

On May 7, 2018, at 3:17 PM, Art N4EZZ <n4ezz@...> wrote:

Hi,

I normally just sit here and listen to all of you smart folks with the
hope that I can learn something from your discussions, but this trip
down memory lane is too much.

PDP-11/70s, VT-100 terminals and pre-System V Unix the old Version 7,
later all sorts of Unixes and Stratus VOS as well. Yep, I am an old Bell
head.

First screen editor, Emacs, yes I still use it. IDEs, yes although I use
them mostly for compile/debug cycles.

I was for many years a system administrator and typically wrote programs
to accomplish the various utility functions that you would expect. I
also wrote a number of programs to support some rather large conversion
projects.

The scariest words I ever heard in a staff meeting, here is some code
install it on XYZ machine "it should work just fine". Almost always that
translated to "you will spend at least a week getting it to compile and
actually run".

So coding style, don't care but be consistent, if you are consistent I
can figure it out.

Functions and variables should describe what they are used for.

Comments, yes please, if you do something that might be
counter-intuitive then please explain why as well as what.

To finish, something I learned back then about unintended consequences.
After 20 hours working with Bell Labs on a problem in a telephone switch
we found the problem, the fix took about 20 seconds. Before the Bell
Labs guys dropped off the call one of them, I think it was Dennis said,
"you know I wrote that code and I never imagined it could do that".

Thanks for keeping my old mind active and it is back to learning mode
for me.

Art N4EZZ <n4ezz@...>
GnuPG key ID 0x6712DD0E
=============================
Suppose you were an idiot. And suppose you were a member of Congress.
But I repeat myself.
Mark Twain, a Biography



Join [email protected] to automatically receive all group messages.