I'll admit that I have an opinion about this.

Is the point of professional coding to write creative software or to write software that adheres closely to standards?

Recommended Answers

All 10 Replies

What standards are you asking about?

What happens when your standard doesn't fit your use case? (spoiler)
image_2024-01-27_115711909.png
https://xkcd.com/927/

As I wrote more and more code I did gravitate toward standards. But with each job, there was yet another standard to use.
Most of the time it was just a formatting change. Read https://en.wikipedia.org/wiki/Indentation_style to see 9 standards alone.

Then there was the call to use patterns but the embedded system was a mix of assembler and C. Not even C++.
To make that more fun, the program lead wanted to replace the hardware system with "something modern" so we could move to C++. A few weeks later they were reassigned.

So back to you, how do you deal with choosing such standards?

commented: thank you, I responded below. +1

Are you differentiating between design and programming? Some professionals get stuck in their heads. For example, too many surgeons feel that surgery is the first option. My job as a professional programmer was not primarily to write code. My job was to provide solutions to problems. Ideally that meant writing as little code as possible. If coding is required then it should be as clean and as clear as possible. Above all it must be maintainable, and not just by you.

As an example, here is some code we got from a vendor. It is rock-solid. It does what it is supposed to but it is virtually unmaintainable. I can't begin to imagine how it was ever debugged.

      SUBROUTINE READALL(UNIT,BUFF,*,*,IFIRST)
C*TTL READALL READ FROM ANYTHING

C     THIS SUBROUTINE IS USED FOR READING COMPRESSED OR UNCOMPRESSED
C     DATA INPUT FILES FROM LFC 'UNIT' INTO 80 BYTE ARRAYY BUFF.
C     END RETURNS TO FIRST RETURN, ERROR RTETURNS TO SECOND
C     IFIRST IS LOGICAL WHICH CALLER PROVIDES TRUE ON
C     FIRST READ OFF OF THIS ALLOCATION OF THIS LFC, ELSE FALSE
C*PGMXX READALL  SAVD TOOLS    FS$READA ON 07/23/80 17:43:51 01819B00R01
      LOGICAL IFIRST
      INTEGER*1 BUFF(80)
      INTEGER*4 UNIT
      INTEGER*1 BYTE(120,2)

      INTEGER*1 IN(2)/2*0/,ISP(2)/2*0/,ITX(2)/2*0/,NB(2)/2*0/
      INTEGER*1 NBT(2)/2*1/
      INTEGER*1 KCR/ZBF/,KLR/Z9F/
      INTEGER*1 EOR/ZFF/
      INTEGER*2 NSEQ(2)/2*0/,ITY(6),ISEQ(60,2),ICKS(60,2)
      INTEGER*4 LFC(2)/2*0/
      INTEGER*4 K,N,IERR,IN0,ISP0,ITX0,NB0,IS,I,ISUM,J

      EQUIVALENCE (BYTE(3,1),ICKS(1,1)),(BYTE(5,1),ISEQ(1,1))

      IF(.NOT.IFIRST) GO TO 21
      DO 19 K=1,2
      IN(K) = 0
      ISP(K) = 0
      ITX(K) = 0
      NB(K) = 0
      NBT(K) = 1
      NSEQ(K) = 0
      LFC(K) = 0
19    CONTINUE
21    CONTINUE
      DO 101 N=1,2
      IF (UNIT.EQ.LFC(N)) GO TO 103
      IF (LFC(N).EQ.0) GO TO 102
101   CONTINUE
      GO TO 94
102   LFC(N) = UNIT
      CALL W:PDEV(UNIT,ITY)
      NBT(N) = 1
      IF (ITY(3).GE.4.AND.ITY(3).LE.6) NBT(N)=2
103   IERR = 0
      IN0 = IN(N)
      ISP0 = ISP(N)
      ITX0 = ITX(N)
      NB0 = NB(N)
1     IF (IN0.NE.0) GO TO 8
2     CALL BUFFERIN(UNIT,0,BYTE(1,N),30)
      CALL M:WAIT(UNIT)
      CALL STATUS(UNIT,IS,NB0)
      IF (IS-3) 3,80,90
3     IF (BYTE(1,N).EQ.KCR.OR.BYTE(1,N).EQ.KLR) GO TO 6
      NB0 = NB0*NBT(N)
      DO 4 I=1,NB0
      IF (BYTE(I,N).EQ.10.OR.BYTE(I,N).EQ.13) BYTE(I,N) = 1R
4     BUFF(I) = BYTE(I,N)
      IF (NB0.GE.80) GO TO 20
      I = I+1
      DO 5 I=I,80
5     BUFF(I) = 1R
      GO TO 20
6     NB0 = BYTE(2,N)
      IF (NB0.GT.114) GO TO 91
      ISUM = 0
      DO 7 I=1,NB0
7     ISUM = ISUM+BYTE(I+6,N)
      IF (ISUM.NE.ICKS(1,N)) GO TO 92
      IF (ISEQ(1,N).NE.NSEQ(N)) GO TO 93
      NSEQ(N) = NSEQ(N)+1
      IN0 = 7
8     DO 16 I=1,80
      IF (ISP0.NE.0) GO TO 9
      IF (ITX0.NE.0) GO TO 12
      IF (BYTE(IN0,N).EQ.EOR) GO TO 9
      ISP0 = BYTE(IN0,N)
      IF (ISP0.GT.81-I) GO TO 91
      IN0 = IN0+1
      GO TO 10
9     ISP0 = ISP0-1
10    IF (ISP0.EQ.0) GO TO 11
      BUFF(I) = 1R
      GO TO 16
11    IF (BYTE(IN0,N).EQ.EOR) GO TO 9
      ITX0 = BYTE(IN0,N)
      IF (ITX0.GT.81-I) GO TO 91
      IN0 = IN0+1
12    BUFF(I) = BYTE(IN0,N)
      IF (BUFF(I).EQ.10.OR.BUFF(I).EQ.13) BUFF(I) = 1R
      ITX0 = ITX0-1
13    IN0 = IN0+1
      IF (IN0.LE.NB0+6) GO TO 16
      CALL BUFFERIN(UNIT,0,BYTE(1,N),30)
      CALL M:WAIT(UNIT)
      CALL STATUS(UNIT,IS,NB0)
      IF (IS-3) 14,80,90
14    IF (BYTE(1,N).NE.KCR.AND.BYTE(1,N).NE.KLR) GO TO 91
      NB0 = BYTE(2,N)
      IF (NB0.GT.114) GO TO 91
      ISUM = 0
      DO 15 J=1,NB0
15    ISUM = ISUM+BYTE(J+6,N)
      IF (ISUM.NE.ICKS(1,N)) GO TO 92
      IF (ISEQ(1,N).NE.NSEQ(N)) GO TO 93
      NSEQ(N) = NSEQ(N)+1
      IN0 = 7
16    CONTINUE
      IF (BYTE(IN0,N).NE.EOR) GO TO 91
      ISP0 = 0
      IF (ITX0.NE.0) GO TO 91
      IN0 = IN0+1
      IF (IN0.GT.NB0+6) IN0 = 0
      IF (BYTE(1,N).EQ.KLR.AND.IN0.EQ.0) NSEQ(N) = 0
20    IN(N) = IN0
      ISP(N) = ISP0
      ITX(N) = ITX0
      NB(N) = NB0
      RETURN
80    NSEQ(N) = 0
      IN(N) = ISP(N) = ITX(N) = 0
      RETURN 1
90    IERR = 1
91    IERR = IERR+1
92    IERR = IERR+1
93    IERR = IERR+1
94    IERR = IERR+1
      IN(N) = ISP(N) = ITX(N) = 0
      BUFF(1) = IERR
      RETURN 2
      END

For RJ,
That looks like Fortran.
Also:
image_2024-01-27_164115263.png

I loved that one when it first came out. And, yes, that is indeed FORTRAN. The system also came with a preprocessor called SFORX which added structured statements ($IF-$ELSE, $WHILE, etc.) but for some reason it was not used in this case. Just for fun I eventually rewrote the above with no GOTOs to prove to a co-worker that it could be done.

@rproffitt

Thank you for your excellent and humorous response.

So back to you, how do you deal with choosing such standards?

Generally I don't choose standards. I tend to apply what would be called the 'Dutch philosophy', meaning that I am in my personal efforts more an integrator of different ideas rather than one who imposes ideas upon others. Ginger Rogers syndrome.

Yet I shall produce tomorrow a more thorough and perhaps more satisfactory answer to your question, as you have to mine.

So back to you, how do you deal with choosing such standards?

I code under the assumption that the person who will be maintaining my code is a psychopath who knows where I live.

commented: I answered you below! +1

I have coded and maintained DaniWeb by myself for twenty years. I have always tried to write code that adheres closely to standards. I try to make my code easy to read, and document it well enough that, should I need to change something, I can easily figure out why I did something the way I did 3 or 5 years ago, should I no longer remember.

@Reverend Jim

Thank you for the Fortran sample. It was splendid! You were right to highlight the differences between design and coding. In fact I made a seperate post about this!

@Dani

But isn't that why Daniweb has thrived, whilst other websites have disappeared during that time? You've designed the web site in a flexible way so that you can modify it in response to the needs of the people that use it. That's why I use Daniweb anyway. It's still growing.

I think that you and others have answered my original question. People here feel that software standards should reflect the fact that for most projects, a coder should anticipate that someday other people may quite well be working on your system. Standards should be chosen with that in mind.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.