Json Parser from Scratch in C# using TDD

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • An example of writing a json parser from scratch in c# using test driven development.
    Support my Work 🤝 / raw_coding
    Buy my Courses 📚 learning.raw-c...
    Buy my Merch 🛒 shop.raw-codin...
    Join the Community 💬 / discord
    Tweet Tweet 📣 / anton_t0shik
    Tune in LIVE! 🎥 / raw_coding
    #csharp #json #parser

Komentáře • 15

  • @moke_codes
    @moke_codes Před rokem +3

    Love this kind of video. We can get a glimpse of how other devs think. It's very interesting to see where we think alike, where we don't. I learn a lot with it.

  • @jamesmussett
    @jamesmussett Před rokem +14

    I’d like to see you tackle performance optimisations and add some benchmarks, for the viewers benefit more then anything.
    I had to implement one that was quite cut down feature wise that had zero heap allocations. It was for 100Hz message logging which is well beyond what the average developer would need.
    It’s shocking how many allocations even the optimised Utf8JsonWriter does under the hood, let alone in the standard JsonSerializer.

    • @RawCoding
      @RawCoding  Před rokem +2

      can do! I think the over all point for MS team is to make the parser safe rather than fast.

    • @jamesmussett
      @jamesmussett Před rokem +1

      @@RawCoding absolutely, there’s a lot of features that you inherently can’t have without a certain amount of allocations, so I understand the reasoning.
      Unfortunately it just wasn’t suitable for my use case.

  • @TheInkSpoots
    @TheInkSpoots Před rokem +1

    Loved the video, looking forward to seeing more

  • @nove1398
    @nove1398 Před rokem +1

    Looking forward to seeing a formatted version, this gave me some ideas though. Nice sharing!

  • @7th_CAV_Trooper
    @7th_CAV_Trooper Před 6 měsíci

    At 7 minutes in I am thinking your bool test will pass if you pass "test", "tree", "trap", etc.. I'm curious to see if you fix that by the end of the video. I usually write unit tests for sad path first.

  • @natha8560
    @natha8560 Před rokem +1

    Hi there, I reaaaaally hope you see this comment because I do have a quick question: Do you consider this approach as fast as using something like IronPython and deserializing and flattening the files using Python scripts? I'm thinking of passing streams to the parser but was wondering how efficient it would be to go character by character for longer jsons. Thanks for the amazing insight and video! Also if you would like to get in touch I can also provide a CSV parser in exchange for some info, maybe you would like to make a video out of something similar

    • @RawCoding
      @RawCoding  Před rokem +1

      Hey there, I don’t quite understand your question. If you want to parse a json document I think using the built in JsonDocument is best, this is a mental exercise

    • @natha8560
      @natha8560 Před rokem +1

      @@RawCoding So instead of parsing a json document from memory, I want to parse it in the form of a memory stream and then read each character from the stream rather than the json itself. I was just wondering if the parser is efficient speed wise when it comes to large jsons let's say 8-9 mb of data. I'm also watching the Functional approach now, ty for the help!

    • @RawCoding
      @RawCoding  Před rokem

      Best use an out of the box parser otherwise you’ll need to build something your self, that parser in this video is probably pretty bad perf

  • @abuzeromohammed3386
    @abuzeromohammed3386 Před rokem +1

    What about talking about active directory logins

  • @maxymstoiakevych4139
    @maxymstoiakevych4139 Před rokem +1

    A WHAT?

  • @ahjsbkdjhavkcjhvac
    @ahjsbkdjhavkcjhvac Před rokem

    first