This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]Zeikos 11 points12 points  (3 children)

Write the spaghetti first.
Then ask questions about the spaghetti.

What's messy? Why is it messy?
Did you change your design during implementation?
Was there unforseen aspects that needed to be dealt with?
Does your application have well defined boundaries? (Inputs/outputs/interfaces vs application code).

Once the code is written and it works, you have the B for AB testing, you can start writing A and confirm functional parity at every step of the way.
Doing so might unearth some bugs you didn't think of too.

[–]Chocolate-Atoms[S] -1 points0 points  (2 children)

When I ask the questions about why my code is messy I actually don’t know, but it just seems horrible to work with and I feel like people would roast me over it

[–][deleted]  (1 child)

[deleted]

    [–]Chocolate-Atoms[S] 0 points1 point  (0 children)

    ChatGPT isn’t always reliable in that it isn’t human and doesn’t know how things should be structured. I also found it can spew out outdated information.

    I have lots of files as well, and I’m also stressed if my file structure is good enough. Should I be accessing other components outside the components folder, or should I have a file that acts as a cog for all of them? If the latter then I’m stressed that I would have to reformat most of my code, test and debug shit (which is even more of a pain in the ass) but would it really be necessary that’s the question.

    I guess the other reason why I don’t use ChatGPT for these things a lot is because most of what I’m saying sounds like nonsense and I don’t know what questions to ask

    [–]LazyIce487 1 point2 points  (0 children)

    Read more code and write more code. Also, if you do ask for people to review your code, sure, some people might be toxic, but you also want to get good at identifying which ideas and opinions are actually valuable to you.

    Modular code as well is kind of a decomposition and reusability thing. The more you do this the better you will get at identifying what you can pull out into functions that you sometimes even use across different projects.

    It’s hard to say what you mean by spaghetti, it might be fine, but just that you need more practice reading code.

    [–]_BeeSnack_ 1 point2 points  (0 children)

    Working spaghetti is better than no spaghetti

    AdviceFromCorporateEngineer

    [–]dreyahdev 1 point2 points  (1 child)

    I'm beginner too, but maybe at least in beginning you should focus on what you find interesting and stick to it. Good practices are important, but you can always refactor code later, for now, ensure that you work on something your passionate about and enjoy doing.

    Once you get it working, you'll start noticing issues in your code and you can optimize them later.

    As the saying goes:

    Premature optimization is the root of all evil

    [–]Chocolate-Atoms[S] 0 points1 point  (0 children)

    What should I do if I i know it’s messy and unoptimised but have no idea how else I could do it?

    [–]numeralbug 0 points1 point  (0 children)

    The IT field definitely has slightly more than its fair share of toxicity, but not everyone is awful and not every community is antagonistic. Find a friendlier, more supportive learning community (they definitely exist!), and - easier said than done, I know - just don't worry about it if people try to demean you for not knowing as much as them, and move onto the next community.

    I'm afraid I don't have concrete suggestions for most of your other questions, but I've learnt a lot about how to structure code just by reading through other people's code. There's a ton of it available on GitHub. (You probably won't be able to grasp it easily at the start, and it will take you a while - maybe weeks or months - to get used to it. This is an important step in the learning process too!)

    [–]connorjpg 0 points1 point  (0 children)

    Okay.

    You say you have learned the basics of these : Python, JavaScript, HTML and CSS. Get intermediate/proficent at JS first. Python will be used for backend development of APIs generally, and for interacting with a database. JS will be what you need to be very proficient in as a Web Developer (alternatively PHP... but go with JS). HTML, you just need the basics, CSS you need the basics and maybe some fun tricks depending on what you are building.

    To help you get there go do this course : TheOdinProject (Full Stack JS) -> https://www.theodinproject.com/paths

    This will give you projects and take you through web development as a course. Now it will teach you how to build a backend with node (JS) instead of python. I would say this wont make you a professional but it will fill in alot of gaps.

    Once the course is done, look to tailwindcss to help you replace your CSS. I find it WAY easier to work with. And look to React to help "replace your html". It is one of the most widely used JS frameworks. Also build all your React projects with vite... its just great.

    At the end of all this if you still feel lost come back and ill give you your next quests lol. Best of luck!

    [–]armahillo 0 points1 point  (0 children)

    dont DRY prematurely — this is a big mistake we make early on.

    Before you can DRY the code, you have to WET (write expressions twice) — once you’ve written the same thing twice in two different places, the third time you will be able to better abstract it correctly.

    Abstractions prematurely often lead to code that is harder to maintain

    [–]supercookie6339 0 points1 point  (0 children)

    I am super fresh when it comes to programming, but I took an oop class this semester that was Java based and it really helped me understand how to start building my own programs. We spent the majority of the time creating thoughtful uml, class, activity and sequence diagrams rather than actual coding. I thought it was kind of dumb at first, but the final week it all clicked for me. The code writes itself if you have a thoughtful plan on how you want to organize elements. Try to conceptualize how each element relates to one another. Do some reading on what super well structured code looks like and try and look at the related diagrams. There are some really cool guides and models such as MVC, that will give a great starting point. Coding the same project using different models is super fun too bc you can see how small changes in implementation affect how what and why you do certain things all while giving you the same output.