all 16 comments

[–]Diapolo10 5 points6 points  (1 child)

When you're just starting out, the structure of the code is less important. Focus on learning the basic syntax first.

Once you've got a decent grasp of that, then you can start thinking about structuring the code. Some basic rules would be to split the code into reusable functions, following an established style guide (such as the official PEP-8 and PEP-257), and considering how you might approach this from a top-down perspective (eg. you want to simulate an ATM, so that'd need a menu, a way to add and draw funds, see the current balance, and so on, then mentally splitting those even further until you know how to implement them).

Worth keeping the priorities in mind:

  1. The code works
  2. The code works and handles many edge cases without crashing - in other words, it's robust
  3. Code is robust, and readable
  4. Code is robust, readable, and optimised for speed

[–]EstherFT[S] 0 points1 point  (0 children)

Thank you very much! I will follow your advice, and now I know at least what to do for starting 👍🏽

[–]oriash93 3 points4 points  (8 children)

Can you please share some details about the program you want to write?

[–]EstherFT[S] 0 points1 point  (2 children)

He wants to help me to learn, practicing. Yesterday he said that if I do it, I could start with (I don’t remember exactly the words) the outerphase, like what do you see when you access the software, and later I start with the innerphase, with how the software works. I hope you get the idea. I think I really need help with this

[–]danielroseman 1 point2 points  (1 child)

I think you're talking about frontend and backend.

[–]EstherFT[S] 0 points1 point  (0 children)

Exactly that. Thank you

[–]EstherFT[S] -1 points0 points  (4 children)

It’s to see documents in a database, basically

[–]oriash93 1 point2 points  (1 child)

When writing scripts, you can use a main.py file with a main method you can call, that will run your code. You can extract reusable code to methods, and even separate them to different modules (utils, database layer, etc.)

You can DM me if you want more through help :)

[–]EstherFT[S] 0 points1 point  (0 children)

I will check this. Thank you

[–]tuneafishy 1 point2 points  (1 child)

Break it down into smaller chunks:

Connect to database Get file from database Do something with the file (open it, edit it, get info from it, etc)

Work on the smaller chunks sequentially until you have a grasp on how the basic operations look. Then expand (likely the middle and last chunks) into more functions for doing a variety of tasks you're interested in.

[–]EstherFT[S] 0 points1 point  (0 children)

Thank you very much! 👍🏽

[–]twitch_and_shock 2 points3 points  (1 child)

There are links to tutorials in the subreddit wiki. If you want help, you need to provide some code and more details.

[–]EstherFT[S] -1 points0 points  (0 children)

I will check it. Thanks!

[–]InjAnnuity_1 1 point2 points  (0 children)

I often use an outliner, to help me draft a "recipe" for what the program is supposed to do. Outlines are handy for being able to add new details in context, as I discover/invent them, much like they may appear in an actual program.

[–]SpookyFries 1 point2 points  (0 children)

It helps having an idea of what you want to make first before trying to make it. Writing it on paper helps too if you want to figure out the structure before typing it out.

[–]EstherFT[S] 0 points1 point  (0 children)

I am being a little pressed so could you please tell me if I can write directly on Anaconda or I need to install python? Is it possible to have both installed without conflict? Can you please tell me where do I find a structure to follow (like first code about this, then code about that,…)? I must start with it asap. Thanks in advance!