Author Topic: Comments  (Read 10860 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Comments
« on: March 08, 2006, 07:12:31 PM »
AutoLISP Developer's Guide

Using the Visual LISP Environment
-->Developing Programs with Visual LISP
----->Formatting Code with Visual LISP
-------->Applying Formatting Options
----------->Applying Visual LISP Comment Styles

Any Comments ?

I'm wondering how many people vent about “Single-Semicolon" being used at 'Heading' or 'Current-Column' locations.
... I know, with some posted code,  I get tired of adding extra semicolons so code will format.

Why format ?.. It helps me to understand code flow.

also, How many people find the  ) ';_ Function-Closing' comment visually intrusive ?



kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Comments
« Reply #1 on: March 08, 2006, 07:22:49 PM »
I never use the vlisp editor, so I'm not familiar with the heading, current column location thingy you refer to.

As for closing parenthesis comments, I absolutely loathe them. To me it just makes it a visual mess that is more difficult to visually parse and every time I see them I can't help but have a kind of animosity, unfair as that is, towards the code sporting it.

/my 2’
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Comments
« Reply #2 on: March 08, 2006, 07:29:34 PM »
Code: [Select]
;;; heading or 0-column comment
;;; heading or 0-column comment
;;
(defun foo (x) ;|inline comment |;
   (list 1 2 3)                       ;comment-column comment
   ;;current-column comment
;;; heading or 0-column comment
   ) ;_ function-closing comment
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Comments
« Reply #3 on: March 08, 2006, 07:39:13 PM »
Thank you for explaining Kerry.

Ughhh.

I hate having an editor impose its style upon me, but conversely, I'm generally pretty anal how I format my code (though I fully acknowledge it has drifted somewhat over the years). Textpad has been a very accommodating editor, supporting, but not forcing "my style", whatever that is. Just the right amount of horsepower, customizability and lithe footprint to keep me happy. I've used Textpad ever since I abandoned Multi-Edit, which I had used for MANY, many years prior (from the good ol' DOS days). But I digress.

Anyway, assuming anyone ever loaded up any of my code in the vlisp editor, I apologize if it looks like crap therein.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Comments
« Reply #4 on: March 08, 2006, 07:43:58 PM »
Quote
I hate having an editor impose its style upon me ..
Generally, the VLIDE, with my configuration, opens code up enough to breathe.

[personally]
Your formatting is a dream to work with.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Comments
« Reply #5 on: March 08, 2006, 07:48:44 PM »
... and for the naysayers out there < you know who you are >
... I'm NOT setting myself up as the code police  :police:

whatever works for me, may not work for you ! :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

nivuahc

  • Guest
Re: Comments
« Reply #6 on: March 08, 2006, 08:04:48 PM »
For me, the );_random closing comment thinger is very useful. I have a hard enough time keeping track of what I'm doing when I'm not writing code so it helps me see, at a glance, where something stops (or should).

Most of the time, I write something and then never look at it again for months. When I do look at it, I don't parse it like English so it's nice for me to have a guideline of sorts.

And that's all due to poor programming on my part, I'm sure, but it works for me.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Comments
« Reply #7 on: March 08, 2006, 08:28:29 PM »
Generally, the VLIDE, with my configuration, opens code up enough to breathe.

Good to hear it empowers you -- you can certainly write effective and intelligent quality code using it, tho admittedly that's a little like saying you're a good driver because you have a red car. :)

[personally]
Your formatting is a dream to work with.

Wow, I didn't see that one coming. Thank you sir!
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Comments
« Reply #8 on: March 08, 2006, 08:36:58 PM »
[personally]{in response to MP's comment-jm}
Your formatting is a dream to work with.
While I wholeheartedly agree with this, I have never been able to force myself to code in anywhere close to MP's style. Too many spaces/tabs I reckon.

I like using the VLIDE, but it really irks me in that the autoformat will setup the code how I like it, then I'll go back and add/change/remove portions of the code and go to reformat it and the reformat looks NOTHING like the autoformat......
so I tend to steer clear of the format option.....which probably gets me included in the improper use of comments because I honestly don't pay that much attention to how many semicolons get placed  :| Then again, some would probably say that they have yet to find ANY worthwhile comments in my "code".

nivuahc

  • Guest
Re: Comments
« Reply #9 on: March 08, 2006, 08:41:33 PM »
I once got so annoyed at the lack of comments in a batch of code I had held on to for years... that I spent several days doing nothing but writing comments. By the time I was finished, the code took up over twice the space on disk, all because of comments. :)

I laughed about it then erased it, routines and all.  :evil:

I was in one of those moods  :lol:

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Comments
« Reply #10 on: March 08, 2006, 09:08:01 PM »
When I first started coding lisp I was using an indent of 2 spaces. Coded that way for many years.

As my coding became more and more complex I found it increasingly difficult to discern the closing parenthesis.

So, like many folks I started adding the ...

(if predicate
    then
    else
) ;; end if


... closing parenthesis style comments (I have tons of legacy code that sports them that I loathe visiting, well over 30K lines).

But I became annoyed with it (as noted) and opted to go with an indent of 3 spaces.

While the clarity improved dramatically I found it annoying to switch back and forth from Power BASIC and Visual BASIC indents of 4 spaces to 3 spaces in LISP, so I said screw it, and just adopted 4 space indents globally.

Initially I found the 4 space indents almost prohibitive for LISPin', but then I adopted a more vertical style. That seemed to work well for me and I generally use that style to this day (in VB too). While it takes up a lot more ascii real estate there is no performance hit, and I can visually parse it faster than any other style I've observed. On hard copies it leaves ample room for pencilled comments too.

Mileages vary of course, this is just what worked out best for me.

< Thinking to self: Wow, why the heck am I so chatty tonight? >
« Last Edit: March 08, 2006, 09:18:36 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Comments
« Reply #11 on: March 08, 2006, 09:26:00 PM »
< ....> and I can visually parse it faster than any other style I've observed. On hard copies it leaves ample room for pencilled comments too.

Mileages vary of course, this is just what worked out best for me.


^^ Ditto me , though I prefer mine a little less sparse :-)

I mentioned earlier code breathing. I actually meant giving the reader a chance to breathe , visually and mentally, when scanning it.

... sounds a little poetic perhaps, but works for me.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Comments
« Reply #12 on: March 08, 2006, 09:35:40 PM »
< Thinking to self: Wow, why the heck am I so chatty tonight? >

m e d i c a t i o n ?   :-)


As a novice programmer I'm still trying to find a style. I like Michaels style very much, easy for me to read (  not to be confused with understanding it *grin* ) and I've tried to use said style but it never looks as good. The ')_defun' things bugs me as well, makes the code just to hard to follow. I like Kerrys format to, his code is just as easy for me to follow.
TheSwamp.org  (serving the CAD community since 2003)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Comments
« Reply #13 on: March 08, 2006, 10:39:59 PM »
I hardly ever have comments except at the beginning so that I know what the code is supposed to do.  Sometimes I write code that I don't use, and then I go looking through to see what I have, so that is why I do that.

I used to code with two spaces, then I got tired of having to hit all the space, so now I use just one, and it seems to work for me.  If I wanted to use more spaces, I think I would go to one tab just so I can just hit one button.

But that is just me.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Comments
« Reply #14 on: March 08, 2006, 11:11:53 PM »
Quote
hardly ever have comments except at the beginning so that I know what the code is supposed to do.

ditto, just as nudge notes ..


Quote
I used to code with two spaces, ..

.. generally 4 spaces indent and Tab=4 Spaces
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.