Author Topic: AutoLISP versus .Net - Pros and Cons  (Read 11798 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 650
AutoLISP versus .Net - Pros and Cons
« on: August 04, 2013, 04:33:58 PM »
I know, the subject is discussed for a long time, and there are two basic questions:

a) for newbies:
"With which programming-language should I start to code in AutoCAD?"

b) for bosses and admins:
"Should I convert my existing lisp-tools to .net?"

I'm looking for opinions and informations and links and white-papers(?) regarding "question b)".

The initial position is:
  • Dozens of existing Lisp tools; working and stable. 10 - 2000 lines/routine, used in pure AutoCAD mainly as "small tool" for daily business and not as one "big application".
  • Existing ideas to rewrite them in .net because ".net is widely used and it's easy to find programmers and support, Lisp is old and will die"
If you have experience in this topic or have some infos or some opinion - please let me know, and I can start to form my opinion.

Thanks
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: AutoLISP versus .Net - Pros and Cons
« Reply #1 on: August 04, 2013, 04:47:29 PM »
(a) depends upon the tasks and problems being automated and solved
(b) depends upon the benefits realized, (1) real and (2) imagined.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Peter2

  • Swamp Rat
  • Posts: 650
Re: AutoLISP versus .Net - Pros and Cons
« Reply #2 on: August 04, 2013, 05:00:06 PM »
...depends upon ...
Hi MP
I'm aware that an exact answer based on my information is not possible, and the perfect answer is "depends upon ...".

But nevertheless I'm hoping for some field reports, opinions, recommendations like
  • "It was the best decision we ever made because ..."
  • "it was the greatest disaster because ..."
  • "we needed twice / half of the time we expected because ..."
  • "you should consider that ..."
  • "the big illusion is that ..."
« Last Edit: August 04, 2013, 05:32:55 PM by Peter2 »
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: AutoLISP versus .Net - Pros and Cons
« Reply #3 on: August 04, 2013, 05:26:58 PM »
Lisp is old but will not die in my lifetime.
And most likely not in your life at your current job.
Lisp is easy to write & easy to maintain.
I don't think you can say that for net.
That's my opinion.  8)

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoLISP versus .Net - Pros and Cons
« Reply #4 on: August 04, 2013, 05:48:03 PM »
Can't argue against that Alan.

The usage of lisp will change as Web based applications become more prevalent.
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.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: AutoLISP versus .Net - Pros and Cons
« Reply #5 on: August 04, 2013, 06:41:24 PM »
Specific to AutoCAD:
I'm with the others on this. The answer to this question is close to asking for a string's length, i.e. the answer will differ because of situation. From experience, the "best" addons come from a combination of Macro, Script, Lisp, DotNet and even sometimes ARX. Each has their pluses and minuses, and usually you can use the one's strengths to offset the weaknesses of the other(s).

What I'd say is Lisp is a definite in every instance, if only to make your setup as easy as possible. Nearly all ARX's I've seen use some Lisp at least to integrate them properly into acad, even most DotNet use Lisp in this sense, if not Lisp then at least some macros with registry hacks. Some things are simply too difficult and/or time consuming to do otherwise. On the other hand some things are near impossible to do purely in Lisp (well that is AutoLisp).

As a general rule, when your addon is doing something simple like running some commands varying only on some user input or values of standard objects - then Lisp is 10 times easier and faster to use as your language (as compared to DotNet, exponentially more for ARX). If you're working on special objects / features added to acad after around 2000, then Lisp (even with ActiveX) tends to become cumbersome (sometimes even impossible) as the library functions haven't been updated to suit these new objects / features, in some rare cases even DotNet is not enough. Most "involved" addons would fall somewhere in between those 2 extremes, but I'd say 90% of them don't need anything more than Lisp, and 60% would be better suited to be written in Lisp.

Concerning the move to cloud based: if such is the case, then DotNet & even ARX might see a huge decline also. Probably in favour of JavaScript, but perhaps ASP.NET might be used.

In general:
Note: in this section Lisp refers to the wider group of languages falling under the Lisp family (Common Lisp, Scheme, Clojure, newLisp, QuickLisp, Haskel, Nyquist, etc.) See the wiki on that: http://en.wikipedia.org/wiki/Lisp_programming_language

As for "Lisp dying" ... that's an old misconception. It's been said since (at least) the '80s, in relation to many a now "dead" language. And has been proven wrong every time. There's even been a revival of Lisp in recent years, at least as a training language in universities for programming students, though they tend to use full-blooded Lisps instead of the hamstrung AutoLisp dialect (usually using Scheme or some such) - note many a concept has been stripped out of AutoLisp (e.g. Object Orientation, Macros, BackQuote, etc.). The reason I think this happens is because Lisp is an extremely simplistic language while also being an extremely powerful one, few other languages can say the same. Nearly all programming concepts and paradigms are possible (if not originated) in Lisp.

Also, if you're stating that C# is going to take over because it's "newer" ...  :roll: ... that's just wrong. First C# is based on C/C++, which in turn was based on Fortran - which is in fact older than Lisp (by a year). Nearly every Lisp dialect these days can say the same thing about their heritage, i.e. created somewhere in the 60s to 2000's, but based on something which was first envisioned in the 50s. Second, simply because something is "new" doesn't mean it's going to be with us for a longer time than something older - e.g. VBA is already in its death throws, even though it was much younger than AutoLisp. The true longevity of a language is a factor of 2 concepts: (1) who and how many programmers use it; and (2) who controls it. I think both Lisp and C/C++ would outlast C# by decades (if not longer) because they have something over C#: they're not owned & controlled by any one single organization (and that being the same org which decided to slowly put VBA out of their misery).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

hermanm

  • Guest
Re: AutoLISP versus .Net - Pros and Cons
« Reply #6 on: August 05, 2013, 11:27:59 PM »
a) the language with which you feel most comfortable, if you have that luxury and are not directed otherwise by T.P.T.B.

b) only if there is a measurable and verifiable benefit.
Rewriting stable, usable code in a currently fashionable language is, IMO, a ridiculous waste of resources.
LISP in its various dialects is the second oldest computer language still in use.
That should tell you something.

Further personal opinion:
The best customizers of AutoCAD (or any complex, customizable software package) are those competent users who feel the need for, and the passion to, improve the performance of the software by exploiting the provided API(s), *not* "professional programmers" with little knowledge of, and less interest in, the host software and its uses. Thus, availability of  trained "outside programmers" is irrelevant, IMO.

A successful API, IMO, should be a) easy to learn, b) cheap to use, c) easy to maintain existing code, and d) powerful enough to get the job done.
AutoLISP is all of those, for many purposes and applications.

Consider these points:

1. There is nothing to buy.
AutoLISP is always available at the command line.

2. In many instances, "versioning" is a non-issue.
This is particularly true if calls to COMMAND are avoided, something which avid programmers soon learn.

3. AutoLISP is currently the easiest way to access the extensive COM interface to AutoCAD.

4. LISP, and that includes AutoLISP, is renowned as a "rapid prototyping" environment.

That said,
Yes, AutoLISP does have its limitations, as does any other tool, hardware or software.
For example, if you require custom objects, you will need to use ARX.

One major drawback to OOTB AutoLISP is the lack of a modern GUI, but for that we have the absolutely free OpenDCL interface, thanks to some very dedicated folks, some of whom post here.

My experience is that AutoLISP is perfectly adequate for a very large percentage of the applications which the average user/customizer is likely to envision and wish to implement.

So, who am I to be talking?

I have used AutoCAD professionally since 1993, and took my first baby steps in AutoLISP in 1994 or 5.

I currently use AutoCAD 2012 with a discipline-specific 3rd party ARX application to detail structural steel and miscellaneous metals. In conjunction with the above, I use numerous self-written AutoLISP programs, and a few licensed, written by others, to improve my productivity.

As I am self-employed, time is assuredly "of the essence" in my business.

I have dabbled in .NET languages, with particular interest in F# (no surprise to AutoLISPers) but have found that, for most of my needs AutoLISP fits the bill perfectly.
« Last Edit: August 05, 2013, 11:35:48 PM by hermanm »

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: AutoLISP versus .Net - Pros and Cons
« Reply #7 on: August 06, 2013, 02:53:46 AM »
Further personal opinion:
The best customizers of AutoCAD (or any complex, customizable software package) are those competent users who feel the need for, and the passion to, improve the performance of the software by exploiting the provided API(s), *not* "professional programmers" with little knowledge of, and less interest in, the host software and its uses. Thus, availability of  trained "outside programmers" is irrelevant, IMO.
I'm definitely with you on that score! I've seen too many screw-ups because the "programmer" is not familiar with the users' needs or even the base program. Even if they're expert in the language, knowledge of the subject is orders of magnitude more important!

I could even add to that: If your "professional" programmer tells you that they can't use Lisp (or won't) ... danger signals should flash around their heads like in a Loony Tunes cartoon. What such a statement tells me is that they are parrot programmers, i.e. they've learned to type certain algorithms in one specific language like parrots. I.e. they can't "think about the code" and come up with solutions to the problem. And also, any decent programmer (especially if they consider themselves "professional") should be willing (if not excited) to learn any "new" or "old" language simply for the hell of it. And if they can't at least start doing something worth while within a month (preferably a week - if there's decent documentation) of starting to learn a new language, they should get out of programming and search for a profession better suited to their brain's configuration.

A successful API, IMO, should be a) easy to learn, b) cheap to use, c) easy to maintain existing code, and d) powerful enough to get the job done.
AutoLISP is all of those, for many purposes and applications.
Good points, though not entirely unique to AutoLisp. E.g. you can make decent DotNet addons using the free Visual Studio Express, or even the Open Source ShapDevelop IDE's. If you want to make ARX though, then you need the Professional edition of Visual Studio (not cheap).

IMO C# is not a "difficult" language. It's just extremely "verbose", so (unlike Lisp) you tend to type pages of code for something which might have been only a few line in Lisp. F# is a lot closer to Lisp in this way, functional programming tends to do that for you. You might also want to try the Python / Ruby languages a try. For me Python actually gives me the same "feel" as AutoLisp, but you get all the benefits of the DotNet libraries - which is unavailable in AutoLisp.

Also, most DotNet DLL's can be written in any number of languages - even in some Lisp dialects:
Though remember that VS Express cannot use addon languages, only the pro editions can. And there are some already implemented languages for SharpDevelop.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoLISP versus .Net - Pros and Cons
« Reply #8 on: August 06, 2013, 03:33:17 AM »

Doing a little crystal ball gazing :

Lisp will not currently work with Web and mobile platforms ; and to my understanding nor will the current implementation of dot.net AutoCAD API .

The Javascript API support built into AC2014 seems to indicate that the intention MAY be to use Javascript as a cross-platform development  language once the JS API has been fully incorporated into 360 Web and mobile builds as well as AutoCAD desktop..

Interesting times ahead!!

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.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: AutoLISP versus .Net - Pros and Cons
« Reply #9 on: August 06, 2013, 04:32:02 AM »
Yep, JS seems to be the idea. I'm just not seeing 360 catching on in my neck of the woods. Our internet is simply still too slow AND expensive to run a graphics app across it.

[Off Topic]
Just to put it into perspective: Take speed throttling as a measure, over here there's nearly no such thing (as it's not necessary, the speed is already so low and since cost is so high congestion is not a factor). I'm in South Africa (i.e. the 10 or so blips at the southern end of the Africa continent). http://glasviz.appspot.com/globe_test/

Then also compare using google searches: http://workshop.chromeexperiments.com/globe-search/

And it's not as if population density is the factor, we should at least be in the same ball-park as most of South America: http://workshop.chromeexperiments.com/globe/
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Peter2

  • Swamp Rat
  • Posts: 650
Re: AutoLISP versus .Net - Pros and Cons
« Reply #10 on: August 09, 2013, 11:20:16 AM »
Okay, after some days I think that I can make a conclusion:

- There is  no reason to get in panic because "(Auto)Lisp will die / Lisp is dead"
- It was and it is a stable and high efficient tool for AutoCAD.
- Most things can be done in Lisp.
- Future changes (Web based stuff etc.) will force also all other languages to modification.
- There is no  reason to modify existing code because the T.P.T.B. found a "cheap dot-net coder".
(- personal: the way I used to go within the last years is not the worst one ..)

Thanks for your detailed and competent postings.

Have a nice weekend.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

BlackBox

  • King Gator
  • Posts: 3770
Re: AutoLISP versus .Net - Pros and Cons
« Reply #11 on: August 09, 2013, 11:56:37 AM »

Doing a little crystal ball gazing :

Lisp will not currently work with Web and mobile platforms ; and to my understanding nor will the current implementation of dot.net AutoCAD API .

The Javascript API support built into AC2014 seems to indicate that the intention MAY be to use Javascript as a cross-platform development  language once the JS API has been fully incorporated into 360 Web and mobile builds as well as AutoCAD desktop..

Interesting times ahead!!

As I understand it (and I could be mistaken?)... Javascript API (aka SunSpider) is also supported by Mac (not sure if by AutoCAD for Mac [yet]?), so it precludes application code from being platform dependent (i.e., Windows only) as well.



For those who may be interested:

Microsoft Virtual Academy - JavaScript Courses

Not sure if edX offers any JavaScript courses?
"How we think determines what we do, and what we do determines what we get."

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: AutoLISP versus .Net - Pros and Cons
« Reply #12 on: August 12, 2013, 01:11:26 AM »
As I understand it (and I could be mistaken?)... Javascript API (aka SunSpider) is also supported by Mac (not sure if by AutoCAD for Mac [yet]?), so it precludes application code from being platform dependent (i.e., Windows only) as well.



For those who may be interested:

Microsoft Virtual Academy - JavaScript Courses

Not sure if edX offers any JavaScript courses?
The principle behind JS is that it's an interpreted language with a JIT (Just In Time) compiler built into it's environment - which 99% of the time is the Internet Browser you're using (e.g. FireFox / Chrome / IE / Safari / Opera / etc.). Those browsers are the System/machine dependent part, while the JS code is mostly independent of anything - though sometimes you do find "browser" dependencies (especially with IE), which makes JS a bit less write-once-run-anywhere.

Edit: BTW, the place where I've found the most resources about JS is W3Schools.

But once you go down the JS route, you notice something peculiar: Unlike most other languages where you have only a small amount of built-in library packages, JS is only the base language. What you really need to learn is the libraries and or frameworks you're going to use, and there are a pandora's box of them: http://javascriptlibraries.com/ Not to mention every other guy's written one (or at least part of one) themselves. So I guess ADesk will have one for their cloud systems too.
« Last Edit: August 12, 2013, 01:20:18 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

BlackBox

  • King Gator
  • Posts: 3770
Re: AutoLISP versus .Net - Pros and Cons
« Reply #13 on: August 12, 2013, 09:30:52 AM »
As I understand it (and I could be mistaken?)... Javascript API (aka SunSpider) is also supported by Mac (not sure if by AutoCAD for Mac [yet]?), so it precludes application code from being platform dependent (i.e., Windows only) as well.



For those who may be interested:

Microsoft Virtual Academy - JavaScript Courses

Not sure if edX offers any JavaScript courses?
The principle behind JS is that it's an interpreted language with a JIT (Just In Time) compiler built into it's environment - which 99% of the time is the Internet Browser you're using (e.g. FireFox / Chrome / IE / Safari / Opera / etc.). Those browsers are the System/machine dependent part, while the JS code is mostly independent of anything - though sometimes you do find "browser" dependencies (especially with IE), which makes JS a bit less write-once-run-anywhere.

Edit: BTW, the place where I've found the most resources about JS is W3Schools.

But once you go down the JS route, you notice something peculiar: Unlike most other languages where you have only a small amount of built-in library packages, JS is only the base language. What you really need to learn is the libraries and or frameworks you're going to use, and there are a pandora's box of them: http://javascriptlibraries.com/ Not to mention every other guy's written one (or at least part of one) themselves. So I guess ADesk will have one for their cloud systems too.

As one who is actively looking for employment in web development (or development generally; good engineering work here is a purple squirrel), thanks for clarifying.

Cheers
"How we think determines what we do, and what we do determines what we get."

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: AutoLISP versus .Net - Pros and Cons
« Reply #14 on: August 15, 2013, 07:49:12 AM »
Just came across this: http://www.paulgraham.com/icad.html

I think it sums up the whole thing nicely!
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.