You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the main strengths of Clojure (and Lisp family languages in general) is first class support for the ability to easily manipulate the source code on the lexer level through defmacro, the read macro etc. On a basic level, you can use it to easily build structural editors á la parinfer and smartparens, on the extreme you can do advanced code generation like https://github.com/webyrd/Barliman
For traditional Rails-variety frameworks like Symphony, to a lesser extent Django, and even ASP.NET Core, the code generation process is one way e.g. run a command to do scaffolding, a bunch of code is generated. However if things go wrong, or if you decide to extend your model, it is back to handwriting code. With Clojure, this can be completely abstracted away. You can easily build a way to dynamically e.g. form inputs from a new updated model state without having to manually write everything. It won't of course be perfect, but it can be potentially a killer feature.
Then I decided that a single base64 string for Product image is silly, not good for performance, etc. and abstracts images into a separate table and changes the model to has-many: Images.
Now the traditional way would be to jump through all files that mention images:string and delete it, create the migration, and finally create the new Image type, add it into the files, add new UI element, bind UI to controller, test etc. Or you can just re run coast scaffold and override everything.
None of these methods are particularly fun, with Clojure however you can have a GUI or interactive prompt and selectively delete/add elements or code and have the changes be automatically propagated throughout the codebase.
that have codebases structured around easy swapping in and out of components, rapidly-changing models, that sort thing. You do not need this sort of trickery in Clojure, it's trivial for Clojure to manipulate the syntax tree and add new code or remove certain existing ones. Rails/Python/PHP/.NET has to regenerate entire files or append code as string (e.g. rails routes generation). Clojure (and most Lisp in general do not suffer from this problem)
The text was updated successfully, but these errors were encountered:
One of the main strengths of Clojure (and Lisp family languages in general) is first class support for the ability to easily manipulate the source code on the lexer level through
defmacro
, theread
macro etc. On a basic level, you can use it to easily build structural editors á la parinfer and smartparens, on the extreme you can do advanced code generation like https://github.com/webyrd/BarlimanFor traditional Rails-variety frameworks like Symphony, to a lesser extent Django, and even ASP.NET Core, the code generation process is one way e.g. run a command to do scaffolding, a bunch of code is generated. However if things go wrong, or if you decide to extend your model, it is back to handwriting code. With Clojure, this can be completely abstracted away. You can easily build a way to dynamically e.g. form inputs from a new updated model state without having to manually write everything. It won't of course be perfect, but it can be potentially a killer feature.
An example would be:
I am building a e-commerce website:
coast scaffold Product image:string, price:decimal, belongs-to: Shop
Then I decided that a single base64 string for Product image is silly, not good for performance, etc. and abstracts images into a separate table and changes the model to has-many: Images.
Now the traditional way would be to jump through all files that mention images:string and delete it, create the migration, and finally create the new Image type, add it into the files, add new UI element, bind UI to controller, test etc. Or you can just re run coast scaffold and override everything.
None of these methods are particularly fun, with Clojure however you can have a GUI or interactive prompt and selectively delete/add elements or code and have the changes be automatically propagated throughout the codebase.
There are CMSes like:
https://strapi.io
that have codebases structured around easy swapping in and out of components, rapidly-changing models, that sort thing. You do not need this sort of trickery in Clojure, it's trivial for Clojure to manipulate the syntax tree and add new code or remove certain existing ones. Rails/Python/PHP/.NET has to regenerate entire files or append code as string (e.g. rails routes generation). Clojure (and most Lisp in general do not suffer from this problem)
The text was updated successfully, but these errors were encountered: