Coder Social home page Coder Social logo

C++ for production web development? about asm-dom HOT 9 OPEN

mbasso avatar mbasso commented on May 20, 2024 1
C++ for production web development?

from asm-dom.

Comments (9)

mbasso avatar mbasso commented on May 20, 2024 1

Hi @rygo6,
first of all thank you for the compliments and for your interest in this project! I really appreciate it! 😄
Regarding asm-dom, I'm thinking to implement something like snabbdom's thunks and other simple features like that. I'd like to maintain it simple and performant.

Where do you see asm-dom going? Are you hopeful for comprehensive C++ web tooling? Is such a thing plausible or ideal? What missing components do you think are necessary?

asm-dom is a minimal virtual dom that can be easily used to build a framework, just like snabbdom. It would be interesting to develop something similar to react, class components with lifecycle and so on. Here is a simple example of that.
I think that we can use it to build something bigger but I'd like to leave this package simple and reusable without transforming it into a framework. I don't want to force people to use a big framework if they don't want, we can just fork or import it as a dependency.
We certainly need other helper packages that call JS when needed to hide to the user complex mechanisms like routing etc. I think that we can develop modular code in this way and then aggregate them to build a framework.
A lot of work needs to be done but I'm really hopeful.
What do you think about it? Do you think that this is the right way to do that?

from asm-dom.

talentlessguy avatar talentlessguy commented on May 20, 2024

@mbasso, I like this project too! Very upset this isn't in GitHub trending :(

About "complex mechanisms". You can just create a lot of plugins for asm-dom and we will be able to use them like usual c++ libraries.

Some example names

asm-dom-plugin-component
asm-dom-plugin-state

And so on.

And we will be able to use it like this:

#include <asm-dom-plugin-state>

from asm-dom.

rygo6 avatar rygo6 commented on May 20, 2024

Sorry for not responding to this for so long. Went on a bit of detour in my personal life and projects. But started looking at this again.

I agree with the approach of keeping this repo as simple as possible. How do you think we would deal with pulling together all the different modular pieces of a large project? Could we rely on NPM for modular pieces? Can you distribute C++ through NPM?

I read through some more of your cpp code, and also some of snabdom. I realize I am actually kind of naive on all the thinking behind the design of a virtual dom. I was curious, did you by chance base this implementation off of a description of virtual dom in a book, or article, somewhere which I could also read to get a better understanding of the thinking behind it?

from asm-dom.

webern avatar webern commented on May 20, 2024

asm-dom is a minimal virtual dom that can be easily used to build a framework, just like snabbdom. It would be interesting to develop something similar to react, class components with lifecycle and so on. Here is a simple example of that.

Do you think most of the foundation is available such that a framework (like React) could be written in C++? Or is there more JavaScript integration that's needed?

from asm-dom.

mbasso avatar mbasso commented on May 20, 2024

@rygo6

Sorry for not responding to this for so long. Went on a bit of detour in my personal life and projects. But started looking at this again.

Don't worry 😄 We all have our personal life

I agree with the approach of keeping this repo as simple as possible. How do you think we would deal with pulling together all the different modular pieces of a large project? Could we rely on NPM for modular pieces? Can you distribute C++ through NPM?

At the moment asm-dom needs both C++ and JS imports to work properly... I'm planning to remove the last ones in order to improve the public API and have only C++ files. However, at the moment I'm not able to identify the right package manager, indeed, I'm not sure about the decision to use NPM...
Have you some suggestions to distribute modules in a convenient way?

I read through some more of your cpp code, and also some of snabdom. I realize I am actually kind of naive on all the thinking behind the design of a virtual dom. I was curious, did you by chance base this implementation off of a description of virtual dom in a book, or article, somewhere which I could also read to get a better understanding of the thinking behind it?

I based the implementation of asm-dom on snabbdom simply reading thorugh the source code... I've also read the implementation of preact, which is a really performant virtual dom with the same APIs of React, and inferno that is also interesting too. preact uses a DOM recycler and inferno uses bitwise operations to speed up the critical path, as asm-dom does.
I've read also some articles and watched some videos, for example:

@webern

Do you think most of the foundation is available such that a framework (like React) could be written in C++? Or is there more JavaScript integration that's needed?

I'm not an expert of the internals of React but I know that the core module and the one to interact with the DOM are well separated. The second is just a renderer of the first one that I think it could be easily written in C++. We should try to confirm it but I suppose it's possible.

from asm-dom.

rygo6 avatar rygo6 commented on May 20, 2024

In terms of managing modules, I personally never saw what was so terrible with git modules. The only big issue I see is that it doesn't automatically clone all dependencies for a module. But honestly thats one of the things I kind of hate about npm, you add a module to draw a bar graph, then it adds 50 more modules to node_modules. Maybe manually having to git submodule add each depdency would make people conciencious of what their dependencies are.

But maybe it could warrant an expansion to git? Perhaps 'Git Dependencies". A repo would have have an extra .gitdepedencies file that would list all the dependencies for the repo. Once it clones a repo from .gitdependencies, it would check for .gitdependencies in that repo and do the same. But it would clone all repos in .gitdependencies under a single folder in the root, in a single "dependencies" directory that would be akin to node_modules.

from asm-dom.

rygo6 avatar rygo6 commented on May 20, 2024

On the subject of my last post. have you guys seen this?
https://nxxm.github.io/

Looks to be the exactly perfectly alternative to npm that would work well for something like this.

from asm-dom.

rygo6 avatar rygo6 commented on May 20, 2024

Some more reading, this seems more popular:
https://conan.io
Im thinking I am going to try to get this set up with Conan.

from asm-dom.

mbasso avatar mbasso commented on May 20, 2024

Some more reading, this seems more popular:
https://conan.io
Im thinking I am going to try to get this set up with Conan.

Cool, sounds good.
Keep me updated if you experiment something with it 😄
We can publish it on both npm and conan for now. In a project with a lot of js interaction npm is certainly needed, the same conan but for C++...

At the moment I'm modifying a little bit the internals of asm-dom (and a few public api, but something really small) in order to continue with the multithreading smoothly... I'll open a "Work in progress" PR one of these days.

from asm-dom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.