Making Existing Code Worse - Deepstash
Metaverse

Learn more about computerscience with this collection

Find out the challenges it poses

Learn about the potential impact on society

Understanding the concept of Metaverse

Metaverse

Discover 76 similar ideas in

It takes just

11 mins to read

Making Existing Code Worse

Here are a few wrong practices that usually make the code a bigger mess than what it was (not a complete list): 

  • If you Copy/Paste a code section to only change a line after that, you are simply Duplicating code.
  • If you need to use a value in multiple places, that value belongs in a configuration file.
  • When you can avoid Conditionals without sacrificing Readability, you should. The major problem with this is extending a function with a branch logic instead of introducing another function.

398

1.43K reads

MORE IDEAS ON THIS

Planning Too Much Before Writing Code

Do not look for a perfect plan before jumping into writing code. 

Look for a good enough plan, something that you can use to get started. The truth is, your plan will change, but what it was good for is to force you into some structure that leads to more clarity in your cod...

406

2.88K reads

Writing Comments About the Obvious Things

Most comments can be replaced with Better-Named elements in your code. If you are tempted to write a what comment to clarify the code, please do not point out the obvious. Remove comments like these if you have to deal with them.

Educate programmers who write comments about...

382

1.38K reads

Picking the First Solution

Your job as a professional programmer is not to find a solution to the problem. It is to find the simplest solution to the problem.

Simple means the solution has to work correctly and perform adequately but still be simple enough to read, understand, and maintain.

400

2.43K reads

Obsessing About Performance

The good rule to remember about this is: if you cannot measure the suspected performance problem with the code, do not attempt to optimize it.

If you are optimizing before executing the code, chances are you are doing it prematurely. There is also a big chance that the optimization you are ...

376

1.03K reads

Not Targeting the End-user Experience

Do not be that developer. Be one of the professional ones who put themselves in their end-users’ shoes. They imagine what the users of this particular feature need and how they might behave. 

They think about the ways to make the feature easy for the users to find and use, not about the eas...

386

967 reads

Not Questioning Existing Code

If the author of that code is long gone or cannot remember it, research that code and try to understand everything about it. 

Only when you completely understand the code you get to form an opinion whether it is bad or good. Do not assume anything before that.

377

1.19K reads

Not Understanding that Code Problems Will Cause Data Problems

An important aspect of a program is often the management of some form of data. The program will be the interface to add new records, delete old ones, and modify others.

Even the smallest bugs in a program’s code will result in an unpredictable state for the data it manages. This is especial...

380

876 reads

Not Picking the Right Tool for the Job

Everyone has their list of favorite tools to assist them in their programming-related activates. Some tools are great and some are bad but most tools are great for one particular thing and not so great for many others.

Relying on a tool’s popularity rather than how much it fits the ...

380

904 reads

Not Quitting

Don't be attached to code because of how much effort you put into it. Bad code needs to be discarded if it isn't working. If you're not happy with a solution, you'll be stuck with it.

When it comes to writing programs, the right mentality is to fail early and fail often. Th...

403

2.18K reads

Planning for the Unknown

Do not write code that you do not need today. Do not plan for the unknown future. Writing a feature because you think that you might need it in the future is simply wrong. 

Always write the minimum amount of code that you need today for the solution that you are imp...

398

1.87K reads

Not Taking Breaks

You will often be in the zone and forget to take breaks. 

Take a lot of short breaks. Leave your chair and take a short walk. Come back to the code with fresh eyes.

388

1.05K reads

Not Googling

  • Unless you are using a bleeding-edge technology, when you run into a problem, chances are someone else ran into the same problem and found a solution for it. Save yourself some time and Google It First.
  • Sometimes, Googling will reveal that what you think is a...

399

2.15K reads

23) Over-Using Shared State

Every variable we define represents a shared state. It holds data that can be changed by all elements in the same scope as that variable. 

The more global the scope is, the worse the span of this shared state. Try to keep new states contained in small scopes and make sure they do not leak u...

378

937 reads

Not Using Encapsulation

The big idea here is that you want your code to have High Cohesion and Low Coupling, which is just a fancy term that means keep related code together (in a class) and reduce the dependencies between different classes.

402

2.23K reads

Writing Code Without Planning

Writing Code Without Planning

Writing quality programs is a process with a flow:
Think. Research. Plan. Write. Validate. Modify.

One of the biggest mistakes you can make as a beginner programmer is to start writing c...

488

3.43K reads

Reinventing the Wheel

In programming, some wheels are simply worth reinventing. Programming is not a well-defined domain. So many things change so fast and new requirements are introduced faster than any team can handle.

However, if you need a wheel, do not buy a whole new car and put the car that you ar...

385

1.01K reads

Not Using the Right Data Structures

The most common data structure mistake is probably the use of lists instead of maps to manage a list of records. Using lists for scalar values is okay and often the better choice for large collections. 

Not using stacks when writing code that requires some form of Recursion...

394

1.67K reads

Obsessing About Best Practices

  • I think the term “best practices” is actually harmful. It implies that no further research is needed. Here is the BEST practice ever. Do not question it!
  • There are no best practices. There are probably good practices today and for this programming language.
  • Some of what we pr...

379

1.1K reads

Not Using Source Control

Source control is not about just pushing your changes for others to have and build on. It is a lot bigger than that. Source control is about clear history. Code will be questioned and the history of the progress of that code will help answer some of the tough questions. This is why we care about ...

377

808 reads

Underestimating the Importance of Code Quality

Never underestimate the importance of code quality. Look at coding as a way to communicate implementations. Your main job as a coder is to clearly communicate the implementations of any solutions that you are working on.

If you are not consistent with your indentation and capitalization, yo...

391

2.65K reads

Not Writing Tests

If you think you are an expert programmer, you are a newbie. If you are not writing tests in code, you are most likely testing your program manually.

There is nothing wrong with manually testing your code. However, you should manually test your code to figure out how to automatica...

388

1.27K reads

Having the Wrong Attitude Towards Code Reviews

Coding newbies often look at code reviews as criticism. Look at every code review as a learning opportunity. 

You are a forever code Learner. You need to accept that.

384

1.13K reads

CURATED FROM

CURATED BY

sarakelly

Product designer

stash-superman-illustration

Explore the World’s

Best Ideas

200,000+ ideas on pretty much any topic. Created by the smartest people around & well-organized so you can explore at will.

An Idea for Everything

Explore the biggest library of insights. And we've infused it with powerful filtering tools so you can easily find what you need.

Knowledge Library

Powerful Saving & Organizational Tools

Save ideas for later reading, for personalized stashes, or for remembering it later.

# Personal Growth

Take Your Ideas

Anywhere

Organize your ideas & listen on the go. And with Pro, there are no limits.

Listen on the go

Just press play and we take care of the words.

Never worry about spotty connections

No Internet access? No problem. Within the mobile app, all your ideas are available, even when offline.

Get Organized with Stashes

Ideas for your next work project? Quotes that inspire you? Put them in the right place so you never lose them.

Join

2 Million Stashers

4.8

5,740 Reviews

App Store

4.7

72,690 Reviews

Google Play

Ashley Anthony

This app is LOADED with RELEVANT, HELPFUL, AND EDUCATIONAL material. It is creatively intellectual, yet minimal enough to not overstimulate and create a learning block. I am exceptionally impressed with this app!

Shankul Varada

Best app ever! You heard it right. This app has helped me get back on my quest to get things done while equipping myself with knowledge everyday.

Sean Green

Great interesting short snippets of informative articles. Highly recommended to anyone who loves information and lacks patience.

samz905

Don’t look further if you love learning new things. A refreshing concept that provides quick ideas for busy thought leaders.

Giovanna Scalzone

Brilliant. It feels fresh and encouraging. So many interesting pieces of information that are just enough to absorb and apply. So happy I found this.

Laetitia Berton

I have only been using it for a few days now, but I have found answers to questions I had never consciously formulated, or to problems I face everyday at work or at home. I wish I had found this earlier, highly recommended!

Jamyson Haug

Great for quick bits of information and interesting ideas around whatever topics you are interested in. Visually, it looks great as well.

Ghazala Begum

Even five minutes a day will improve your thinking. I've come across new ideas and learnt to improve existing ways to become more motivated, confident and happier.

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving & library

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Personalized recommendations

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates