Serialize, then deserialize, vs. deserialize, then serialize: Which order and why?

Working for a new company and I'm learning how they do what they do and why they do it. I've noticed that when setting u the sorting for their grids, they sometimes DE-serialize then serialize, and sometimes they do the opposite. I have done sorting on grids before in C# but have not had to use serialization or DE-serialization so, I'm just trying to get a better understanding of when and why you would want to use this technique? If a brief summary of this can be given that will suffice, otherwise some links on why and why the order matters would be great. Thanks in advance.
LVL 1
Michael SterlingWeb Applications DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

it_saigeDeveloperCommented:
In general, Serialization is used when transmitting objects across application boundaries (a.k.a. application domains).  The recipient application is then responsible for Deserializing the object.  In most situations, the serializing application will provide a mapping of the serialized object (it is extremely rare for the serializing entity not to provide a mapping).  As I do not know the make-up of your code-base and/or network landscape, I can only guess as to their reasoning.  It is likely that the ui, api and service are separate application domains and are therefore serializing/deserializing as a matter of course.

-saige-
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndyAinscowFreelance programmer / ConsultantCommented:
I don't see why that should have anything to do with sorting.
1
it_saigeDeveloperCommented:
Neither do I Andy, but you never can tell, what if they sort in the db query rather than in the ui (silly, I know but stranger things have happened)...  ;)

-saige-
0
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

AndyAinscowFreelance programmer / ConsultantCommented:
Sorting in the DB query itself makes perfect sense.  DB's can index fields and sorting on an indexed field is very efficient (unlike sorting on unindexed fields).  But the DB drivers should take care of the grunt working in making any data available to the app in a suitable format.
1
Kyle AbrahamsSenior .Net DeveloperCommented:
Serialization is just putting things into a pre-determined format so that it can be constructed and deconstructed as need be.  You serialize (pack) the object when you're sending information and you deserialize (unpack) the object when you receive data to use in your application.

Hope that makes sense.
1
Michael SterlingWeb Applications DeveloperAuthor Commented:
I think I'm gonna close this question as I've gotten some good feedback, and thank you in advance to those who contributed. What I noticed (to your points Kyle & it_saige), is that, in the example that I've been given to model from, they are De-serializing the data into an object, and then, after sorting they serialize and put the same data into a session variable before continuing on to determine which direction to sort the column that has been clicked etc. So, Kyle/it_saige, by your explanation(s) above, they unpacked it into an object first, but then packed it [in]to a session variable which is "sending" the data to a different [storage] location. The utility that pulls the data is from a data access layer which, in this case,  is definitely a separate application domain. Would that be an accurate way to apply your explanation?
0
it_saigeDeveloperCommented:
If they are in fact sending the serialized data/packed object to another destination outside of the realm of session then yes, this is normal and your explanation would accurately express this process.

-saige-
2
Kyle AbrahamsSenior .Net DeveloperCommented:
Just to add a little more to the process:

Get data from the data layer.  Deserialze (unpack) the data so the program can sort it (the class handles how to sort its objects).  Could also work with the class as needed.  Then pack it up and throw it into memory this way the application can read it on the next post back.

FYI:  All session data must be serializable so that it can be stored in memory and re-read as needed.
1
Michael SterlingWeb Applications DeveloperAuthor Commented:
Thanks to all who contributed.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.