5 ms·
>Refactoring lisp gets harder the more complex the program gets. Approachs that are clever and reasonable for a 1000 line program can become hell in a 100,000 l
by flavio81 9y ago
>Refactoring lisp gets harder the more complex the program gets. Approachs that are clever and reasonable for a 1000 line program can become hell in a 100,000 line program.
Can you substantiate this claim? One of the reasons Lisp was used in the past was because it was particularly suited to complex, big projects... Like autopilot for spaceship, wind tunnel simulation, CAD/CAM systems, etc.
Lisp (as 'Common Lisp', the traditional dialect) has this concept of "packages" and "systems".
You can divide your code in "packages", each package contains separate namespaces for classes, function names, variable names, symbol names, keyword names and others. Thus each package doesn't collide with another package and names don't collide at all.
Many packages are combined into a "system" (by defining, for example, the required order for compilation, etc).
Thus you cleanly separate your code in packages and systems. The 100,000 line program becomes a combination of many shorter programs.
Of course this is nothing new, this is just standard practice for keeping big programs manageable.
>Breaking up programs into more powerful little pieces is never a clean separation
Care to explain? Well, i'll continue with my post. And we'll assume that what you say is true, so i'll list other advantages to keep complex systems at check.
Now, here is a big plus for complex systems: In such a Lisp, the system is hot-patchable. You can redefine functions while your program is running. Without stopping the program. We're talking about doing this even on a production environment, if necessary.
You can also redefine classes while your program is running. Without stopping the program.
Another big plus is the condition-restart system, which very few languages implement. Lisp has not only the notion of "catching exceptions", but also after catching the exception, provide alternate ways of recovering of this exception, including being able to resume operation at the point where the problem was found.
This is another big plus for building reliable systems -- and complex systems benefit from being composed of reliable parts.
I could go on with other big pluses as well. For example, multi-paradigm. Some parts are more readable (and thus easier to understand, maintenable) if written in the functional style. Others map better to the OOP style. Others would map better to the imperative/procedural style. Other would better be expressed as logic programming (think Prolog.)
Lisp allows you to use all these paradigms. So the code stays clear. I say this is very good for complex systems.
- Retric 9y ago> Care to explain? Some of this comes down to what you consider a 'large' program. Suppose you want to build an MMO in lisp, now you need to consider things running on both a client, and server, as well as rendering, path-finding etc. Choosing reasonable primitives becomes difficult as you get pulled in several directions. Should I be running the same code on client an server or should I have multiple different models communicate etc etc. My point is you start dealing with trade offs and no approach is universally better. Even with a clean API between different pieces of code you still get conceptual dependency's.
- kamaal 9y agoThis looks more like software design problem and not a Lisp problem. Building anything complex requires, apart from tools, getting organized in a lot of other things as well.
- Retric 9y agoThat's part of it. The is an old saying they enterprise software ends up mapping the organization that built it. If you have N teams you tend to break a large project into at least N parts. Sharing code between teams works, but it's harder to share complex lisp macros vs functions. Which is really closer to my point, the larger the project the more tools get set aside too being to ~complex/risky to safely use.