Hacker News new | ask | show | jobs
by jonnymoe 2042 days ago
Core contributor here: I think you're right when talking about DSLs ONLY introdrucing a high level of abstraction. But Matestack's first layer only maps HTML tag rendering to Ruby method calls, which actually doesn't add any abstraction and thus gives you the same level of flexibility when implementing things. The advantage of doing things in pure Ruby (even without any abstraction layer) is simply that it's now possible to utilize Ruby's languange features to create clean and readable UI code within a proper Ruby class - which means you can use class inheritance and modules for UI code structuring. That could be a big thing if you're into writing Ruby code ;) On top of that Matestack offers components (used via a DSL) with a higher level of abstraction in order to hide implementation complexity of - for example - rerendering a specific part of the UI. The idea behind these components is to drastically reduce the amount of code and effort you have to invest in order to implement typical UI requirements. And yes it's true: When using these components you loose some flexibility on how exactly things will work but you gain development speed and productivity. If the components don't perform as desired, you simply create your own component in pure Ruby or pure Vue.js and do whatever you want - e.g. consuming a JSON API and perform client side rendering. Without this customization path I would totally agree with what you said here: "the problem of DSLs is that they can quickly turn into giant pain in the ass once you need to do something they aren't prepared for" Matestack tries to enable you to use components with high level of abstraction next to components with low level of abstraction next to your very own components... and they are all meant to live happily side by side :D
1 comments

Well i don't find plain HTML unreadable or messy. Same with JS. And i never experienced any productivity issues writing it.

As i'm thinking about it only DSL i find useful is Nokogiri's XML builder. That can save me some time sometimes.

Good luck with Matestack anyways. It's just not for me i think