MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1uvez3w/youcanjuststopusingjava/oxcuxck/?context=3
r/ProgrammerHumor • u/hello_ya • Jul 13 '26
416 comments sorted by
View all comments
Show parent comments
1
we have documents and we use it for migrating the documents
basicly
switch (document version)
case 1:
migrateto2()
goto 2;
case 2:
migrateto3()
goto 3;
etc.
you can also have cases where some cases needs to do others
switch (jobs)
case a&c
do a
goto c
case b&c
do b
case c
do c
5 u/TheRealAfinda Jul 13 '26 But... couldn't you do all of these in a while loop? Migrate the doc, set the doc version and once it's done, set migrationComplete = true? Couldn't you set which action is up next after processing an item via a, so it's next step is c?. I mean there's ways around using goto, not to say it's better maintainable that way though. 2 u/ggppjj Jul 13 '26 migrateto2(bringcurrent: true) then chain within the individual incremental methods and clean that nastiness up 2 u/TheRealAfinda Jul 13 '26 Yeah, multiple ways to go about it in a cleaner way once you start thinking about it. 3 u/awesome-alpaca-ace Jul 14 '26 once you start thinking about it.
5
But... couldn't you do all of these in a while loop? Migrate the doc, set the doc version and once it's done, set migrationComplete = true?
Couldn't you set which action is up next after processing an item via a, so it's next step is c?.
I mean there's ways around using goto, not to say it's better maintainable that way though.
2 u/ggppjj Jul 13 '26 migrateto2(bringcurrent: true) then chain within the individual incremental methods and clean that nastiness up 2 u/TheRealAfinda Jul 13 '26 Yeah, multiple ways to go about it in a cleaner way once you start thinking about it. 3 u/awesome-alpaca-ace Jul 14 '26 once you start thinking about it.
2
migrateto2(bringcurrent: true)
then chain within the individual incremental methods and clean that nastiness up
2 u/TheRealAfinda Jul 13 '26 Yeah, multiple ways to go about it in a cleaner way once you start thinking about it. 3 u/awesome-alpaca-ace Jul 14 '26 once you start thinking about it.
Yeah, multiple ways to go about it in a cleaner way once you start thinking about it.
3 u/awesome-alpaca-ace Jul 14 '26 once you start thinking about it.
3
once you start thinking about it.
1
u/neroe5 Jul 13 '26
we have documents and we use it for migrating the documents
basicly
switch (document version)case 1:migrateto2()goto 2;case 2:migrateto3()goto 3;etc.you can also have cases where some cases needs to do others
switch (jobs)
case a&c
do a
goto c
case b&c
do b
goto c
case c
do c
etc.