764 karma · joined Sep 20, 2023 (3y ago) · 325 submissions
comment 2y ago · link · parent
The reason it's useless is that the learning curve is too steep for just about everyone. It's extremely useful for me though. I've put together complex applications with it in record time with very few lines of code.
comment 2y ago · link · parent
Nowadays, even if someone is right about something and most people are doing it wrong, nobody will care to even discuss it unless the person making the statement is one of maybe 3 top influencers in that field.
comment 2y ago · link · parent
If we have a chain of senders and receivers and absolutely wanted to avoid double processing instead of also maintaining idempotence down the line as described above. It is also technically possible (but I guess not worth the complexity); we could make it so that the receiver would add a flag 'about_to_process' on each record just before it starts processing the record and then it would change it to 'committed' once it finishes. If the receiver crashes before completing processing a message, it would see the 'about_to_process' flag and in that case it could ask the next process/receiver in the sequence if they already received a packet with that UUID and only send the output for that message if they have not.
It's very ugly but it's possible.
comment 2y ago · link · parent
Same with two-phase commit, it can be implemented perfectly given certain reasonable constraints and assumptions. The consumer process could crash, then on restart, it would use timestamps to check which record it processed last and resume processing starting with the next unprocessed one. If the consumer uses input messages to produce output messages somewhere else, the consumer could also itself perform a two-phase commit on its own outputs to account for the possibility of itself crashing part-way through processing an input message. It can coordinate both inputs and outputs perfectly.
If we define 'processed' as fully committed, then messages ca be processed exactly once. If it can be processed once, it can be delivered exactly once if you accept the simplest definition of that word.
What is often suggested when people say "exactly once delivery is impossible" is that duplicates cannot be avoided and this is usually a cop out.
comment 2y ago · link · parent
If a message can be guaranteed to be received one or more times but results in a single entry being inserted into a database (e.g. in an idempotent way using UUIDs to enforce uniqueness), then clearly, a consumer reading the records from that database would only receive the message exactly once. If you consider the intended recipient to be the process, not the host, then the definition of 'delivery' allows you to claim that exactly-once delivery is possible.
Of course this is a pragmatic, not mathematical argument. In theory you can't mathematically guarantee even at least once delivery because you can't guarantee that there's not going to be a Carrington event which will bring down the internet and drive humanity to extinction; thus preventing the consumer server from being rebooted.
comment 2y ago · link · parent
The idea is that if you're a highly experienced senior developer, it should feel oddly familiar. It aims to address every possible concern that a senior developer might have when building a web application.
Avoiding footguns is one of the core principles behind it.
It aims to strike the ideal balance between flexibility and simplicity. It's not for building rough prototypes; it lets you build apps that are more secure, more performant, more scalable and more maintainable than the ones you would write from scratch.
comment 2y ago · link · parent
You can combine different approaches like limiting the number of connections from a single IP within a certain timeframe and also limiting the backpressure.
The ability to detect and respond to backpressure spikes on a per-end-user basis is highly valuable because backpressure in SocketCluster takes into account the processing time of client requests.
A common strategy that spammers use is to identify and invoke the most expensive endpoints in your system.
Unfortunately, a lot of people still don't understand the value proposition of being able to process requests from clients in-stream and in-order. It's also good for preventing race conditions and makes your environment highly predictable.
In terms of security, many of the worst, most expensive hacks in history were the result of asynchronous events exploiting unexpected race conditions on the server side. The crypto industry has been plagued with those since its inception.
People seem to have gotten used to running chaotic, unpredictable systems, supporting impossibly complex permutations of concurrent events and trying to handle every possibile edge case instead of constraining each stream to certain sequences.
I don't understand the industry's obsession with type safety in the face of far greater problems like this. Maybe we just need a new catchphrase: Concurrency safety? Async safety?
Queueing up message processing per-client doesn't add any noticeable delays from the user's perspective because most operations are a few milliseconds which is unnoticeable once you factor in latency between client and server. It's only noticeable when you want it to be; for example when the user uploads a large chunk of data which requires heavy processing. You can also specify which streams can be parallel and which can be serial.
comment 2y ago · link · parent
Insnare: https://www.insnare.net/
A head-hunting/recruitment application to search companies and people based on their skills and experience. Currently focused on Australian market.
It's also for people who are looking for jobs. The goal there is to help to find good companies which have high (or low) concentrations of people with certain skills/attributes.
Saasufy: https://saasufy.com/
A no-code/low-code platform for building apps without code. Insnare is built with and runs on Saasufy. This freed me up from having to write back end code for Insnare and made the front end code very small.
comment 2y ago · link · parent
An adult should be able to become proficient at HTML within minutes, hours at most.
comment 2y ago · link · parent
A good visual programming tool should abstract away complexity but it can only achieve that by reducing flexibility.
If you're going to give people a visual tool that is as complex as code itself, people might as well learn to code.
It helps to focus on a set of use cases and abstract away from common, complicated, error-prone, critical functionality such as authentication, access control, filtering, schema definition and validation. All this stuff can be greatly simplified with a restrictive UI which simultaneously does the job and prevents people from shooting themselves in the foot.
You need to weed out unnecessary complexity; give people exactly the right amount of rope to achieve a certain set of possible goals, but not enough rope for them to hang themselves.
I've been working towards this with https://saasufy.com/
I've chosen to focus on CRUD apps. The goal is to push CRUD to its absolute maximum with auth, access control and real time data sync.
So far it's at a point that you can build complex apps using only HTML tags. Next phase would be to support generating and editing the HTML tags via a friendly drag and drop UI.
Still, it's for building front ends. It cannot and will never aim to be used to build stuff like data processing pipelines or for analytics. You'll need to run it alongside other services to get that functionality.
comment 2y ago · link · parent
It makes it impossible to introduce back end bugs or security flaws (assuming that access control rules are defined correctly; which is a lot easier to verify via a simple UI than reading thousands of lines of back end code).
Look at this app I built with it on the side: https://www.insnare.net/
It's only ~1300 lines of custom code in total. Most of it is HTML. Throughout the entire process from start to finish, I never encountered a single back end bug. Deployment essentially never fails; the UI doesn't let you do anything invalid and it helps avoid inefficient queries. Yet look at the complexity of what kinds of queries and filters I can run against the data and all the different views. It has almost 1 million records... Indexes are not even fully optimized. Look at the data that's behind access control/associated with specific accounts (e.g. the Longlists).
Go ahead and try to bypass access controls... The WebSocket API is documented here: https://github.com/Saasufy/saasufy-components/wiki/WebSocket...
It would normally have taken months and tens of thousands of lines of code (front end and back end) to build that.
The value is there in terms of security, development efficiency, maintainability etc... The hard part is getting people to see it.
comment 2y ago · link · parent
> Energy, imagination, resilience, good judgement, and focus on a goal
It's nice to frame it that way so we can know what to focus on.
Personally, I'm strong in terms of energy, imagination and resilience.
I'm probably a bit weaker in terms of judgment and focus on a goal. I think my approach to the latter 2 has something to do with my environment.
Good judgement is actually harder to achieve than it seems. I think my issue is that I was conflating 'good judgment' with 'common sense'. But it's not the same. We're humans and things can be complex for irrational, artificial reasons. Good judgement these days often entails adapting to the subtle irrationalities of the environment and learning to exploit them. That lesson has been really tough for me.
In terms of 'Focusing on a goal', my issue is that I chose a huge audacious goal with small milestones along the way. While I managed to achieve all of the milestones, they don't bear any financial rewards; their utility was just a risk mitigation strategy so that I could easily pivot to other, less ambitious goals if the big audacious goal didn't pan out.
My goal over the past 10 years was to create a platform that would make it much easier easy to build fast, secure, bug-free, highly maintainable software. That's a really difficult goal especially on the sales side as it is a highly competitive space. I managed to build a platform which achieves that. See https://saasufy.com/
But unfortunately, I'm realizing that my goal is too big. I'd be competing against many big tech platforms and also against existing software development paradigms (which is even harder!). So now I'm shifting my strategy towards using my platform Saasufy.com just for myself and my friends to build more niche products like this HR/Recruitment platform: https://insnare.net/
I'm thinking I may have to even re-imagine what 'niche' means.
comment 2y ago · link · parent
It is very easy if you know the right tools for the right job, but information about these are suppressed so you never hear about them.
What the vast majority of people think the tech tooling landscape looks like and what it actually looks like are very different. The tools we know about are mostly horrible. They try to be silver bullets but they're really not good for anything... Yet they're the most popular tools. I think it's about capital influence, as hinted by the article.
For example, with the tool I'm using now, I made a video showing how to build a relatively complex marketplace app (5+ pages) in 3 hours with login, access control, schema validation, complex filtered views from scratch using only a browser and without downloading any software (serverless). The whole app is less than 700 lines of HTML markup and 12 lines of JavaScript code. The video got like 10 views.
comment 2y ago · link · parent
Unfortunately, moving real-time messaging complexity entirely to the back end has been the norm for a very long time. My experience is that, in general, it makes the architecture way more difficult to manage. I've been promoting end-to-end pub/sub as an alternative for over a decade (see https://socketcluster.io/) but, although I've been getting great feedback, this approach has never managed to spread beyond a certain niche. I think it's partly because most devs just don't realize how much complexity is added by micromanaging message queues on the back end and figuring out which message belongs to what client socket instead of letting the clients themselves decide what channels to subscribe to directly from the front end (and the back end only focuses on access control).
I think part of the problem was the separation between front end and back end developer responsibilities. Back end developers like to ignore the front end as much as possible; when it comes to architecture, their thinking rarely extends beyond the API endpoint definition; gains which can be made from better integrating the back end with the front end is 'not their job'. From the perspective of front-end developers, they see anything performance-related or related to 'architectural simplicity' as 'not their job' either... There weren't enough full stack developers with the required insights to push for integration efficiency/simplicity.
comment 2y ago · link · parent
I've built platform which does just that: https://saasufy.com/
This approach has allowed me to create a library of highly generic components which can be composed into surprisingly complex front ends and where all data updates in real time (in a targeted, efficient and scalable way): https://github.com/Saasufy/saasufy-components?tab=readme-ov-...
You can build just about any front end you can imagine just by assembling these components. Almost no code needed. It takes me hours to build web applications which would take weeks or months to build. The real time update features come free. The dev experience is essentially bug free; any 'bugs' you may encounter have clear visual symptoms which can be 'debugged' by observing the HTML DOM.
I'm currently observing people getting hyped up over HTMX and it's kind of funny to realize that developers do actually like the declarative approach... And yet they're going in the wrong direction again. Just as they did with GraphQL.
It would have been impossible to do this with GraphQL because field-granularity/autonomy is essential. GraphQL queries combine different resources and fields together in complex ways and this makes it impossible to efficiently avoid real time update conflicts on the front end.
comment 2y ago · link · parent
https://github.com/socketcluster/ag-crud-rethink
I wrote it for RethinkDB but it could be adapted to any database as it doesn't rely on changefeeds.
I then ended up building a complete serverless solution around it: https://saasufy.com/
It borrows many concepts from REST but works over WebSockets. Why WebSockets? Two major reasons:
- It had to support real time subscriptions/updates so that the views could automatically update themselves when data changed (e.g. with concurrent users). I didn't want to force the developer to manage channels manually as it can be a major headache to get the subscription order right and to recover from disconnections without possibility of missing any update messages. Also, my library SocketCluster already supported client side pub/sub with clustering/sharding on the back end so I wanted to leverage that mechanism.
- WebSocket frames are tiny and don't have all the overhead of HTTP requests so it's possible to have field-level granularity which is important for avoiding resource update conflicts. This is something that the GraphQL developers also figured out at some point. But the challenge with true end-to-end field-level granularity is that loading a single resource would require a potentially large number of requests to be made; hence HTTP requests are not suitable for this (imagine HTTP headers containing cookies being sent for every single field of a resource), however, WebSocket frames are ideal for that as they have tiny headers. You can handle maybe 100 WebSocket frames for the same cost as a single HTTP request.
End-to-end, field-level granularity is powerful as it allows subscriptions to be set up automatically per-field and access control can be enforced automatically at both the resource and field level (for each of create, read, update, delete and subscribe operations). It's also very useful for caching because different views may display different fields of the same resources with some shared fields so caching field values allows different views to share cache.
The overarching philosophy behind end-to-end field-level granularity is that it allows the system to treat each field of a resource as an independent entity with its own subscription/synching mechanism, access control and cache.
SocketCluster was designed to facilitate extremely cheap pub/sub channel creation (both in terms of CPU and memory) and automatic cleanup so it seemed like a good use case to build on top of my existing work. The code of ag-crud-rethink is quite simple... Only about 1.5k lines of code and probably could have been a lot smaller without all the bells and whistles.
The view mechanism also supports real time updates. It can be thought of as a parameterized collection. You define a 'view' with one or more parameters to control the filtering and/or sorting (though you can construct essentially any query on the back end). The idea is that the parameters for the view are provided by the client. This means that you can represent any view of a collection as a simple string which can be used as a channel name; this is useful for efficiently delivering real time updates since we only want to deliver resource change notifications to views which include that resource. During writes, field names can be cheaply matched against view parameters to decide which instances of the views need to receive the notification. Only clients which are looking at an affected view right now will receive the notification.
comment 2y ago · link · parent
While unconventional today, about a decade ago when Adobe Flash was still broadly supported, many Flash websites had soundtracks. I think part of the reason why regular HTML websites didn't have them was because it was difficult to implement and internet was much slower so they had to be streamed which added to the implementation complexity.
Another reason was that web tech was evolving rapidly and conventions weren't established yet so everyone tried to use new features to differentiate their products and set the standard.
comment 2y ago · link · parent
It seems we have gone to the opposite extreme since the days of Henry Ford where he wanted to pay his workers enough for them to be able to afford the cars they made.
comment 2y ago · link · parent
Another way to style elements that are inside the Shadow DOM (from the outside) is to use the `::part(partname)` pseudo-selector, but you need to set the `part="partname"` attribute on elements inside the shadow DOM in order to allow them to be styled from outside with the pseudo-selector.
Another approach I found which is useful when building components which work with slotted template tags is to project the slotted template's content into another slotted element (e.g. a div) provided by the user the from outside. The second slotted element acts as a viewport which holds the component's rendered HTML output. So the component requires the user to provide both a <template slot="item"></template> element and also a <div slot="viewport"></div> element to project the rendered output into. I wrote a post about it:
https://dev.to/jondubois/web-components-the-template-viewpor...
comment 2y ago · link · parent
comment 2y ago · link · parent
Some unique selling points are:
- Apps are defined as declarative HTML. It's possible to build complex apps using only HTML + CSS and no back end code.
- Supports the creation of complex filters/views via a simple UI, with indexing for fast lookups.
- Collections and records update in real time.
- Efficient; real time updates only reach users who are currently looking at the affected resources/views.
- Scalable; behind the scenes, both the database and pub/sub mechanism for delivering real time updates support sharding.
- Spam prevention with rate limiting and backpressure limits.
comment 2y ago · link · parent
https://github.com/SocketCluster/writable-consumable-stream?...
It has full test coverage and is a core part SocketCluster which has almost full e2e test coverage.
To put it in perspective, the library itself is very lightweight with under 300 lines of code including dependencies (only 1 of them) and has 1.6K lines of test code...
It supports concurrent consumption/iteration by default (each consuming loop causes a new async iterator to be created implicitly in accordance with the AsyncIterator spec) but it also gives you the ability to manually create consumer streams using `stream.createConsumer()` for cases where you want to start buffering messages some time before consuming/iterating over them.
comment 2y ago · link · parent
You can build your entire app inside a plain HTML file which can be deployed online with something like GitHub pages.
I've built a few apps with it including a real-time chat app which supports both group chat, private 1-on-1 chat with an account system (with access control), OAuth via GitHub... The entire app is only 260 lines of HTML markup and fully serverless (no custom back end code). Access controls are defined via the control panel. All the app's code is in this file: https://github.com/Saasufy/chat-app/blob/main/index.html
You can try the app here (use the 'Log in with GitHub' link): https://saasufy.github.io/chat-app/index.html
Saasufy comes with around 20 generic declarative HTML components which can be assembled in complex ways: https://github.com/Saasufy/saasufy-components?tab=readme-ov-...
There is a bit of a learning curve to figure out how the components work but once you understand it, you can build apps very quickly. The chat app only took me a few hours to build.
I've also been helping a friend to build an application related to HR with Saasufy and I managed to get the basic search functionality working with only 160 lines of HTML markup.
comment 2y ago · link · parent
It lets you build just about any data-driven application using only a handful of declarative generic HTML components: https://github.com/Saasufy/saasufy-components?tab=readme-ov-...
I built a chat app with both group chat and private chat (with access control) using only plain HTML; only ~250 lines of HTML markup for the entire thing, no front end or back end code was used: https://github.com/Saasufy/chat-app/blob/main/index.html
You can use it here - All hosted on GitHub pages: https://saasufy.github.io/chat-app/
It would be great to add support for other front end tech like this. I kind of like HTMX (especially as it's declarative). This HTMZ looks interesting. I'd like something with a big community and more components to handle more advanced cases (e.g. higher level components like calendars).
comment 2y ago · link · parent
I've been working on a similar concept except as a serverless platform which updates all data in real time: https://saasufy.com/
Docs: https://github.com/saasufy/saasufy-components/#saasufy-compo...