For programmers...

The comments are the tests, the tests were written before the code, and the code ensures the tests get satisfied.

Anyone that says plain comments or documentation reflects what the code actually does either is lying or doesn't write much code.

As you said, the test cases are the comments. It isn't that there AREN'T comments. In fact, with TDD, I often write comments in a test case and then fill them in with test code.
 
The test cases are the comments. It isn't that there AREN'T comments. In fact, with TDD, I often write comments in a test case and then fill them in with test code.
Agree..plus the actual amount of text is limited because you're just describing the test to a degree the test itself is what describes what should happen then makes sure it does actually happen.
 
If the code is 90% the same for each section then that's your problem. Time to refactor. Strong tests makes refactoring easy.

The same structurally. The field names are different and it would be way more of a mess to start doing field names with variables.
 
What do you think about the comments in the View source of this page?

I am getting Meta on your ass now :)
 
The same structurally. The field names are different and it would be way more of a mess to start doing field names with variables.

I can't comment as to how I would refactor it without looking at it. And I doubt it's worth doing.

There is a big difference in what makes sense for your small operation given you're the only one programming on it versus large projects written by a team of developers over many years that are quite massive in comparison.

Learning how to get code to mostly do what you want isn't that difficult. Learning how to develop and maintain large code bases while controlling the technical debt over extended periods of time with many people working on them is where professional developers earn their bread.
 
To the noob that is looking to get into the programming game can you give some advice on where to start?

Sent from my HTC One X using Tapatalk
 
Learning how to get code to mostly do what you want isn't that difficult. Learning how to develop and maintain large code bases while controlling the technical debt over extended periods of time with many people working on them is where professional developers earn their bread.


The Fizzbuzz failure rate makes even the first part a leap of faith...
 
Designers are not the best programmers.

LOL - very true - but in my world the early designers were the programmers

The pros were brought in for the interface stuff but numerical processing was all PhD engineer stuff. Just figuring out how to test it effectively was MS stuff. By the time I got in the game I had to write my own interface, theoretical solution, implement the numerical code for the theoretical solution, and test the results. Progress is hell.
 
I write a lot of image conversion algorithms and they are quite complex. w/o comments, it would take a lot to get back in and figure out what is doing what.

Here is a fairly basic edge detection algorithm.
http://dasl.mem.drexel.edu/alumni/bGreen/www.pages.drexel.edu/_weg22/edge.html

Not commenting this would be lazy and only cause yourself frustration later.

Wow! They're still using the same picture of that girl all these years! I remember that one from when I took an image processing class in 1990! :eek:
 
I write a lot of image conversion algorithms and they are quite complex. w/o comments, it would take a lot to get back in and figure out what is doing what.

Here is a fairly basic edge detection algorithm.
http://dasl.mem.drexel.edu/alumni/bGreen/www.pages.drexel.edu/_weg22/edge.html

Not commenting this would be lazy and only cause yourself frustration later.

When I did x86 assembler programming, I commented every line of code. I could literally leave for lunch and forget what I was up to. These days…. I don't comment anything. The last thing I remember commenting was a recursive function that could spawn 3 other recursive functions. It was walking down 4 types of "operations" and building various paths to delete.
 
commented.png
 
When I did x86 assembler programming, I commented every line of code. I could literally leave for lunch and forget what I was up to. These days…. I don't comment anything. The last thing I remember commenting was a recursive function that could spawn 3 other recursive functions. It was walking down 4 types of "operations" and building various paths to delete.

Recursion and multi-threaded stuff gives me a headache.
 
Recursion and multi-threaded stuff gives me a headache.

recursion didn't bother me (much) but blowing my head clean off in C sorta sucked...for awhile we were dimensioning in C and passing to compiled FORTRAN subroutines...awkward keeping things straight
 
Last edited:
recursion didn't bother me (much) but blowing my head clean off in C sorta sucked...for awhile we were dimensioning in C and passing to compiled FORTRAN subroutines...awkward keeping things straight

Recursion is fine as long as you document termination and prove that there are no holes in it.

How you would do that without comments is a bit, well, dicey. Get it wrong and you have an infinite loop. Have Developer 3692 look at it in 10 years and misunderstand creates very nice bugs.
 
An essay programmers here will appreciate:

http://stilldrinking.org/programming-sucks

I resemble that.

We have "Tiger Teams" now. To the uninitiated this is basically high ranking "people from the business" who are fed up with the solutions they were handed. They get to design their own software and demand that I do it or have someone do it. They have no background in programming.

Two "Demands" today were.

1. We need a report that displays 5 levels of parent child relationships on one line of the report. I sat in 9 hours worth of meetings with them to come to the conclusion that they really only wanted one column with one value in it that would have taken our intern 30 minutes to write.

2. They want the "Long Text" on the report and need it in real time. OK so our software has a "We give up" feature and lets them attach Word documents to a record so that they can explain what is they were attempting to do. We call this the "Long Text" it's stored as a compressed BLOB in the database. They want to put all these on a report, and want to run it "real time". I looked at todays report and it had approx 2,000 records on it. the average size of a long text for each record was 2 solid pages of text.Or for the entire report, roughly 4,000 pages. So I told them to let me meet the guy who was going to read the equivalent of 4,000 pages or 6-10 novels and need to read them again in an hour and I'd do it.
 

// In other words, I wholeheartedly agree, to the extent that
// someone who does not do this shall be shot, hung, drawn,
// quartered, tarred, and feathered, not necessarily in that order!
 
Or Fortran. Yes, people still use it. The only reason I can think of why is that they haven't been bitten by accidental variables set to zero by mistyping a variable name.

REAL INTEGER
INTEGER REAL

And my favorite

INTEGER I
DO 100 I = 1.100

which compiles & runs correctly.
 
I haven't chosen to develop new code in it in some time -- 2000, to be precise -- but it is still in use in this room, today. And there is a lot of legacy code around from 1975. Like the Kuiper flight planner.

Yes, I know about IMPLICIT NONE. And about the OO no one uses. And when you're modifying legacy code, you don't usually have the option of changing its implicitness.

I'm also aware it has become quite a lot more C++ like. What the point of making a second C++ is, is beyond me. It gets defeated very quickly when you have to use legacy constructs.

I've never quite understood the reason for OO Fortran.
 
I've never quite understood the reason for OO Fortran.


ROFL. God I had no idea it even existed.

I'm pretty sure there's probably someone who could find a reason to use it, to open the gates of Hades.

Oh wait. That's Python. :)
 
I wrote machine language a long, long time ago. Before CPM, before Bill Gates, before C compilers and before a whole lot of stuff.
I did not document it.
I did not explain it - because you aren't capable of understanding anyway :D

Those were the days of card stacks, and paper tape, and booting up a CPU by using 15 switches on the front panel to key in a boot routine in binary (took a good 15+ minutes to do - so we did NOT shut the box down at the end of the shift) I had one programmer who did all math, including his check book, in BCD. It was a geek world in those days.

Now, it was not better than today. High level languages and compilers are vastly more productive. It was a simpler - and maybe more fun - time.
 
I resemble that.

We have "Tiger Teams" now. To the uninitiated this is basically high ranking "people from the business" who are fed up with the solutions they were handed. They get to design their own software and demand that I do it or have someone do it. They have no background in programming.

Two "Demands" today were.

1. We need a report that displays 5 levels of parent child relationships on one line of the report. I sat in 9 hours worth of meetings with them to come to the conclusion that they really only wanted one column with one value in it that would have taken our intern 30 minutes to write.

2. They want the "Long Text" on the report and need it in real time. OK so our software has a "We give up" feature and lets them attach Word documents to a record so that they can explain what is they were attempting to do. We call this the "Long Text" it's stored as a compressed BLOB in the database. They want to put all these on a report, and want to run it "real time". I looked at todays report and it had approx 2,000 records on it. the average size of a long text for each record was 2 solid pages of text.Or for the entire report, roughly 4,000 pages. So I told them to let me meet the guy who was going to read the equivalent of 4,000 pages or 6-10 novels and need to read them again in an hour and I'd do it.


I'll try to find that video of about the 7 perpendicular lines, some with transparent ink.... and the cat.

http://www.amara.org/en/videos/wKpYdZPoiNaH/en-gb/693505/
 
I love that video. I think I got a call from that video's project manager earlier. :)

He was really impressed with my "good idea" to have an open line conference call when the power work is being done at the datacenter. You know, have a phone call going where the guy on site says exciting things like "I'm pulling the power on Server A now."

He was going to go call everyone and see what they thought.

Apparently, I'm brilliant. ROFL.

Please keep in mind this person has multiple advanced generic and IT specific project management certifications. They're plastered to his email signature line.

His next question: "Could you document how we do that?"

Sure bud. Open outlook. Send meeting request to everyone involved at 2AM in a couple if weeks. Say "Hi all, here's a conference bridge to coordinate the power work on X date." Cut and paste conference bridge number into message. Hit send.
 
Sure bud. Open outlook. Send meeting request to everyone involved at 2AM in a couple if weeks. Say "Hi all, here's a conference bridge to coordinate the power work on X date." Cut and paste conference bridge number into message. Hit send.

Brilliant!
 
Sure bud. Open outlook. Send meeting request to everyone involved at 2AM in a couple if weeks. Say "Hi all, here's a conference bridge to coordinate the power work on X date." Cut and paste conference bridge number into message. Hit send.

Do you have a contingency plan in case that doesn't work? Have you developed a risk plan to determine the probability and impact of such a failure? A RACI chart for each element in the task?

(Oh...I have a PMP by the way) :D
 
ROFL. God I had no idea it even existed.

I'm pretty sure there's probably someone who could find a reason to use it, to open the gates of Hades.

Oh wait. That's Python. :)

Originally hinted at in F90, became standard in F2003. Officially became a topic of derision and laughter in 2003.1
 
Do you have a contingency plan in case that doesn't work? Have you developed a risk plan to determine the probability and impact of such a failure? A RACI chart for each element in the task?



(Oh...I have a PMP by the way) :D


ROFL. Have I told you about the guy who had a request in to remove an already powered off server from a rack, denied for a lack of a test plan, and a rollback plan? :)

He resubmitted it after chewing out the change manager who denied it, with "I will count all the screws and place them in my pocket before pulling the server out, and will make sure it is truly detached from the rack by moving it laterally across the floor. It will not be placed back in the rack over my dead body so I will not be submitting a rollback plan."

Funniest damn ticket of the year.
 
Originally hinted at in F90, became standard in F2003. Officially became a topic of derision and laughter in 2003.1

Some of us were commenting on the flora available at IEEE meetings in 1990.1.

One would think the history of Borland Pascal would have clued that committee in. Yes, there was an OO Pascal.
 
Oh lord. The final draft of the project plan just came out and it says, and I quote:

"2. Nate will coordinate with Operations and get a couple of testes."

Hmmm. I didn't even know they had any to give!!!
 
Ha. I never found Dilbert all that funny, since it's just a documentary of my life. I'm definitely less Dilbert and more Wally these says, though. With a touch of Dogbert. Or maybe a lot of Dogbert depending on the day.
 
Oh lord. The final draft of the project plan just came out and it says, and I quote:

"2. Nate will coordinate with Operations and get a couple of testes."

Hmmm. I didn't even know they had any to give!!!

Maybe they're trying to tell you something.
 
Ha. I never found Dilbert all that funny, since it's just a documentary of my life. I'm definitely less Dilbert and more Wally these says, though. With a touch of Dogbert. Or maybe a lot of Dogbert depending on the day.

Dogbert, heck. BOFH.
 
I was recently contacted by a former customer who wanted me to write them an updated version of some code I had written back in 1987. There were only 2 comments in the entire application: My name, and the day I completed it.
After looking at the code for about 3 days, all I could say was "What the heck is this supposed to do" and "What the heck was I thinking!"

The best piece of code I have ever seen, anywhere, was written by a guy at IBM Research who wrote all the security and encryption code for the VM and MVS mainframes. Every single variable was random iterations of 1,0,l,O.
And not one single comment in the entire program. Twenty-five years after he wrote it he could still look at an error and tell you exactly what line failed and why.
Genius. Evil genius, but still genius.
 
I was recently contacted by a former customer who wanted me to write them an updated version of some code I had written back in 1987. There were only 2 comments in the entire application: My name, and the day I completed it.
After looking at the code for about 3 days, all I could say was "What the heck is this supposed to do" and "What the heck was I thinking!"

The best piece of code I have ever seen, anywhere, was written by a guy at IBM Research who wrote all the security and encryption code for the VM and MVS mainframes. Every single variable was random iterations of 1,0,l,O.
And not one single comment in the entire program. Twenty-five years after he wrote it he could still look at an error and tell you exactly what line failed and why.
Genius. Evil genius, but still genius.

A professor of mine floated a story about a guy at TI who could debug octal dumps over the phone.
 
Back
Top