对象已移动

可在此处找到该文档 5 bad coding practices that make other developers hate your code – New Self New Life
New Self New Life
No Result
View All Result
  • Home
  • Entertainment
  • Celebrity
  • Cinema
  • Music
  • Digital Lifestyle
  • Social Media
  • Softwares
  • Devices
  • Home
  • Entertainment
  • Celebrity
  • Cinema
  • Music
  • Digital Lifestyle
  • Social Media
  • Softwares
  • Devices
New Self New Life
No Result
View All Result
Home Softwares

5 bad coding practices that make other developers hate your code

by admin
4 years ago
in Softwares
5 bad coding practices that make other developers hate your code
Share on FacebookShare on Twitter


Wait, what? BAD coding practices? Sure, you’ve learn accurately. The web is stuffed with good recommendation and tutorials for builders already. You will discover some even on this weblog. This text will completely be completely different although – sorry. However wait, I’ll present you one thing even higher! It’s 5 cardinal sins you may commit in your code. These unhealthy programming practices are so evil that each developer will hate your work. Are you able to possess this secret information? Come alongside then.

Dangerous coding practices no. 1: Flip naming right into a riddle recreation

bad coding practices

Let’s heat up with one thing straightforward. For a superb begin, add some additional abbreviations to your variable or operate names. 

I do know, I do know – it’s good follow to make all of the names as descriptive as doable, proper? Like handleFormSubmit, getUserConfiguration or parseCustomerInformation. However we’re not right here to do a superb job. 

For unhealthy outcomes, at all times shorten and abbreviate the names as a lot as doable, so the subsequent developer working in your code must guess what you have been fascinated by. 

Names like handleBtnClick, getConfig or parseInfo are good informal examples. They don’t reveal an excessive amount of what the capabilities are doing however you may nonetheless run with it throughout code opinions. And pointless abbreviations like btn, func, config or cb make it even tougher to grasp.

You are able to do a lot extra with variable names! Have a listing of unconfirmed customers? Don’t name it uncofirmedUsers, simply named it customers. The following developer must learn the WHOLE code that returns the variable to grasp what’s in it. No discountedProducts for that poor soul, as a result of the product’s identify continues to be true and sufficient.

So as to add just a little spice to the names you may at all times play with the casing, and I assure the co-workers will hate your guts for that. As an alternative of making eg.: a readXmlDocument as the great practices suggest (abbreviations must be formatted like common phrases) you may make a readXMLDocument methodology that can require the opposite builders to look carefully and skim the identify extra rigorously to totally perceive it.

In fact, all of this insanity will be stopped throughout a code evaluation however your job is to struggle for it. Possibly since you’re too lazy to repair it, or perhaps since you want your troublemaker persona to keep up. A method or one other, bear in mind you may at all times promise to alter it with the subsequent pull request hoping everybody will forgive and overlook your sin (and possibly they’ll do).

Dangerous coding practices no. 2: Write very difficult code

bad coding practices complicated code

Right here you’ll have a chance to show you’re a Rick Sanchez of software program growth. 

You simply want to jot down your code in a bit extra difficult method than it must be. 

Possibly you could find some generalisation that can permit you to reuse three strains of code in two locations by creating a way that accepts 5 parameters? Possibly you may cut back three strains of code into one through the use of a intelligent triple nested ternary operator? Your creativeness is the restrict! 

In fact, it should make the appliance tougher to learn and preserve however that can most likely be your coworkers’ drawback, proper? Wonderful!

So give it a go and write a code that proves you’re an actual hacker. I recommend you employ chained capabilities, nested conditional statements, over-bloat design patterns and intelligent one-liners that use area of interest hipster options of the language you write in. As a result of why write Date.now() if you are able to do the identical factor with a bit extra cryptic +new Date()? I’m positive your colleagues from the venture will thanks for it when they may spend time making an attempt to grasp what the heck is occurring within the code.

And bear in mind: the extra the code is overengineered and early-optimised the extra you’ll make your coworkers battle with it. You get 10 respect factors for utilizing a cut back operate and 100 factors for making a recursion name. By the top of the venture, that can make you an actual professional coder, congrats! 

 

bad code practices dependencies

I perceive that the aforementioned approach will be laborious to push via code evaluation. However should you’re an online developer writing in JS or PHP, you will have many import/use clauses on the highest of virtually each file. Lots of builders don’t test it throughout code evaluation as a result of they scroll on to, what they assume, is the meaty half. 

That’s why the dependencies are an ideal place so that you can invite horrors to make themselves comfy in your code. 

Think about you will have some UserSubscriptions view in React. Create a file with a helper operate calculateTimeToSubscriptionEnd. Nice. Now the place it is best to put this file? In a separate listing that shops all of the area logic associated to subscriptions or funds? Pff, after all not. Higher put it subsequent to the view you simply created! 

It’s considering forward as a result of when you’ll lastly make the admin panel (and the Subscriptions view there), nothing stops you from importing the helper operate from the person views. And possibly nobody will discover it, as a result of virtually nobody checks the imports record. This manner you’ll couple two unrelated modules and make hell for builders who will ever attempt to change one thing or refactor the code. And belief me, nothing makes builders crazier than a really structured venture. 

I hear you say, “This doesn’t appear like an enormous impediment”. Much less skilled builders could not repair this for a very long time. They’ll battle with the mess they’ve discovered, considering it’s essential to maintain it as it’s. It would harm them EVERY SINGLE TIME when a brand new developer tries to grasp the appliance construction. Will probably be much more triggering when the devs replace or delete one thing associated to that operate. A bit of mess that hurts everybody till some hero will repair it. Possibly it may even be you sometime?

bad coding practices functions

Do you think about your self a inventive, inventive soul? Right here’s your new favorite torture methodology. 

The world is unpredictable and nobody’s ever stated that every little thing should work the identical method. Additionally, nobody ever stated that consistency and predictability are the keys to an ideal developer expertise or profitable venture. Effectively, many individuals proclaim that, however we don’t take heed to them at present, OK? 

We’re right here to wreck somebody’s day is by making comparable capabilities within the codebase behave a bit in another way.

For instance, you could have some validation capabilities that return true when the information is legitimate and the string with an error message when one thing isn’t fairly proper. What if the subsequent validator your add will return false or undefined when the handed worth is right? That can break somebody’s plans to jot down a really clear type dealing with. Good… 

You may as well settle for arguments of completely completely different shapes in each operate. Like within the meme above. Let’s a few of them settle for the person ID however others the entire customers object (even when they want the ID solely). Or perhaps you’ll find a approach to settle for the customers’ emails? That will likely be a large killjoy for the subsequent developer that must work on that code.

I wager you may include even higher methods to shock different builders, so why not make every little thing unpredictable. Drop consistency! Lengthy stay the randomness! Additionally, by no means take into consideration the massive image of the venture’s codebase, give attention to including a little bit of enjoyable to each single file individually. In different phrases: don’t be an engineer, be an artist! I assure you that different builders will hate that from the underside of their hearts. However that’s clearly since you’re so forward of your time.

bad programming practices meme squirtle

Pull this off and nobody will ever need to work along with your code ever once more. 

Don’t separate any frequent logic into completely different capabilities, lessons or parts. Simply copy the strains your want between information. 

In any case, your code is ideal and essential, so let’s make everybody see it a number of occasions all through the entire venture. Let it shine!

However you see, that’s not the one good cause for duplicating the code. In case of any updates, it should pressure builders to make modifications in lots of information without delay. What’s higher, somebody could (and possibly will, if there are usually not sufficient exams within the venture) miss a number of occurrences of the copied logic and will likely be pressured to do a second and even third repair. And what’s extra enjoyable than looking out for a similar code in hundred information of the venture’s codebase? I wager your coworkers will adore it.

Do not forget that making a superb abstraction is tough and time-consuming so it is best to at all times skip doing it and replica the code the place it’s wanted. Your code reviewer will perceive this. If not, then you may spend the time you saved explaining why it’s essential to make extra copies of your valuable code. You are able to do it, I imagine in you!

bad programming practices

This text is clearly a joke. Don’t do the issues I described above. For actual, it’s not a “maintain my beer” wager.  

Simply do every little thing the opposite method round:

  • hold naming in your code descriptive and clear, 
  • make your code easy and comprehensible to all people,
  • preserve a clear venture construction, 
  • always remember to jot down constant and predictable interfaces, 
  • separate frequent logic at any time when it’s doable with out shedding the code readability. 

Oh, and by no means be imply to your colleagues. EVER!

There’s a saying within the growth neighborhood that it is best to at all times write your code like the subsequent developer that comes after you is a serial killer. You don’t need a killer to hate you, do you? I don’t like this angle. 

I feel it is best to at all times write your code like the subsequent particular person engaged on it’s… your self. 

Subsequent time you’re actively coding, simply ask your self: “Would I be joyful seeing these strains after I’ve lengthy forgotten what they do”?

Wanna see how I ruined my JavaScript code and nonetheless received the coding problem? ?

As you may see, I’m all about humour in software program growth. For those who’re curious about extra anti-tutorials, be certain to test this madness out!



Source link

Tags: BADcodeCodingDevelopershatePractices
Previous Post

Khloé Kardashian Shares Super-Rare Photo With Beloved Bro Rob Following Birthday Celebration!

Next Post

Fintech Startup Slice Raises $20 Million From Gunosy and Blume Ventures

Related Posts

How agile is your crypto? Interview study explores opportunities and challenges of cryptographic update processes
Softwares

How agile is your crypto? Interview study explores opportunities and challenges of cryptographic update processes

by admin
August 12, 2025
This week in AI dev tools: GPT-5, Claude Opus 4.1, and more (August 8, 2025)
Softwares

This week in AI dev tools: GPT-5, Claude Opus 4.1, and more (August 8, 2025)

by admin
August 9, 2025
How Agentic AI Powers Webkul eCommerce Marketplaces
Softwares

How Agentic AI Powers Webkul eCommerce Marketplaces

by admin
August 11, 2025
RubyGems malware campaign steals passwords
Softwares

RubyGems malware campaign steals passwords

by admin
August 8, 2025
Will AI Replace Software Engineers? Detailed Overview
Softwares

Will AI Replace Software Engineers? Detailed Overview

by admin
August 6, 2025
Next Post
Fintech Startup Slice Raises $20 Million From Gunosy and Blume Ventures

Fintech Startup Slice Raises $20 Million From Gunosy and Blume Ventures

YouTube Launches 4K Plus and New Features for Sports Fans on YouTube TV

YouTube Launches 4K Plus and New Features for Sports Fans on YouTube TV

  • Trending
  • Comments
  • Latest
More than 400 Canadian artists sign letter denouncing ‘anti-trans’ policies

More than 400 Canadian artists sign letter denouncing ‘anti-trans’ policies

April 1, 2024
Taylor Swift’s ‘Eras Tour’ movie: How and when you can stream in Canada – National

Taylor Swift’s ‘Eras Tour’ movie: How and when you can stream in Canada – National

November 27, 2023
Anne Heche to be taken off life support after compatible organ recipient found – National

Anne Heche to be taken off life support after compatible organ recipient found – National

August 15, 2022
Robert De Niro shows up to troll Donald Trump outside hush-money trial – National

Robert De Niro shows up to troll Donald Trump outside hush-money trial – National

May 29, 2024
Greyson Chance says Ellen DeGeneres ‘abandoned’ him, calls her ‘manipulative’ and ‘opportunistic’ – National

Greyson Chance says Ellen DeGeneres ‘abandoned’ him, calls her ‘manipulative’ and ‘opportunistic’ – National

September 26, 2022
Jacklyn Zeman, longtime ‘General Hospital’ actor, dies at 70 – National

Jacklyn Zeman, longtime ‘General Hospital’ actor, dies at 70 – National

May 11, 2023
Mike ‘The Situation’ Sorrentino saves 2-year-old son from choking in home video – National

Mike ‘The Situation’ Sorrentino saves 2-year-old son from choking in home video – National

February 5, 2024
R. Kelly hospitalized after prison overdose, his lawyers allege murder plot – National

R. Kelly hospitalized after prison overdose, his lawyers allege murder plot – National

June 18, 2025
Breaking Bad Is Secretly A Prequel To The Walking Dead: Wild Fan Theory Explained

Breaking Bad Is Secretly A Prequel To The Walking Dead: Wild Fan Theory Explained

August 13, 2025
Chance The Rapper Opens Up About Co-Parenting After Divorce

Chance The Rapper Opens Up About Co-Parenting After Divorce

August 12, 2025
Samsung Galaxy S26 Ultra: 6 Key Updates Revealed

Samsung Galaxy S26 Ultra: 6 Key Updates Revealed

August 12, 2025
Taylor Swift new album Easter Eggs: All the TS12 hints we missed leading up to The Life of a Showgirl announcement over the years including a ‘showgirl’ clue back in 2022 with Dita Von Teese

Taylor Swift new album Easter Eggs: All the TS12 hints we missed leading up to The Life of a Showgirl announcement over the years including a ‘showgirl’ clue back in 2022 with Dita Von Teese

August 12, 2025
Living with the Coway Bidetmega 500S: Comfort, Hygiene, and Daily Luxury

Living with the Coway Bidetmega 500S: Comfort, Hygiene, and Daily Luxury

August 12, 2025
LinkedIn Shares Strategic Insights for B2B Marketers [Infographic]

LinkedIn Shares Strategic Insights for B2B Marketers [Infographic]

August 12, 2025
August 8-10 Box Office Recap – ‘Weapons’ debuts with a fantastic $43.5M domestically and $71.8M worldwide, and getting an "A–" on CinemaScore, rare for a horror. ‘Freakier Friday’ debuts with a solid $28.5M domestically and $43.8M worldwide. ‘Fantastic Four’ crosses $400M, but it’s fading quickly.

August 8-10 Box Office Recap – ‘Weapons’ debuts with a fantastic $43.5M domestically and $71.8M worldwide, and getting an "A–" on CinemaScore, rare for a horror. ‘Freakier Friday’ debuts with a solid $28.5M domestically and $43.8M worldwide. ‘Fantastic Four’ crosses $400M, but it’s fading quickly.

August 12, 2025
Prince Harry, Meghan Markle extend multi-year Netflix deal – National

Prince Harry, Meghan Markle extend multi-year Netflix deal – National

August 12, 2025
New Self New Life

Your source for entertainment news, celebrities, celebrity news, and Music, Cinema, Digital Lifestyle and Social Media and More !

Categories

  • Celebrity
  • Cinema
  • Devices
  • Digital Lifestyle
  • Entertainment
  • Music
  • Social Media
  • Softwares
  • Uncategorized

Recent Posts

  • Breaking Bad Is Secretly A Prequel To The Walking Dead: Wild Fan Theory Explained
  • Chance The Rapper Opens Up About Co-Parenting After Divorce
  • Samsung Galaxy S26 Ultra: 6 Key Updates Revealed
  • Home
  • Disclaimer
  • DMCA
  • Privacy Policy
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2021 New Self New Life.
New Self New Life is not responsible for the content of external sites. slotsfree  creator solana token

No Result
View All Result
  • Home
  • Entertainment
  • Celebrity
  • Cinema
  • Music
  • Digital Lifestyle
  • Social Media
  • Softwares
  • Devices

Copyright © 2021 New Self New Life.
New Self New Life is not responsible for the content of external sites.

New Self New Life