对象已移动

可在此处找到该文档 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

Developer beats AI in coding battle
Softwares

Developer beats AI in coding battle

by admin
July 21, 2025
React latest version – React 19 to bring the React Compiler & more
Softwares

React latest version – React 19 to bring the React Compiler & more

by admin
July 20, 2025
Cross Exchange Crypto Arbitrage Bot: Automating the Trade
Softwares

Cross Exchange Crypto Arbitrage Bot: Automating the Trade

by admin
July 19, 2025
Improvements and crash fixes – Vivaldi Android Browser snapshot 3756.4
Softwares

Improvements and crash fixes – Vivaldi Android Browser snapshot 3756.4

by admin
July 18, 2025
How Will AI Impact the Next Generation of Designers? — Speckyboy
Softwares

How Will AI Impact the Next Generation of Designers? — Speckyboy

by admin
July 17, 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
The Simpsons Producer Apologizes To Fans For Killing Off 35-Year-Old Character

The Simpsons Producer Apologizes To Fans For Killing Off 35-Year-Old Character

April 26, 2024
Indiana Evans: What happened to the H2O Australian actress Indiana Evans and what is she doing now? | Explainer

Indiana Evans: What happened to the H2O Australian actress Indiana Evans and what is she doing now? | Explainer

December 7, 2024
I Tried Calocurb For 90 Days. Here’s My Review.

I Tried Calocurb For 90 Days. Here’s My Review.

January 8, 2025
Yeat Claims He Met an Alien When He Was Kid and It Talked to Him

Yeat Claims He Met an Alien When He Was Kid and It Talked to Him

July 7, 2023
How to use Redis for Api Caching in CS-Cart

How to use Redis for Api Caching in CS-Cart

July 26, 2023
Jada Pinkett Smith reveals what Chris Rock said to her after Oscars slap – National

Jada Pinkett Smith reveals what Chris Rock said to her after Oscars slap – National

October 13, 2023
8BitDo Retro Mechanical Keyboard C64 Review

8BitDo Retro Mechanical Keyboard C64 Review

March 24, 2025
Bones: All Of Brennan’s Interns, Ranked

Bones: All Of Brennan’s Interns, Ranked

June 15, 2021
Developer beats AI in coding battle

Developer beats AI in coding battle

July 21, 2025
Don’t miss your chance to exhibit at Disrupt 2025

Don’t miss your chance to exhibit at Disrupt 2025

July 21, 2025
Sia, Harry Jowsey Spark Romance Rumors

Sia, Harry Jowsey Spark Romance Rumors

July 21, 2025
Veld Music Festival Is Sending Toronto's Summer Season Into Overdrive With Deadmau5, Tiësto, Dom Dolla, More

Veld Music Festival Is Sending Toronto's Summer Season Into Overdrive With Deadmau5, Tiësto, Dom Dolla, More

July 21, 2025
Instagram Tests Auto Scroll Option for Posts

Instagram Tests Auto Scroll Option for Posts

July 21, 2025
Schedule, Where to Stream, Who’s Hosting & More – Hollywood Life

Schedule, Where to Stream, Who’s Hosting & More – Hollywood Life

July 21, 2025
Why You Should Consider Pet Insurance in Red Wing, MN

Why You Should Consider Pet Insurance in Red Wing, MN

July 21, 2025
Charli XCX And George Daniel Got Married

Charli XCX And George Daniel Got Married

July 21, 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

  • Developer beats AI in coding battle
  • Don’t miss your chance to exhibit at Disrupt 2025
  • Sia, Harry Jowsey Spark Romance Rumors
  • 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