❔ Can someone explain to me what serialization and deserialization means?

Hello guys, I watched some tutorials on this concept, but they're using JSON data and didn't quite understand it.
33 Replies
Thinker
Thinker2y ago
You know what objects are, right? They're in essence just pieces of data
The king of kings
Definitely I do OK
Pobiega
Pobiega2y ago
Serialization => turning an object into a string or bytes Deserialization => turning a string or bytes into an object its very way common to save objects, or send them to another program
The king of kings
Aha! But guys, what is the goal of this? Objects are instantiated from classes and we use them to pass arguments for our ctor.
Pobiega
Pobiega2y ago
objects is how you move data around a good example is getting data from the internet if Thinker here makes a cool api that I can use to get information about pokemons for example, I can make a request to that and he sends me a lot of JSON back I can then deserialize that JSON into an object
The king of kings
For example, I'm importing data from a text file and then I need create books by instantiating objects, where is the role of these concpets in this scenario?
Pobiega
Pobiega2y ago
you are essentially doing deserialization but you are doing it the manual way, since the data in your text file doesnt follow an established format (like JSON, XML, YAML etc)
Thinker
Thinker2y ago
And the benefit is that it doesn't matter what programming language Pobiega is using, the text sent back is just a string which can be deserialized however you want.
Pobiega
Pobiega2y ago
and since we are using a standard format (JSON), anyone can very easily understand how it works most if not all programming languages can easily ser/deser to/from json these days
The king of kings
Aha! Ok! I almost got the idea. That's why I see many people talk about JSON here in the c# server.
Pobiega
Pobiega2y ago
yes, its the most common format these days and its the default language for the web here is some examples https://dummyjson.com/products/1 https://dummyjson.com/products/search?q=Laptop
The king of kings
So this applies perfectly to my case by reading data from text file + importing them + access them by indices + turning them into objects like books, am I correct?
Pobiega
Pobiega2y ago
no because your file isnt in JSON format
The king of kings
No, it's not actually. It's just a text file data written.
Pobiega
Pobiega2y ago
yeah, I know. And thus, you can't use a json deserializer to read it because a json deserializer only reads json. an xml deserializer only reads xml. etc
TheRanger
TheRanger2y ago
your format can be called Triple Hash separated values 😄
Pobiega
Pobiega2y ago
we already joked about it being the "THSV" format in the old thread 😄
The king of kings
😆 yeah you could call it like that. Hahaha
Pobiega
Pobiega2y ago
there is an older format called "CSV" which stands for "comma separated values" which is why it was "funny"
The king of kings
Oh! Some wrote this to me, I remember and I had no idea what it means. Ok I guess I will learn more about these two concepts more deeply when I get in touch with database and JOSN 😁 God, all the time I meet new stuff and never ends like encapsulation, polymorphism and now these two.
Pobiega
Pobiega2y ago
This is programming. There are always new things to learn
The king of kings
😄
Pobiega
Pobiega2y ago
you will never learn it all. thats just reality. so you pick the topics that are relevant to you and your path I do very little lowlevel programming, and I actively avoid frontend web development and graphics programming
The king of kings
It makes it fun to adventure through programming like if we had only c# fundamentals, it would've been very boring, so these stuff adds fun to it. Really! So you mean you're working mostly backend like database stuff?
Pobiega
Pobiega2y ago
My full time job is all backend work yes but its much much more than just databases
The king of kings
Really! OMG I don't wanna hear any complex stuff, I get afraid that I won't understand them 😆
Pobiega
Pobiega2y ago
the backend is usually responsible for all/most of the application logic. the frontend is for showing the data and collecting input neither of these is "just" thou, they are both big complicated fields
The king of kings
Ok! Interesting to collect these informations. But you get to pick either one and worry about one field instead of full-stack development.
Pobiega
Pobiega2y ago
Yes Full-stack is... very complicated. I have met very few good full-stack developers who knew both domains well instead you usually see fullstack juniors who just know the basics of both and use that to find a job that later specialize them
The king of kings
Aha! Ok! Yeah! I can imagine how complicated this mission is in a career level particularly. But I think many people learn at work than setting home and read books, watch tutorials. Work place teaches you practically how to do stuff, just like you showed me on the live screen 😁
Pobiega
Pobiega2y ago
yes and no you learn a lot at work ofc, because you are there for ~40 hours a week but at a job they will expect you to learn FAST. Like, very fast.
The king of kings
Really! Like learn and then apply what you have learned ride away without spending too much time on a single problem, right?
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?