5 ms·
I may be missing something here, but... all that for a hit counter? Even using React for the front-end seems overkill for a little widget.
by sntran 6y ago
I may be missing something here, but... all that for a hit counter? Even using React for the front-end seems overkill for a little widget.
- tyingq 6y agoI don't see any locking either, so I imagine it misses some counts.
- tyingq 6y agoThe right way to do it with FaunaDB: https://news.ycombinator.com/item?id=24618998 https://news.ycombinator.com/item?id=24618998
- vsdvvsderer 6y agothese days the hard part isn't the view counter logic, it's managing the 395,000 dependencies in your project
- dclowd9901 6y agoI used to be “dependency-first” for library code, but I’ve noticed lately that my first question has been “why wouldn’t it be a good idea to build in house?”
- notJim 6y agoHard same. After having a few experiences where a dependency hardly does anything, my approach is to read the docs first and see if I can implement the parts I need in a couple of hours. Often I can.
- joshmanders 6y agoTwo reasons not to build in house: 1. Edge cases. You cannot possibly cover every possible edge case. This is why back in the day we had "Site works best on IE". Libraries are often used by a lot of people thus edge cases you couldn't possibly think about are covered. 2. Someone else maintains it. If your job is to build an application, why are you spending all your time maintaining a library that just facilitates your application? If I'm building a racecar, I'm not gonna make the wheels in house, let people who are better at that do that while I focus on what I do best.
- vsdvvsderer 6y agoOne reason to not not build-in house: 1. Edge cases. Chances are you do not need to cover every edge case, at least when building an MVP. It can take more time to learn a complex API than to build in house. See also premature optimization. 2. Someone else maintains it. In the event you decide to use someone's dependency and they decide to unpublish it with the click of a button.... (ok at least this one has been fixed, but API versioning can still be a bear).
- thrownaway954 6y agoi totally agree. plus the fact that he's using a DAS for storing the data. if there is one thing i refuse to do is not be in charge of my database or using something proprietary.
- gibs0ns 6y agoIt reads to me more like a sponsored blog post by the db saas mentioned in the article.
- prezjordan 6y agoThe hit counter is merely an example! I see this blog post as an intro to how-to-connect React up to a hosted database over this fancy serverless paradigm thingy.
- Royalaid 6y agoAnd more importantly this is what a lot of people are doing in industry, for better or worse, and so seeing this all laid out together is important IMO.
- reaperducer 6y agoI may be missing something here, but... all that for a hit counter? Up next, the Angular-powered guestbook in just 10k lines of code. Then stay tuned for the Go-powered e-card sender in just 50k lines of code. And then, the Typescript web ring... the cloud... using BespokeDB... and service workers... in WebASM!
- joshwcomeau 6y agoTo be clear I am not advocating switching to React in order to add a hit counter. The article is meant for folks who already have a Gatsby/Next site.