Skip Navigation
Help needed in structuring DatabaseProxy classes following SOLID principles in TypeScript
  • Hello. Appreciate your question. I think that this is a good use case for the Repository Pattern.

    Image describing the Repository Pattern

    In your case, this might look something like this:

    • TicketRepository, ScheduleRepository and TimerRepository interfaces which have their functions like create(), read(), update(), delete(), complexQueryByManyParams() etc. All your domain code should expect and operate on these interfaces.
    • FirebaseTicketStore, FirebaseScheduleStore, FirebaseTimerStore classes which implement the respective interfaces. All your logic that relates to Firebase should be encapsulated here.
    • You can later safely do things like swap out a FirebaseTicketStore with a MysqlTicketStore

    You can consult the Design Patterns / Gang of Four book for more details

    Off topic, but personally I don't feel you should worry too much about having to change the database in the future. I have rarely seen it happen in my career.

  • [CURRENT PROBLEMS] Registration not possible, registration emails do not go out / Slow DATATERM with crashes
  • https://www.crowdsec.net/

    You can look into this or fail2ban to get functional limiters running up and running quickly. If you go with crowdsec, i would suggest to use the cs-firewall-bouncer which will drop bots at the firewall level.

  • A Brief, Incomplete, and Mostly Wrong History of Programming Languages
  • 2012 - Anders Hejlsberg discovers some mushrooms growing from the base of his bathtub. After consuming them, he has a revelation that C# needs more Javascript. He invents Typescript. Typescript is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Microsoft loudly heralds Typescript's novelty.

  • A Brief, Incomplete, and Mostly Wrong History of Programming Languages
  • Extra fun fact for comment reading friends: This post is the origin of the meme "Monads are just monoids in the category of endofunctors. What's the problem?" Source

  • james-iry.blogspot.com A Brief, Incomplete, and Mostly Wrong History of Programming Languages

    1801 - Joseph Marie Jacquard uses punch cards to instruct a loom to weave "hello, world" into a tapestry. Redditers of the time are not imp...

    An absolute classic. One of my favourite parts:

    >1987 - Larry Wall falls asleep and hits Larry Wall's forehead on the keyboard. Upon waking Larry Wall decides that the string of characters on Larry Wall's monitor isn't random but an example program in a programming language that God wants His prophet, Larry Wall, to design. Perl is born.

    6
    PineTime - a $27 smartwatch that runs open source firmware and software that's easy to flash and easy to modify and tinker with
  • This makes me sad because it's not available in my country "for logistical reasons", and it seems to be just what I wanted

  • Does Lemmy really benefit from Rust? Is code execution speed the bottleneck?
  • Hear me out, but I believe that using Rust holds Lemmy back.

    Writing Rust code is difficult, and fairly time consuming. It's difficult to get right, and as other commenters have noted, Lemmy code seems to do a lot of things for the "hype factor" (like Websockets). It's difficult to find enough devs as well.

    The article about Discord switching to Rust from Go in the top comment is misleading in my opinion. They totally rearchitected their service while rewriting it, so it's an apples to oranges comparision.

  • findthatmeme.com Image Stacks and iPhone Racks - Building an Internet Scale Meme Search Engine

    Anyone who’s spent any amount of time on the Internet has a good idea of how prevalent meme usage has become in online discourse. Finding new memes on the latest happening and sharing them with various friend groups to share in the humor is a long-enjoyed pastime of mine. Working in tech and in the ...

    0
    Small adjustments on the theme
  • Theme's looking great <3

  • Caddy > Traefik > NPM
  • Caddy is great, I've been using it for all greenfield projects.

    P. S. Have you checked out the Caddy API?

  • How is lemmyworld so stable?
  • I work on nginx cache modules for a CDN provider.

    While websockets can be proxied, they're impractical to cache. There are no turn key solutions for this that I'm aware of, but an interesting approach might be to build something on top of NChan with some custom logic in ngx_lua.

    I agree with you that web proxy cache's aren't the silver bullet solution. They need to be part of a more holistic approach, which should start with optimizing the database queries.

    Caching with auth is possible, but it's a whole can of worms that should be a last resort, not a first one.

  • Just need a Cyberdeck to access the DATATERM

    Source: https://www.hackster.io/news/raspberry-pi-powered-virtuscope-cyberdeck-looks-plucked-from-the-pages-of-neuromancer-398a28c2c887

    4
    Reddit Wave and the Threadiverse
  • I came today from Reddit. Think i'm here for good. This feels magical.

  • Stack Exchange Moderators Going on Strike
  • Revolution is in the air?

  • Places to go to learn Linux administration
  • Back in the day, we used to have "post2host" forums, where you could get VPS servers for free just by being active in the forum. That's where I cut my teeth on Linux!

    Without that, 10 years ago, I would not have my career today. I am thankful.

  • Places to go to learn Linux administration
  • This! Selfhosting your own small apps is the best way to get practical, hands on experience with Linux administration.

  • Domain Knowledge or a lack thereof
  • This is a good take. All of programming is ultimately just tools to solve a problem, and if we don't have domain knowledge, we can't effectively solve the problems that we set out to in the first place.

    Really hit the nail on the head about the "invisible decisions" which happen like the quality vs quantity with sails.

  • Gotta love the dithering on the DATATERM cover art
  • The cover art is so beautiful <3

  • ChatGPT Changed How I Write Software
  • I've been using ChatGPT at work quite a bit now. Some of the things I've used it for are:

    1. Writing a shell script that scrapes some information about code modules and shows them neatly
    2. Minor automation scripts that setup and make my day to day docker workflow easy
    3. Writing random regex, sql, lua pattern matching functions
    4. It turned out to be surprisingly good at creating code examples for certain undocumented APIs (kong.cache, kong.worker_events, kong.cluster_events) in Kong API Gateway.
    5. Copy pasting a rough python automation script, converting it into Go, and adding it in the application itself.

    I still don't feel comfortable using it for anything big.

  • yourstruly Yours Truly @dataterm.digital

    Self-taught software developer (he/him)

    Posts 4
    Comments 18