Web++: A C++ Web Framework
131 subscribers
440 photos
36 videos
20 files
177 links
Web++ Framework (A C++ web framework to ease the pain of web development)

Using modern C++20/23.
GitHub: https://github.com/the-moisrex/webpp

I've been working on this project since 2019...
Download Telegram
Why did I think this was a good idea? Seriously, WHY?
Web++: A C++ Web Framework
Why did I think this was a good idea? Seriously, WHY?
Is it that bad? Any new ideas on what should I do with this?
1. Replace with std::any (Too slow maybe!?)
2. Use extensions (Becomes complicated maybe?)
3. Use inheritance (Don't even think about it!)
4. Use void* + size + extensions (I don't know what I'm talking about ๐Ÿ˜‚)
5. ...???
Okay how do you do a "at least one of these" in C++20 concepts?
I'm gonna add extensions to everything; including:
- Protocols
- Interfaces
- Routers
- Requests
- Responses
- Contexts
- Headers
- Bodies

Each extension may require other extensions from the same level, or even lower levels which the type itself has access to at compile time.
This way for example you can add an extension to the router and see the result in the context or even the requests and response.
An example would be cookies which will be added to the headers level but with a little of boiler plates, you can use it as a router level extension.

This is a nice way but I wonder if a unified extension type would be a better solution.
Read this from top to bottom, or bottom to top. Your choice!

Today was the worst day
and don't try to convince me of that
there will be some good moments everyday
if you look carefully,
life is hard
even though
many times good things happen
happiness doesn't exists
and it's not true that
many things depend on us
I'm sure you agree that
the environment that we're in
affects directly on
our behavior
not everything is in our control
and you never see me saying
today was a good day
Collaborative Response (Collaborative output):

This is the the way that multiple sub-routes each prepare parts of a response.
For example:
Sub-route 1 will prepare the template (header and body).
Sub-route 2 will prepare for example the dynamic stuff in the page that are still boiler plate (where the user profile picture would go and notification stuff and these kinda stuff)
Sub-route 3 fills a complex table for example
Sub-route 4 fills a the rest of the stuff in the page
Sub-route 5 ...

I haven't seen this idiom anywhere yet. With the new routing system you'll be able to do this in the future as easy as it's possible. You just have to add one extension into your router. That's it.
I think C++20 concepts are great ways to reduce header dependency hierarchy, compile time, and maybe even code bloat; specially for header-only libs.
How? By introducing a concept for every type that the library user needs to use; in a different header file.

This way half of your library is not dependent on the other half of the library; they just need the concept header files of those types not the types themselves.

Of course if you're not using templates, don't use this tricks since introducing templates to the code adds more compile time but if you already doing TMP, then the chances are that with concepts that are not actually checking the exact type, you can reduce header dependency.

Most of the time your library doesn't need to know the actual type, it just needs to know what you can do with that type; which of course leads to more general code.

Of course C++20 modules also can fixes the same problems in most cases but not all of them.
After talking with experts (Author std::format and others) on twitter, seems like the best strategy for using {fmt} and boost::asio as fallback, is to use webpp::std namespace instead of ::std.
I will also use webpp::stl for adding features (not as polyfills).
That's how low I had to come for understanding the idea of the extensions and its complexity of implementations.
I've re-written it like 10 times now.
I'm only going to implement it when I've fully documented it.
Heavy project development stack:

0. Research Driven Development
1. Documentation Driven Development
2. Community Driven Development
3. Test Driven Development
4. Resource Driven Development
5. Time Driven Development

Research Driven Development
is when you need to research (learn) a bit, and do that bit, then research a bit, then do that bit, and so on ...

Documentation Driven Development is when you write the detailed documentation of the parts that you need, before actually implementing them in the project.
Not all projects require extensive documentations despite what most people try to tell you; but it's extremely helpful.

Community Driven Development is when the project is as big as its community of developers; sometimes that tasks cannot be handled by one person, so other experts will be included in the community and those experts are the ones that continue their parts of the project.

Test Driven Development is when you write a usage of the project, and then actually go and implement it. Many tools are available for this job.

Resource Driven Development is when you can only expand your project with more resources weather resources are money, servers, or even customers.

Time Driven Development is when the project grows when time passes, or shrinks when time passes. Time-sensitive usually sacrifice other resources weather its money, quality, or quantity in order to get the right time.

Oh, btw, I just made these up, don't need to go looking them up :)
This is the amount of Template Meta Programming I have to do just because I decided not to use virtual inheritance in C++ due to the run-time performance hit!

Does anyone have a better name for "extensie"? I made it up since I can't find any useful English word.
If anyone is interested, we will have a package manager or some sort for it in the future.
We will not work on it straight away because the proposal is not ready (we just started it) yet.

I suggest everyone who's interested, you can add more details about the proposal; or even edit it completely.

Here you will find the draft for it:
https://gitlab.com/webpp/webpp/-/blob/package-manager/proposals/package-manager.md
Macros. Just Marcos.
Forwarded from The Moisrex
Old C++ was not a good language to do web dev in.
With a good web framework, C++ is totally capable of handling web development.
And it has many more features than other programming languages; specially in the world of TMP and compile-time execution.

I even talked about language features with the creator of JavaScript on twitter (I did not know who I was talking to at first ๐Ÿ˜);
He believed we should strip down the features of a language to make sure it's easy to use; I believe, that's the libraries' implementer's job.
Code is not compile-able!
Web++: A C++ Web Framework
Kidding, now you can compile the project.
I'll keep the master branch compile-able from now on; but that means the master branch won't me the branch I'll be working on.