I have a code for updating my application resources to current application version. This code is called after application update.
int version = 1002; // current app version
switch(version)
{
case 1001:
updateTo1002();
goto case 1002;
case 1002:
updateTo1003();
goto case 1003;
case 1003:
updateTo1004();
goto case 1004;
break;
case 1004:
updateTo1005();
break;
}
Here we have a cascade method calling by jumping to specified case block. I wonder - is that good practice to use go to (often considered as such bad practise!) in this case? I do not want to call method one by other - like this:
updateTo1002()
{
// do the job
updateTo1003();
}
updateTo1003()
{
// do the job
updateTo1004();
}
It there any design pattern describes such an issue?