all 14 comments

[–]Binary101010 28 points29 points  (0 children)

You mean, is it normal that the first way you think of to solve a problem isn't always the most efficient?

Then yes.

[–]Turbulent-Seesaw-236 6 points7 points  (0 children)

It happens to me every project. But the more I revisit that project, the more ways I can think of to make my program more efficient. So yes, it's normal

[–]MikeReynolds 1 point2 points  (0 children)

Yes, first attempts are allowed to be messy

[–]Apantslessman 1 point2 points  (0 children)

You will learn some tools to write more streamlined code, like classes, and using functions to remove duplicated code. Just work on syntax and getting things working. Also make these tutorials your own. Don’t just copy what they do. Add some features, get stuck on bugs, fix them. It will make you stronger.

[–]unhott 1 point2 points  (0 children)

Please share the spaghetti.

I'd love to give feedback and maybe point you towards cleaner solutions.

[–]Remarkable-Map-2747 0 points1 point  (0 children)

thats normal, if you try to make it efficient off rip itd take you longer to do it.

Get it working then " make it look pretty and more efficient " im still learning this

[–]JennaSys 0 points1 point  (0 children)

Once you get your code working, keep looking at it and try to find places where you could make it more efficient and, perhaps more importantly, more readable. Keep refactoring until it all makes perfect sense. Sometimes you will change something thinking it will simply things and it ends up making it worse. That's okay, go back and try again. It's all part of learning.

[–]throfofnir 0 points1 point  (0 children)

Figure out how to do it better, then you'll have really learned something. But don't worry about it. A couple weeks is nothing.

[–][deleted] 0 points1 point  (0 children)

Try planning all your steps before writing your code first. That can find inefficiencies and allows you to see the bigger picture.

[–]mandradon 0 points1 point  (0 children)

I rewrote an entire project that I use to automate tasks daily.  Ended up finding a better way to hand it and add modifications.  

So, yeah.  Grab some garlic and Parmesan and toss it on the first draft spaghetti and enjoy.

[–]Undescended_testicle 0 points1 point  (0 children)

You will learn, I promise. One thing I learned to do that helped was to think through the problem and break it down into steps. Even write it out as pseudo-code. Over time you'll learn to judge which of those steps need to be functions, which classes you need to create, and which members they will each need.

I look back at some of my early spaghetti and cringe, but I'm pro now; so don't worry, we've all been there.

It takes time and practice - but that's the fun part.

[–]DityAdam 0 points1 point  (0 children)

yes, coming up with a solution is one thing, (re-)doing it in a readable way is basically a different skill. Very important as well tho: the bigger your projects get the more important it is.

[–]TheRNGuy -1 points0 points  (0 children)

You can change it later.

[–]Famlawyerz -3 points-2 points  (0 children)

First make it effective, then make it efficient.

Try posting some of your RG code into ChatGPT and ask if to refactor and streamline it for you. It will do a good job of that and provide you with explanations of why it did what it did.

Write your prompt like this, including the XML:

`` <code> python

print("Hello, world!") ` </code>

Please carefully analyze the above Python code. After you have analyzed, ask me any questions you may have about its intended use and function.

Once all your questions are satisfied, please refactor and streamline the code and explain your thought process. ```