r/javascript • • Feb 14 '22

laconic-ui: frontend framework for busy developers

https://github.com/codomatech/laconic-ui

[removed] — view removed post

0 Upvotes

23 comments sorted by

•

u/Ustice Feb 15 '22

Thanks for your contribution! In order to keep things organized here, we try to keep personal projects off of the main thread. Instead, we have two weekly threads that we steer these sorts of posts to. Show-off Saturday is where we invite you to wow the community with your awesome ideas. If instead you are looking for feedback, our WTF?! Wednesday post is the best place to get a code-review. Remember that here at /r/JavaScript, we’re all about the code. Tell us about your challenges and how you overcame them. Show us that particularly clever bit. Talk about your process and tools. Just because it’s made with JS, doesn’t mean that it is relevant to the community. Tell us what is special about your project, and what we might learn from it!

→ More replies (2)

8

u/Pylitic Feb 14 '22

Honestly, I took a look at the example, and this looks so much more complicated to use over just learning basic vue it's not even funny.

1

u/mohamed_am83 Feb 14 '22

Fair, can't invalidate your experience. I'll however bet you are already a proficient vue developer and probably forgot what it was like when you started.

I'm sure many people, like myself, will find value in writing a 4-screen app in less than 150 lines of code without learning a new CLI and special syntax for SFC.

3

u/Xaurn Feb 14 '22

There isn’t any indication that this library you’ve built is easier to learn than React or Vue.

1

u/mohamed_am83 Feb 14 '22

Would you consider how many concepts you need to learn to build a similar demo in React/Vue? How many lines of code?

For Laconic: it's Javascript and one API, and <150 lines of code, respectively.

3

u/Xaurn Feb 14 '22

The same argument could be made about this framework. This single API is doing a lot of work under the hood. Sure we don’t actually write HTML, but in any large scale application we need to be able to have fine tuned control over how we customise and build our applications. What about testability? How do we assert that the program is behaving correctly when it’s hidden behind a thick layer of abstraction? You advertise low-code as being one of the strengths of the library but how much would one have to learn before being able to reap the benefits? And since when is being able to jam an app into 150 lines of dense code something to celebrate? There is a reason why frameworks such as Vue and React are as complex as they are. It’s because webapps are complex by nature, and at scale these frameworks have proven to be the best at capturing this complexity and making it manageable. I’m not seeing it with Laconic.

1

u/mohamed_am83 Feb 14 '22

First thanks for the constructive feedback!

The same argument could be made about this framework. This single API is doing a lot of work under the hood.

but the argument is not that the framework does fewer things under that hood. It is that the framework can be used with fewer concepts to learn. E.g. if you build the same demo the usual way, you will have to know: Javascript, Vue (including Vue Router), and Vuetify (or whatever components library you choose). So 3-4 things as opposed to 2 with Laconic.

but in any large scale application ... I'm gonna stop you here. large scale application calls for dedicated frontend team (or developer). This is not "the busy developer" Laconic is targeting. Obviously if you are proficient in a frontend framework it will be faster to use just that. Laconic is useful when you are not (e.g. backend dev wanting to go fullstack in one project)

How do we assert that the program is behaving correctly when it’s hidden behind a thick layer of abstraction?

3 things:

  • you check the project's source code. it is an open source project as you see and not thick at all (740 SLOC in total at the moment)

  • contributors provide a test suite.

  • framework user creates and end-to-end test suite with some headless browser.

You advertise low-code as being one of the strengths of the library but how much would one have to learn before being able to reap the benefits?

As said above, 2 things: Javascript and that API

And since when is being able to jam an app into 150 lines of dense code something to celebrate?

Since forever. Even ignoring decisive economic factors like time-to-market. Even in a large project with multiple dedicated engineers, succinct code is often preferred. Every line of code you write is a liability you need to maintain, test, document. I think you know this better.

There is a reason why frameworks such as Vue and React are as complex as they are.

I see you (and others here) compare apples and oranges. Laconic is not a replacement of Vue/React, it works on top of them to avail a modern UI of reasonable complexity to developers who did not dedicate long hours to master a frontend framework. If your complexity grows out of the framework feel free to switch to something more low level with more control.

2

u/Krysalead Feb 14 '22

I think the learning curve will be the same or even longer as there is no community around your stuff. I am developer for a while and I like writing html and css and reading your example I don’t feel confortable because I don’t find my usual way of customizing display. How do you align 2 field side by side? How do you build other thing than form, complex UI. If you want to go full Javascript, have a look to the GWT approach, you build your ui with code and behind the screen it renders as html.

2

u/mohamed_am83 Feb 14 '22

Thanks for the feedback!

... as there is no community around your stuff

Good point, but I don't know of a project that started with a large community from day 1. Hopefully Laconic will attract the right audience with time.

I am developer for a while and I like writing html and css

Then you are not the busy developer Laconic is targeting :) Although you still need to write CSS with Laconic to style your app.

How do you align 2 fields side by side?

You load the app in the browser, inspect the field, note its id, write CSS to make them side by side. Pretty much the same as you would with any software generating HTML.

How do you build other thing than form, complex UI.

If you choose Laconic and some component is missing, you open a feature request on Github and the contributors/community see if the component fits in the framework. Just like any open source project.

If you want to go full Javascript, have a look to the GWT approach

Code the frontend in Java? No thanks! I see what you mean and I coded complex apps with mithril. It is just not high-level enough for the use-case I have.

1

u/Krysalead Feb 14 '22

What I meant by community and is more than 2 developers but no need to be thousands. Also If I need to ask for a feature when something is not developed yet, better to have a workaround

1

u/mohamed_am83 Feb 14 '22

A workaround would be necessary if the feature request is declined. I'd be happy to offer that for a real use case on the issues page. Just a preview: `$laconic.$app` is the full-fledged vue `Application` object, you can customize pretty much any thing you want using that.

2

u/15jacob Feb 19 '22

A lot of people around here seem to be full on "why would you use this instead of X framework" and "it's not worth it". A lot of these responses don't seem to understand that small projects like this are the way in which we end up discovering better ways to do certain things. Sure, some may be better suited than others or simply the dev could feel more comfortable with another set of tools. But nonetheless, as you said, this is looking to fill an area between the framework options that may have not been in the spotlight yet.

I've seen the examples, and I can see how it could fill that gap. Looks clean and I'd risk to say that I feel like I could learn the basics relatively quick by just looking at it

1

u/mohamed_am83 Feb 19 '22

I've seen the examples, and I can see how it could fill that gap. Looks clean and I'd risk to say that I feel like I could learn the basics relatively quick by just looking at it

THANKS! This is precisely why I released laconic: a very low barrier to developing apps. I really appreciate your comment, it will keep me motivated to keep the development on Github.

The online dev community is full of self-proclaimed experts and red-tapers who would take every new idea/framework as a personal insult. They often make a living out of making things much more difficult than they actually are. I learned to ignore those. They can just, you know, take their own advice and go use their favorite workflow instead.

3

u/TorbenKoehn Feb 14 '22

No markup: define your ui completely in your script. Zero html needed.

I don't understand when this was ever an advantage.

HTML is the definition of "declarative". Then you remove it from the stack and build something that can be written "declarative" (in your language: "It's 100% JS-Objects bruh")

Vue, Vue-Router behind it, why not simply use Vue and build a Vue component framework? Then it could be truly declarative....and truly reactive. Right now you're simply stripping off HTML and Vue's reactivity just to be able to write your app as....a bunch of JS-Objects?

Build something larger with it and you will quickly see why this is not worth it.

0

u/mohamed_am83 Feb 14 '22

No markup: define your ui completely in your script. Zero html needed. I don't understand when this was ever an advantage.

I suppose it's always been an advantage for a developer who could code circles around you in JS, but won't be bothered to learn HTML (or JSX or whatever markup a major framework invented) just to write a basic app.

HTML is the definition of "declarative"

hahaha no. You got it backwards. "HTML is declarative", not "declarative is HTML".

Then you remove it from the stack and build something that can be written "declarative" (in your language: "It's 100% JS-Objects bruh") Vue, Vue-Router behind it, why not simply use Vue and build a Vue component framework? Then it could be truly declarative....and truly reactive. > Right now you're simply stripping off HTML and Vue's reactivity just to be able to write your app as....a bunch of JS-Objects?

It is amusing you look down at Javascript, a programming language defined by a standard, then suggest using one framework (out of many) with its own non-standard syntax and API to be "truly declarative and reactive".

Build something larger with it and you will quickly see why this is not worth it.

already in progress, laconic was born out of real frustration. But feel free to suggest something larger.

1

u/TorbenKoehn Feb 15 '22

I suppose it's always been an advantage for a developer who could code circles around you in JS, but won't be bothered to learn HTML

Do you have any numbers on what kind of demographic that might be? I mean, who goes and writes their UI completely programmatic when they have tools like an XML-like dialect to do it declaratively? And if they already understand what "writing UI declaratively" is, why would they have problems learning HTML? And if they don't, why would they use your library over e.g. WinForms style object instantiation or direct DOM manipulation?

hahaha no. You got it backwards. "HTML is declarative", not "declarative is HTML".

Maybe you misinterpreted this on purpose just to get back at me, but I was clearly pointing out that HTML is already a very, or let's say, exclusively declarative kind of writing your UI

It won't get more declarative than that (throwing in stuff like component frameworks or custom elements, you may pick either, of course)

It is amusing you look down at Javascript

Can you point out where I "looked down at JavaScript"?

then suggest using one framework (out of many) with its own non-standard syntax and API to be "truly declarative and reactive".

Do you understand what reactivity is? Care to explain it to me with your words? Is your framework reactive? No it is clearly not. You don't even understand what I'm writing and then tell me I "look down on JavaScript"? Reactive UI isn't (really) possible without JavaScript, how would I go at that? Do you think I'm in a JS-Reddit because I hate it?

What I stated is, you've killed any reactivity with your framework by wrapping a framework that is already reactive and simply stripped the nice parts out, including the reactivity.

I don't care what kind of big UI framework you use, because all of them bring reactivity. Yours doesn't.

laconic was born out of real frustration

What kind of frustration was that if I might ask? Which exact problems did you run into and how did you try to solve them? Got any examples?

But feel free to suggest something larger.

Do a small CMS with a widget system, that should suffice for now. Maybe, at the same time, try it with Vue or React and see how far you get with yours and theirs, respectively. These frameworks have already solved things for years you didn't even know exist as real problems.

0

u/mohamed_am83 Feb 15 '22

Numbers? Sounds like a dishonest question here since no open source project I heard of will do surveys before releasing.

Let me introduce Bob to you, this will probably help you understand the scope of this project if you keep an open mind. Bob is a well versed backend developer who writes Express.js in the morning and Koa.js in the evening. Bob has an idea for an app and naturally writes a perfect backend in a matter of days, now he has to write the frontend. How to go about that? Bob is a busy developer, he doesn't have hours to compare the frameworks, pick one, then learn the specific workflow, toolset, syntax, and API of that framework just to start being productive.

Bob would rather have a simple Javascript API which will render the UI he wants while staying in the environment where he is most productive, the text editor. He won't see it as a "bunch of JS objects bruh" as you condescendingly described it, rather an abstraction which spares him the time of learning about virtual dom, life cycle, hooks, cli, and the specific tags he needs to put in the template.

Also Bob understands what reactivity is. E.g. from Vue documentation:

Models are just plain JavaScript objects. When you modify them, the view updates.

When he checked the laconic example (which you probably didn't), he saw when you update a data source (by passing it in an event), the table view changes. In fact, he can change the whole structure of the app just by passing that "bunch of js objects" representing the screens in an event. This checks for him as reactive regardless of any narrow definition.

Bob is a really busy, why would he want to reinvent the wheel and do a CMS? He'd rather use one of the established APIs to manage the content and limit the scope of the app to the useful parts. If a component he needs is not supported, he'd go the Github project issues and ask for it.

Finally, Bob understands laconic is not a replacement of Vue, it operates at a higher level and this has a price (no free lunch). If his needs grow out of laconic-ui capabilities, he'll have to dig deeper and learn Vue details, or hire someone who does. But he also knows that a lot can be done using laconic before hitting that limit.

1

u/TorbenKoehn Feb 15 '22 edited Feb 15 '22

then learn the specific workflow, toolset, syntax, and API of that framework just to start being productive.

Like with your framework?

a simple Javascript API

Very subjective imo. For me it looks more complex than e.g. using Vue and some component framework of your liking. Writing <b-modal v-model="showModal" /> or <Modal shown={shown} /> is "simpler" than your JavaScript API, objectively spoken.

virtual dom, life cycle, hooks, cli, and the specific tags he needs to put in the template.

So everything he will have to solve at some point, but he shouldn't care about it now because it's easy to migrate once the app gets bigger?

When he checked the laconic example (which you probably didn't), he saw when you update a data source (by passing it in an event), the table view changes.

What you describe there is not reactivity. I checked your examples and exactly this is not reactivity. Your examples are the reason for my comments, what are you thinking?

You don't use a single-source-of-truth for your data, you always replace it by completely new data. Changes to the data won't update the UI at all, you imperatively update the data by yourself by running a command. This is not better than your typical $.ui.update() call in old jQuery code, just glorified with some events sprinkled in.

I mean, you're even showing the exact quote from Vue that explains what is reactivity and still don't understand that what you're doing is an imperative update, not a reactive one that was realized by declaratively passing your data.

If your data would be Vue's ref or reactive right from the start, things could be different, but they aren't. You stripped those features off of Vue and turned back to imperatively updating your UI.

Every change to your data you also need to make sure to do your imperative update.

So my point stands: You don't understand reactivity right now. It's reactive when it updates when you change the data, not when you imperatively call some method after your data changed.

Bob is a really busy, why would he want to reinvent the wheel and do a CMS?

Tell me about it, because it seems you're trying to reinvent the wheel here and it's square-formed with spikes on it.

it operates at a higher level and this has a price (no free lunch). If his needs grow out of laconic-ui capabilities, he'll have to dig deeper and learn Vue details, or hire someone who does. But he also knows that a lot can be done using laconic before hitting that limit.

Honestly, you're basically saying "If you want to do real apps with this, you will upgrade to Vue at some point". So why not directly go for Vue? I can set up a Vue project in like 5 different ways with a single command right now, another for installing a component framework of your choice and boom, you can prototype away. What exactly is easier with your framework here?

Honestly, I get that this is useful for learning purposes, but placing this here like "the framework for busy developer" when it's essentially giving you more work than less seems very arrogant.

This here is honest criticism. I understand you would've hoped you only get applause here, but if you want to improve yourself I can suggest, listen to criticism, too.

I'd still be interested in what your "frustrations" were with e.g. Vue and what led to you creating this....framework?

0

u/mohamed_am83 Feb 15 '22

(since this thread is getting long and both of us made our points, I won't post replies after this one).

Like with your framework?

this is exactly the point, in laconic it is just an API to learn (one thing) as opposed to cli, markup syntax, and API (three things) for a lower-level framework. So your "more work for less" argument is ... well, interesting.

This is not better than your typical $.ui.update() call in old jQuery code, just glorified with some events sprinkled in.

This is painfully untrue. ui.update would involve doing stuff with the DOM. On the other hand:

$laconic.bus.emit('gui', {op: 'update-datasource', payload})

is more or less equivalent to:

model[payload.name] = payload.value

and indeed, it is just an assignment under the hood. Vue takes care of the update.

Also, you are too hung up on Vue. If tomorrow the new framework prevueact-svelte-native becomes the real deal, laconic and apps using it can be ported with reasonable effort. That's one of the design goals.

but placing this here like "the framework for busy developer"

Where exactly did you see the word "the"? The title here and the Github page say it is just "framework for busy developers". This is probably projection since to you "HTML is the declarative language". You tend to think in absolutes more often than you like to admit.

I shared laconic in the hope it will be useful to others as it is to me, and to solicit feedback from the community to improve it. Have a look at it a few weeks from now and you will see a couple of "real" projects linked (on second thought, don't bother! Your definition of "real" strikes me as too subjective anyway.)


Your criticism might be honest, you know better, but it is not really constructive. I can't extract any substance from it beyond: "This is shit! You stripped Vue of its glory! Why not use Vue?" and a couple of untrue claims and passive aggressive comments.

1

u/TorbenKoehn Feb 15 '22

First off, I'm not hung up on Vue. In every comment of mine you can replace Vue with any other framework you want and it's the same argument. Personally I'm a React enjoyer, I only do Vue for the money.

$laconic.bus.emit('gui', {op: 'update-datasource', payload}) is more or less equivalent to: model[payload.name] = payload.value

This is exactly the problem and I don't see why you don't see it: Your data is not reactive. The dataset you work on (the array of data you're passing to your "update" function) is not reactive. Changing the data won't update the UI automatically, you have to imperatively call your update-datasource event. This is not reactive. Updating stuff manually when your data changes is simply not reactive. I don't understand why you believe this is reactive just because the underlying library is reactive. If you use two states that derive from each other but one is not a computed state, you're also not working reactively, regardless of it's a Vue ref/reactive or anything else.

If you forget to call your update event, your GUI won't update, regardless if the data changed. It will always lead to bugs and things not updating correctly.

You tend to think in absolutes more often than you like to admit. Your definition of "real" strikes me as too subjective anyway.

I don't give 2 cents on what you think about me personally. Quoting me wrongly won't change that. What you should be interested in is what people think about your library.

See the upvotes on this reddit thread? See all your GitHub stars? See the upvotes on your comments? Don't or can't you take a second guess why that might be the case?

I don't put constructive criticism? I told you, HTML is just as declarative as your JS-Objects. Your library is not reactive. There is no real use cases for it and the problems you tried but failed to solve are problems that have been solved by the common UI reactivity libraries greatly already. You're not helping any "busy developer", you're trying to give them more work. Someone that doesn't know better might actually go along and use, this is dangerous.

But I understand that you can't extract anything constructive from it because you're taking everything personally like a child and believe I am insulting you when in fact I am telling you real problems with your library, problems where you have to do research on why they are problems (I can't learn that for you man, you have to do that). It's not my problem you don't understand the words I say or reactive UI libraries for that matter (I've also taken a look at your Vue projects on Github and understand why you have problems with it. Because you're using it how you think it would be correct, not how the docs are telling you to)

"This is shit! You stripped Vue of its glory! Why not use Vue?"

Why, man, this hits home. This is exactly what I think. It's good that you understood that well at least.

Up to now you can't even tell me what was wrong with Vue, I asked 2 times already, never got an answer. Maybe you don't read at all, I don't know. And I also don't care. Have a good one mate, good luck with that thing!

1

u/mohamed_am83 Feb 14 '22

I know there are too many frameworks already, but this one is laser focused on productivity: If you ever want a clean, customizable UI for your app using plain Javascript, without bothering with the gritty details of virtual dom, hooks, life-cycle, etc), `laconic-ui` is for you!

I appreciate your feedback.