#BandaDaily #1:

When #coding something, always approach the problem iteratively.

That means that as #developer you go through roughly 5 stages:

1. Make a straightforward solution
2. Cover edge cases
3. Improve the performance
4. Improve the design
5. Reduce complexity

🧵👇
1. Make a straightforward solution

It's the basis of your work: it's rough, potentially inefficient, and may not work in the edge cases.

Copy/paste here instead of creating complex reusable components.

Here's the goal to create something that actually works, but not perfect.
As a junior engineer, you should be able to come up with at least one such solution, after thinking about the problem for a while, researching, and discussing with more experienced engineers.

If you still can't, the problem requires more expertise than you currently have.
In that case, I recommend sharing it with your team and ask for help from someone who has relevant experience.

Your colleague may show how this problem is solved on a whiteboard or through pair programming.

You'll learn this way and prove to your team that you are reliable 🦸
2. Cover edge cases

Sometimes, your initial solution is already solid enough. In that case, this stage can be considered as complete.

Usually, the more experience you have, the easier for you to foresee what data / input / events /etc may not be handled properly by your code.
But even the most experienced engineers know that there's always a possibility of a missed case, bug, or some other problems.

So even if you are sure, go through your code again and try to find potential inputs / usage scenarios /etc you might have missed.
This stage is a good place to prepare tests as they'll ensure the changes at the next stages do not break the solution.

In case, you follow the TDD approach, you most likely started writing tests at stage 0, before even making a rough solution.
3. Improve the performance

Performance is important. Especially these days, when modern software is really the way to slow considering the resources available.

In #webdev it's one of the ways to improve your #SEO and ranking in the search engines. It also improves the #UX.
There's a statement credited to Donald Knuth: "Premature optimization is the root of all evil".

It's a good point and the iterative problem-solving respects this thought.

At the same time, it does not leave performance as an optional feature you'll add up (maybe) another day.
Most likely, if you treat the performance this way, your code (and the product) will always have a relatively poor performance.

Instead, I recommend you optimizing your code as part of the iterative coding process and not as a "fair weather feature".
You can see, there's a thin edge between premature optimization - when you try to make your code fast as early as possible - and optimization ignorant code - when you move performance optimization to the moment that it's already many days as shipped to the production.
In this stage, you often don't need to apply advanced algorithms and complex data structure knowledge.

Often it's more simple concepts: For example, in #javascript, if you traverse an array many times retrieving something - it may be more optimal to use a Map or an object.
Or if you fetch() data from multiple endpoints consequently, you can remove blocking and speed up the perceived performance by using concurrency with Promise.all().

Many optimizations are relatively trivial, honestly, and are learned rather as good practices than algorithms.
4. Improve the design

The design part is 2 slightly different things:
- Refactoring: improving naming, restructuring / reorganizing code, reducing duplication (if that's appropriate) 😉
- Applying design patterns
Refactoring is necessary most of the time - or the code quality will drop.

While applying design patterns often make sense only in subsequent iterations - do not try to apply them until you see that problem repeats a few times.

Otherwise, you'll add unnecessary over-engineering
5. Reduce complexity

I put this as a separate stage as engineers often forget (we r included) while in the pursuit of writing the most sophisticated code possible that:

"Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away"
Before finishing the solution, we need to make sure that we made it simple and pragmatic enough to be

1. Readable - we are reading the code magnitudes more than we write code
2. Maintainable - in my practice, we work over existent code more than we write new (bugfixes, updates)
So even if you skip the design improvements always take a look at your code from the perspective of future months.

Will you understand it? Is it clear enough? Is something implied I know now and may forget later?
That's it.

Apply this approach to your daily development work, whether it's #frontend, #backend, #mobile, or anything else, and your work will be appreciated by everyone: your users, your colleagues, and even your future self 😉
@threadreaderapp unroll, please 👍

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Banda Works

Banda Works Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @BandaWorks

6 Oct
Have had a chance to read a great article by @dangoslen:
levelup.gitconnected.com/my-biggest-mis…

The lessons he learned at the beginning of his #SoftwareEngineer career are quite similar we've encountered on our path and put as principles for junior #developers.

What are those principles? 🧵
Principle #1: Don't listen to your ego — talk to your team

Stop caring about your thoughts of what other people might think about you. It shouldn't matter to you.

Always talk to your team when you are in trouble, share your thoughts, get answers/help, and continue growing.
Principle #2: Be braver — say (nonsense) aloud

A similar one, but still quite different: if you get an idea or thought - say it aloud during tech meetings, discussions, one on ones and so on.

Doesn't matter how bold it is - don't hold it back. Say, get feedback, and move on.
Read 10 tweets
6 Oct
- Why are you doing #frontend projects?
- To practice #webdev
- Okay, why do you practice web dev?
- To land a dev position in a #tech company or startup
- Why do you need to land a dev position?
- I see. I want to secure my family's future.

🧵to remind you of the reasons:
One day, everyone who is going through the path of becoming #developer, experience this unsureness.

We feel unmotivated, tired, and somehow #anxious.

We may feel afraid of a lot of requirements out there to get a job.

We may have trouble in our personal life.
Honestly, there may be a lot of reasons for us to experience the decline.

There are many recommendations people give in that case:
- Take a break for a few days
- Change the location: e.g. get from home to a coffee shop (like Starbucks) and practice there
- Find a coding partner
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!