How to name things in programming?

  Рет қаралды 7,500

Smok Code

Smok Code

Күн бұрын

Пікірлер: 21
@godsonprogrammer2807
@godsonprogrammer2807 3 жыл бұрын
1. Use correct grammer (Classes, variables, packages are nouns. Methods and functions are verbs) 2. Avoid abbreviation & acronyms 3. Invest time in picking names (will pay off in the future) 4. Follow a coding style (eg. Google style guide) 5. Don't re-use variables to optimize (compilers are smart enough to do that on its own) 6. Avoid tongue-twisters (like HWNDsck, mCustRpt_ptr etc) 7. Avoid "not" prefix (for example you won't know what *!notDeletable* means at a glance) 8. Never use Hungarian Notation (like szFirstName). The name should suggest the type: isRed, hasChildren = boolean totalAmount, userCount = int firstName, simpleLabel = string startDate, signedOn = date firstNames = string[], List 9. Avoid prefixes if possible 10. Length: 1 is fine for iterators. For others 64 characters 11. If a function needs more longer name, then the function is most likely too big 12. Keep things explicit but short 13. If there is a shorter name for explaining what the function does then rename it 14. Include side-effects in function names 15. Split your code by single concerns 16. Avoid weasel-words (like helpers, handlers, managers etc). Alternatives: Decorator, Producer, Consumer, Selector, Grouper, Collecter, Persister, Loader, Streamer, Orchestrater, Store 17. Look for ambiguity
@Tomersss222
@Tomersss222 3 жыл бұрын
Classes are only singular*
@ChrisAthanas
@ChrisAthanas Жыл бұрын
16 is the path to doom That’s not OOP That’s CLASS Oriented programming See Yegor Bugayenko Most devs have not seen true Alan Kay style OOP
@ChrisAthanas
@ChrisAthanas Жыл бұрын
No There are only 2 problems in programming: 1. Cache invalidation 2. Naming things 3. Off by one errors
@nimamohamadian6057
@nimamohamadian6057 5 жыл бұрын
Thank for your sharing your knowledge.
@lpdc9767
@lpdc9767 4 жыл бұрын
Super solid info. Background music is relaxing but it might be too relaxing; it made me a bit sleepy.
@insydium7385
@insydium7385 2 жыл бұрын
Pretty good video but why are you talking down to your audience? It's quite annoying
@Sebo810
@Sebo810 4 жыл бұрын
Great video :) I'm a software developer myself and I found it very interesting :) although the music did make me a bit sleepy . :)
@aero83pl
@aero83pl 5 жыл бұрын
Vehicle wymawia się bardziej w stylu "wiekl".
@SuperBialyWilk
@SuperBialyWilk 4 жыл бұрын
a nie bardziej "weikl"?
@sunuv2guns
@sunuv2guns 4 жыл бұрын
Great comprehensive video. Definitely going to send this to my team!
@Radarsu
@Radarsu 5 жыл бұрын
There were some choose-between-names cases that I've tried to solve and stay consistent at. I ended up with my standard approach to those: & vs And - prefer "and", leave "&" for brand names and programming actions. Add vs Create - prefer "add". It's more intuitive for non-programmers. Attribute vs Property - attribute for xml, properties for objects. Change vs Modify vs Update - prefer "update". It's more standard. Common vs Partials vs Shared - common for library names, shared for directory name, don't use partials. Configuration vs Options vs Preferences vs Settings Configuration - for internal system (for example: webpack.config.js, ecosystem.config.js). Options - for others choices (especially other developers, for example: ). Settings - for system-administrating end-user (for example: admin dashboard) Preferences - for end-user (for example: website visitor). Controller vs Resolver vs Route - controller for REST, resolver for GraphQL, route for analysis of url, query and params, possibly pointing to one of previously listed. createdAt vs creationDate - prefer "createdAt" over "creationDate". It's shorter and more common. Delete vs Remove - prefer "remove". It's more intuitive for non-programmers. Entity vs Model - for ORM model names use model, as it's more common and part of MVC naming. Module vs Package - module for internal stuff, package for external libraries. Page vs View - use view, as sometimes one page/view may be part of another one (also it's part of MVC).
@SmokCode
@SmokCode 5 жыл бұрын
Thanks for sharing! In my dictionary Model is after going through ORM, Entity is on the DB side, before going though mapper.
@michaelhabibau
@michaelhabibau 3 жыл бұрын
Great video. The point about prefixes is really important.
@javieru5871
@javieru5871 3 жыл бұрын
Excelent, worth my time, Thanks man!!!
@mahdiakbarizarkesh5603
@mahdiakbarizarkesh5603 4 жыл бұрын
Thank you for sharing your knowledge, I like them.
@kluchtube7042
@kluchtube7042 3 жыл бұрын
Bro keep it up the good work! Appreciateed!
@MrKret87
@MrKret87 5 жыл бұрын
But... but... I like hungarian notation :(
@SmokCode
@SmokCode 5 жыл бұрын
Everyone does! That's why you shouldn't use it ;)
@MrKret87
@MrKret87 5 жыл бұрын
@@SmokCode You know nothing, Jon Snow. I think you say such things because you don't want us to be pro programmers! :p
Design Patterns: Intro
9:54
Smok Code
Рет қаралды 6 М.
Naming Things in Code
13:23
Bran van der Meer
Рет қаралды 3,4 М.
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 93 МЛН
The joker favorite#joker  #shorts
00:15
Untitled Joker
Рет қаралды 30 МЛН
Picking Good Variable Names When You are Programming
13:17
Merlin Wellington
Рет қаралды 252
Programming Paradigms 101
14:44
Smok Code
Рет қаралды 20 М.
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,5 МЛН
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,1 МЛН
Cleaner Code: 3 Ways You Can Write Cleaner Code
7:41
Coding with Lewis
Рет қаралды 88 М.
Naming (in code) - The ultimate guide and reference
51:40
Programming Duck
Рет қаралды 1,6 М.
3 More Tips To Write Clean Code (from an ex-Facebook software engineer)
22:37
Don't Write Comments
5:55
CodeAesthetic
Рет қаралды 803 М.
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 946 М.
Intro to Competitive Programming
11:41
Junferno
Рет қаралды 777 М.
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 93 МЛН