I have been coding in python for a little over a year, and I have learned a lot and developed quite a few applications, in the process.

I do not program for my profession, I simply program recreationally. With that said, I am not exposed to new programming techniques/data structures etc., that I would be learning if my day job was in the field, for example.

I have become quite good at figuring out what I want to do by trial and error in python, and I am usually pretty successful at figuring it out!

However, sometimes when I learn something new, I will find that I was doing it the long way or with way too much code that could be much more easily accomplished with fewer lines or a technique that makes an algorithm more efficient.

When you are developing software, do you strive to find the most efficient way to do something first, or do you simply code the way you are familiar?

I don't have many programmer friends, so I have been doing this all pretty much on my own.

I watch a few twitch streams, but beside that I do not really know anyone in person.

Hopefully that adds some context why I am asking.

  • 5
    There are many goals in software development, some of which compete with each other. You have to decide which goals are the most important to you, and favor those. For example, do you prefer high performance, or code that is the most readable and clear? You can't always have both. Software developers are always under time pressure to produce, and sometimes perfection is sacrificed so that a product can ship. Jul 28, 2021 at 23:05
  • 2
    So none of us can categorically say that we always strive to produce the most efficient code, because efficiency is not always the most important goal we're trying to achieve. Jul 28, 2021 at 23:07
  • 1
    I changed the title to make it match the question body. But if the question gets reopened, I would vote to close it as a dupe of this older one: Clean readable code vs fast hard to read code. When to cross the line?
    – Doc Brown
    Jul 29, 2021 at 7:47
  • 1
    The problem with the question as written, is it's too loosely defined. By what standard is 'efficiency' measured? By which paradigm is the OP programming that is 'familiar'? @DocBrown I see the questions as fundamentally different. The other question asks when to break "the rules". In this case, the OP seeks guidance about whether it's better to just throw any old code together to make something work, or whether to fine tune it from the start. If the question is written in this context, it would be easy to cite several Agile sources as to why it's OK to do anything first, then improve.
    – S.Robins
    Jul 30, 2021 at 9:57
  • 1
    @NewCoder18, It's not really a good question in the sense that it doesn't really clarify what you are asking for, which is to understand how to write better code up front. I'll answer the question though: you are trying to run before you can crawl. Even after 30+ years of software development, I still look at old code and realise I could have done something better. If you want to master programming, you practice it constantly, and learn from others, as well as from your own mistakes. You rarely get it right first go, so you test, refactor, and improve incrementally.
    – S.Robins
    Jul 30, 2021 at 10:10

1 Answer 1


First I code something that seems like it works correctly to me.

Next I code something that seems like it works correctly to others.

I never think about performance until I’m on the second step because if I start doing that in the first step I never make it to the second step.

  • I appreciate this, very much!
    – NewCoder18
    Jul 29, 2021 at 4:00
  • 2
    You never think about performance at all before the second step? I would guess you select acceptably performant data-structures and algorithms even at the start, or it might never get off the ground anyway. Jul 29, 2021 at 11:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.