对象已移动

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

We are getting close now – Vivaldi Browser snapshot 3797.35
Softwares

We are getting close now – Vivaldi Browser snapshot 3797.35

by admin
September 10, 2025
NFT Sniper: How to Snipe NFTs
Softwares

NFT Sniper: How to Snipe NFTs

by admin
September 11, 2025
8 Autumn-Inspired CSS & JavaScript Effects — Speckyboy
Softwares

8 Autumn-Inspired CSS & JavaScript Effects — Speckyboy

by admin
September 9, 2025
This week in AI updates: Mistral’s new Le Chat features, ChatGPT updates, and more (September 5, 2025)
Softwares

This week in AI updates: Mistral’s new Le Chat features, ChatGPT updates, and more (September 5, 2025)

by admin
September 5, 2025
Hybrid 3D printing method boosts strength of eco-friendly parts with less plastic
Softwares

Hybrid 3D printing method boosts strength of eco-friendly parts with less plastic

by admin
September 8, 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 Most Visited Websites in the World [Infographic]

The Most Visited Websites in the World [Infographic]

May 12, 2025
I Only Have More Questions After Another Bizarre Outing With The Harrigans

I Only Have More Questions After Another Bizarre Outing With The Harrigans

April 20, 2025
Amazon Forgot to Take the 2024 MacBook Air Off Sale After Their Big Spring Event

Amazon Forgot to Take the 2024 MacBook Air Off Sale After Their Big Spring Event

April 4, 2025
Instagram Adds New Teleprompter Tool To Edits

Instagram Adds New Teleprompter Tool To Edits

June 11, 2025
Ecca Vandal’s “CRUISING TO SELF SOOTHE” video is an ode to skate culture

Ecca Vandal’s “CRUISING TO SELF SOOTHE” video is an ode to skate culture

March 10, 2025
Itch.io starts reindexing free NSFW content

Itch.io starts reindexing free NSFW content

August 1, 2025
Easy Blueberry Scones (With Frozen Blueberries)

Easy Blueberry Scones (With Frozen Blueberries)

April 10, 2025
Tuesday Snapshot – Vivaldi Browser snapshot 3621.3

Tuesday Snapshot – Vivaldi Browser snapshot 3621.3

March 5, 2025
Authorities Says They Have Suspect In Custody In Charlie Kirk Killing

Authorities Says They Have Suspect In Custody In Charlie Kirk Killing

September 12, 2025
Gabriella Brooks and Liam Hemsworth announce their engagement and show off her stunning diamond ring

Gabriella Brooks and Liam Hemsworth announce their engagement and show off her stunning diamond ring

September 12, 2025
Hi /r/movies, I’m Garrett Wareing, actor in Lionsgate’s THE LONG WALK from legendary author Stephen King and director Francis Lawrence (CONSTANTINE, THE HUNGER GAMES). It’s out in theaters today. Ask me anything!

Hi /r/movies, I’m Garrett Wareing, actor in Lionsgate’s THE LONG WALK from legendary author Stephen King and director Francis Lawrence (CONSTANTINE, THE HUNGER GAMES). It’s out in theaters today. Ask me anything!

September 12, 2025
Bean-free coffee sounds absurd, but they’ve raised US$4.2M

Bean-free coffee sounds absurd, but they’ve raised US$4.2M

September 11, 2025
Savannah Chrisley Was Meant to Join Charlie Kirk’s Speaking Tour

Savannah Chrisley Was Meant to Join Charlie Kirk’s Speaking Tour

September 11, 2025
Taylor Swift Doesn’t Want To Be Travis Kelce’s ‘Gisele’ As He Mulls Retirement – Here’s How He’s ‘Leaning’ Now…

Taylor Swift Doesn’t Want To Be Travis Kelce’s ‘Gisele’ As He Mulls Retirement – Here’s How He’s ‘Leaning’ Now…

September 11, 2025
Google Launches New Ad Tools for Retailers

Google Launches New Ad Tools for Retailers

September 11, 2025
Twisted Sister to Reunite, Plot 50th Anniversary Shows for 2026

Twisted Sister to Reunite, Plot 50th Anniversary Shows for 2026

September 10, 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

  • Authorities Says They Have Suspect In Custody In Charlie Kirk Killing
  • Gabriella Brooks and Liam Hemsworth announce their engagement and show off her stunning diamond ring
  • Hi /r/movies, I’m Garrett Wareing, actor in Lionsgate’s THE LONG WALK from legendary author Stephen King and director Francis Lawrence (CONSTANTINE, THE HUNGER GAMES). It’s out in theaters today. Ask me anything!
  • 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