Is rewriting a prototype good idea?

It’s more of a workflow question than coding one, but still i don’t know if i should consider rewriting my code if i’m lost in it, it’s just 3rd day of my work, and i already have this problem

Problems:

  • I hadn’t planned anything specific about the game and started prototype as messing around project with no regards to clean code or future planning whatsoever
  • My code have different casings and some unredable / not normalized names
  • I wrote most things in single script
  • I mix different methods of doing things making it very hard to work further

Those 4 are my biggest concerns, but i fear it might not be a ideal solution - if you had similar problems what would have you done?

It’s almost always better to refactor. You may learn a lot from doing that.
However if you estimate it went beyond redemption - scrap it and start from scratch.

Note that multiple major refactors of large parts of a project are in fact a normal part of development.

2 Likes

Sometimes it will bite u in the ass, but he did say prototype. So guess you’re right. But anyway, all these devs and clones, always saying they have unlimited time of one year, and that they are very fast and a talented dev then saying suddenly they want to refactor XD.

I wonder how they found out about the forums, must have been banned on reedit too and come here to troll instead :face_with_hand_over_mouth:

So you want other people to show you theirs but you’d never show them yours :smile:

1 Like

Like one of my Indian friends would say, “I think my code is plated with diamonds” :wink:

hmmm i mostly look at it from this angle - i started this as learning run, i’ve learned a lot, but now i have spaghetti and god script, and even no gameplay yet, it was all to make 50% of main mechanic

it’s not like code is unredable, it’s rather i feel friction when trying to add anything

my code is redable, but i feel i can’t add more things and develop game without touching 20 different parts of code

i don’t say code is bad, i just wonder if i feel that i have big problems with adding new things, it’s good to rewrite entire code, and yes - entire code is for now single mechanic

@StJava
please find me why it’s losing data while transfering.And yeah,these are my shameful code with comments.

func send(data:PackedByteArray):
    sock.put_data(data)

Also, @StJava Keep the place chill.DON"T USE BAD WORDS MY GUY.

Ok, where is your socket variable? Is it even initialized?

HUH?
man,it already works.But when I transfer a file from my laptop to phone,it loses or sometime gets extra junk bytes.

Nahh,StreamPeer is the MOST USED DOC IN THE PROJECT LOL

What’s the fix fr?

You did not error handle. The put_data call will return an Error enum that returns zero if the call was successful but other things if the call wasn’t successful.

Dun put ur hand in everything without wearing gloves. Basically if the call fails, u gotta take responsibility and resend the chunk and not just move on.

You knew about this based on the comments, and decided YOLO. So the code is 100% both your fault and responsibility

Read both the file access docs and the StreamPeer docs slowly… they contain the solution on how to error handle or even change the approach

1 Like

OMG Yes. Rewrite it.

1 Like

I think we being trolled. But my classmates have put such weird comments in code, and so have I, so maybe not.

I’m almost finished with my app that I’m writing. It could also be optimised compared to how it’s currently written. Given the small number of users and that the code runs fine as is I may leave it as written as a learning experience so I can start something else.

The main thing to fix would be repetitive code for a rect2 in last menu I’m coding. It’s in 2-3 functions and each time it has to check which of the 3 atlases to use. I could write a separate function to call instead.

1 Like

after all considerations, i think i’ll try to refactor my code and maybe rewrite it slowly as i go, and as usual big thx for help everyone

I found the real problem yesterday at 3 AM.The problem is (drum roll please) Windows Explorer and my Android Explorer uses diffrent kinds of byte unit :eyes:

So it means that there was no data loss.

Case solved lol.

Well,you are right. I should have done the error checking but I thoguht it will make the app slower.I wanted speed.speed is life xD

Also,this was my face when the app broke while showing it to my brother

2 Likes

rewriting prototype is a great idea, especially if the first version was you figuring out what you are doing in GDScript, once you got the workflow good, development goes really fast.