Question

Context: I'm working on an HTML 5 game without persisted state. Every time you refresh the...

Context: I'm working on an HTML 5 game without persisted state. Every time you refresh the page, you start at the beginning. People are requesting that they can start where they left off if they leave the page. I plan to implement this as Local Storage. The thing that makes apprehensive about this is a new kind of bug I'll have to consider: If you come back and there's a newer code, it may not be able to deserialize the storage.

As an example, the state when serialized may have looked like this:

{
foo: "bar"
}
But when the player tries the game next month, that field doesn't even exist anymore and has been broken up into two fields with a completely different type.

This is bound to happen, and I think I know how to fix this: I'll put a version number in the data, and when I release version y of the app, I'll have to write code to migrate from version x state to version y state. If I release version z of the app, I'll have to write code to migrate from version y to version z. I'll probably call this logic after deserialization.

But that's not what this question is about (although if there's a flaw in my approach, I'd want to hear it). What I want to know is: How do I automate something (possibly a test) that tells me when I need to write a migration script and when I need to change the data's version number?

I feel automation is the key here, because things will go very wrong if I make a mistake and remembering to change a version number / write a migration script will be the last thing on my mind when I just finished that shiny new feature I want others to see.

An interesting (but perhaps irrelevant) realization: All these issues go away if I store the data on my server in a database with a schema. That lets me confidently know that all the data is in the right state (if my schema is good). The problem with persisting locally is I lose control of the data and when it gets migrated.

This question is similar but different to this one. The difference is I'm concerned primarily with automation and s/he's not and we're using different languages (seeing how the accepted answer is a Java library, that makes it irrelevant to me).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

How do I automate something (possibly a test) that tells me when I need to write a migration script and when I need to change the data's version number?

When your automated unit tests fail while importing old data into a newer model, that's one very clear indicator that you need to write a migration script/process.

Add a comment
Know the answer?
Add Answer to:
Context: I'm working on an HTML 5 game without persisted state. Every time you refresh the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Real Life: Win-Win Problem Solving [ Silence ] [ Noises ] >> Can you be...

    In Real Life: Win-Win Problem Solving [ Silence ] [ Noises ] >> Can you be a little more quiet? I don't have class until 10 o'clock. I want to catch up on some sleep. >> Sorry to bother you. I am cleaning up last night's dinner dishes. >> Well, I wish you would do it a little more quietly. I was up late studying, >> Well if you would've washed them last night, I wouldn't have had to clean...

  • I think I can pinpoint my confusion a bit better. Here comes my updated question (I'm...

    I think I can pinpoint my confusion a bit better. Here comes my updated question (I'm not sure what the standard way of doing things is - please let me know if I should delete the old version). The major change is that I removed focus from the third question which probably is a purely mathematical question (in the notation below, it asks what properties of (M,T) together with (M,T) being consistent, forces (M,T) to be unique.). Say that a...

  • Read the following letter and help Shady Slim with hls tax situation. Please assume that his...

    Read the following letter and help Shady Slim with hls tax situation. Please assume that his gross Income Is $173,520 (which consists only of salary) for purposes of this problem. December 31, 2018 To the frlendly student tax preparer: HI·it's Shady Slim again. I just got back from my 55th birthday party, and I'm told that you need some more information from me In order to complete my tax return. I'm an open book! I'll tell you whatever think you...

  • Required information (The following information applies to the questions displayed below.) Read the following letter and...

    Required information (The following information applies to the questions displayed below.) Read the following letter and help Shady Slim with his tax situation. Please assume that his gross income is $172,900 (which consists only of salary) for purposes of this problem. December 31, 2019 To the friendly student tax preparer: Hi, It's Shady Slim again. I just got back from my 55th birthday party, and I'm told that you need some more information from me in order to complete my...

  • 52. Read the following letter and help Shady Slim with his tax situation. Please assume that...

    52. Read the following letter and help Shady Slim with his tax situation. Please assume that his gross income is $172,900 (which consists only of salary) for purposes of this problem. December 31, 2019 To the friendly student tax preparer: Hi, it's Shady Slim again. I just got back from my 55th birthday party, and I'm told that you need some more information from me in order to complete my tax return. I'm an open book! I'll tell you whatever...

  • Shady Slim / Comprehensive Deductions Problem Read the following letter and help Shady Slim with his...

    Shady Slim / Comprehensive Deductions Problem Read the following letter and help Shady Slim with his tax situation. Assume that gross income is $172,900 (which consists only of salary) and ignore AGI thresholds for purposes of this problem. December 31, 2020 To the friendly student tax preparer: Hi, it’s Shady Slim again. I just got back from my 55th birthday party, and I’m told that you need some more information from me in order to complete my tax return. I’m...

  • Barcelona Restaurant Group Summary: Barcelona Restaurant Group is always trying to attract and retain only those...

    Barcelona Restaurant Group Summary: Barcelona Restaurant Group is always trying to attract and retain only those employees who reinforce its service-oriented culture and provide top quality customer service. The manager being interviewed in the video is constantly recruiting and hiring new employees and letting low performers and poor fits go. He also tries to provide job candidates with a realistic description of the company's expectations to ensure that they know what they would be getting into if they took a...

  • Assignment 5 will be way different. It will be more like what you will receive in...

    Assignment 5 will be way different. It will be more like what you will receive in a programming shop. By that I mean that some things are built for you and others you will need to create or finish. P.S. part of your grade will include: Did you add in the required files? Did you rename your project? does your linear searches work? Did you put your code in the correct modules? did you change modules that you weren't supposed...

  • This year Evan graduated from college and took a job as a deliveryman in the city....

    This year Evan graduated from college and took a job as a deliveryman in the city. Evan was paid a salary of $68,500 and he received $700 in hourly pay for part-time work over the weekends. Evan summarized his expenses below: Cost of moving his possessions to the city (125 miles away) Interest paid on accumulated student loans Cost of purchasing a delivery uniform Contribution to State University deliveryman program $1,200 2,840 1,440 1,320 Calculate Evan's AGI and taxable income...

  • Read this article. Then write a 250 word response on two of the programs you like...

    Read this article. Then write a 250 word response on two of the programs you like the most. Open source business intelligence software 1. BIRT BIRT is an open source BI program that CloudTweaks says is often viewed as the industry standard. BIRT boasts “over 12 million downloads and over 2.5 million developers across 157 countries.” Its users include heavyweights such as Cisco, S1, and IBM (which is also a BIRT sponsor). They also have maturity going for them, as...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT