Тёмный

Creator of Go on Software Complexity | Rob Pike | Prime Reacts 

ThePrimeTime
Подписаться 484 тыс.
Просмотров 147 тыс.
50% 1

Recorded live on twitch, GET IN
/ theprimeagen
Article: www.lysator.liu.se/c/pikestyl...
Author: Rob Pike
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact

Наука

Опубликовано:

 

29 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 359   
@tobiasbergkvist4520
@tobiasbergkvist4520 11 месяцев назад
The descriptiveness of a variable name should be proportional to its lifetime. That's why it's fine to use "i" in tight loops - because the variable has a very short life span.
@ryanleemartin7758
@ryanleemartin7758 11 месяцев назад
Ohh that is an excellent point. I still think there's an upper limit to what is reasonable but yeah, awesome comment.
@cheebadigga4092
@cheebadigga4092 11 месяцев назад
If everyone has the same approach to code in a project (e.g., coding guidelines), then you can have whichever rules you want and the code is deemed "readable" and passes the style check.
@kyle8575
@kyle8575 11 месяцев назад
I like this point. I also think descriptiveness should be determined by how many other variables are within a function / piece of code. For example, if you have function int doSomething(param a, param b, param c, param d) { ... } it is likely helpful to be descriptive when passing variables to the function so things are clear especially if there is a lot of logic or changes occurring before the variables are passed.
@sacredgeometry
@sacredgeometry 11 месяцев назад
No it should be representative. i is a short hand for index. If thats all it indicates then its enough of a known convention to pass. If it represents something else then it should never be i. It doesnt matter how transient it is.
@ThePrimeTimeagen
@ThePrimeTimeagen 11 месяцев назад
I can see the reasoning here
@fennecbesixdouze1794
@fennecbesixdouze1794 11 месяцев назад
resolve, reject is actually much clearer than res, rej. I can tell you this personally because I've read other people's code and realized they think res means "result" or "response" and don't realize it's a callback function. I use abbreviation all the time, e.g. "amt" for "amount", "len" for "length", "args" for "arguments" etc, especially anything that's a reference to a common abbreviation in use in unix utilities or POSIX standards. I also don't shy away from 1 or 2 letter variables for inner variables and things controlling control flow (e.g. if I'm orchestrating some concurrent logic in Go and I only have one main communication channel, it is often named "ch"). But for something like "res" that could refer to so many different concepts (result, resolve, response, resume ...), I avoid it.
@TheNewton
@TheNewton 11 месяцев назад
And learning, I had this type of problem in nodejs contexts flipping between network and promises beginners have to keep an extra word map ontop of juggling the actual concepts being learnt. Annoyed me to no end how obtuse soft-dev is abbreviations make it into tutorials with no glossary in sight.
@elzabethtatcher9570
@elzabethtatcher9570 11 месяцев назад
wait it's not response??
@derschutz4737
@derschutz4737 11 месяцев назад
yep agree, "res" is too ambiguous and not instantly obvious, why is typing 4 more characters that much worse? Although "rej" at least to me is instantly obvious.
@incremental_failure
@incremental_failure 11 месяцев назад
I thought it's "result" as well. It's silly to save space with such short variable names. I will shorten words like "miscellaneous" or even "price" to "px" in my case since it gets used a lot. But then I was doing some graphical stuff and had to rewire my brain to understand that "px" is pixels.
@henrikholst7490
@henrikholst7490 11 месяцев назад
it's just a name it does not infer a type. that something is "the result" tells me nothing about the type. if someone did not get Promise and that resolve is a function, not the return value, no naming besides perhaps "callableResolveProcedure" would be helpful. So, be my guest, if you really want to be helpful.
@writeorwrong88
@writeorwrong88 11 месяцев назад
"clear use of function pointers is the heart of object-oriented programming" absolutely true. Ffmpeg, a C program, is object-oriented because of how it uses function pointers. It also does object-oriented better than most actual OO languages.
@davidaraujo2049
@davidaraujo2049 11 месяцев назад
30:32 - so true !! In college, I had a professor that made us do EVERYTHING in Python, and he would give us template code, meaning, we had to complete it but we couldn't change what was given as a base. And he would use Classes in Python for every single thing, and I would just get so MAD because the code was so simple but because of this, the code would be so slowwwwww. Because of that, in one of the projects I delivered the project with two codes, that did the same thing, but in one I replace all objects with dictionaries, and in the delivery file I also appended a graph with a profiler analysis of both codes. That felt good!
@lifelover69
@lifelover69 11 месяцев назад
Classic academia :) Did you get any comments about your graph?
@davidaraujo2049
@davidaraujo2049 11 месяцев назад
@@lifelover69 yes I did in fact 😅 We make our projects in GitHub Classroom, so the week after we deliver the project, the professor 'passively-agressively' started commenting my commits, like, who does that ? 😅
@TheNewton
@TheNewton 11 месяцев назад
Was the course on python performance? If not then you may be missing the point of the lessons. If you think your better than your teacher then why have a teacher , otherwise commit to the coursework.
@davidaraujo2049
@davidaraujo2049 11 месяцев назад
@@TheNewton it was not about performance but it was about creating 'intelligent agents' to resolve puzzles in the fastest time possible. It is not a question os me thinking I'm better than someone else, I'm sure the professor is much else versed with the course subject than me, no doubt. It is just wierd to me that they spend so much time teaching us that we should design systems intelligently and efficiently, and then they completely ignore, in this case, the obstacles and characteristics of the technologies they choose for the task at hand.
@Hector-bj3ls
@Hector-bj3ls 2 месяца назад
Taught you a valuable lesson though. OOP is bad for performance.
@az8560
@az8560 11 месяцев назад
I'd say that for the sake of search it's better to name things uniformly and without abbreviations. It's much easier to find anything in project related to 'address' if it's fully spelled than to try all kind of silly abbreviations which can come to mind to different people. It also has an advantage of spell-checkers validating that you don't have a typo. Especially useful if the people working on the project change often, and some of them are just juniors from unknown countries whose knowledge of the project domain and English skills are lacking.
@TheNewton
@TheNewton 11 месяцев назад
hell yeah spellcheck the first almost universal linter. Leave abbreviation to the build/compiler/minifier step.
@MrLowbob
@MrLowbob 11 месяцев назад
I think thats where the other part mentioned here comes into play: consistency. if you call address "addr" in every damn place, as soon you know how its written once, you'll know how to search for it everywhere else.
@az8560
@az8560 11 месяцев назад
Oh yes, sure, but it's like placing a bandage on a wound. Better to not have a wound in the first place. It doesn't eliminate the need to see it at least once. And you can't know in advance if a word is already used in the project, especially if it's some unsearchable abbreviation. And once you see it, you don't know if it's consistent. And it doesn't save you from the typos. It's easier to use a version which everyone can pick out of their mind and which spellchecker can check instead of having to bruteforce search all the thinkable abbreviation versions and then still not find everything because someone typed "adr" instead of "addr" and it wasn't immediately highlighted.
@wizardite
@wizardite 11 месяцев назад
Can't believe you're a hair's breadth away from Plan 9. I'd love to see that arc.
@replikvltyoutube3727
@replikvltyoutube3727 11 месяцев назад
Inb4 Primalgen will move every app communication in his programs to 9p protocol
@wizardite
@wizardite 11 месяцев назад
@@replikvltyoutube3727 Real. After that Primergen will switch jobs to being a typographer in troff.
@autistadolinux5336
@autistadolinux5336 11 месяцев назад
more people needs to see plan 9, the whole world would change after seeing the plan 9 concepts i would love to see youtube videos as mp4/mpg videos in a 9p mountpoint, or share gpus over the network like sharing a file
@thingsiplay
@thingsiplay 11 месяцев назад
res and rej versus resolve and reject The shorter one differ only in one letter. Also searching the text with longer names is easier. It is fine to abbrev, but I personally prefer slightly longer names, depending on the situation off course. There are no hard rules.
@TheNewton
@TheNewton 11 месяцев назад
Good point code for future you or others. By his logic why not r and re, this way saves THREE whole characters otherwise just wasting excess characters typing and reading
@u9vata
@u9vata 11 месяцев назад
I comment a lot - actually sometimes even add ascii-art drawings when needed. I think coding enough long in assembly teach you to comment and comment well. These are the things I do: - Typographic comments that mark blocks: like "// preparation" and "// windup" instead of creating methods for that only called from this single location. It makes readable code! - Documentational comments for methods and structures are very useful - Writing out why you choose and algorithm is very useful - Sometimes explanation of invariants or even the algorithm can be useful (this is where drawings can happen mostly - mostly for new data structures) - There are cases when I use "markers" - like "this works because of (***)" so that you can totally search for (***) held up as invariant somewhere. You can say "oh likely is bad design" but this also works in performance optimized codes and edge cases and sometimes you cannot make a more readable version but this still works and is very useful. - What about other hard-to-convey-in-ode information like "(// O(n) because despite this being a loop in a loop total element size at this point is linear to original input data) ??? - Also perf characteristics I sometimes mention in documentation comments - but also contracts for the caller genereally. +1: Actually I do prefer even the wrong comments compared to none if I can access git blame. Its a fallacy to think "code should be self-explanatory" because it might be self explanatory to someone and give endless headache to others (or even yourself) later. Especially with feature or code creep around that area where every small change in all the small PRs end up creating a monstrosity that lose its meaning. I saw that happening and comments HUGELY help. If they are not what the code says - that is indication of a bug: its either the comments bug, or worse: the code is buggy. In both cases worth investigating. Also keep in mind that the argument "the compiler does not check the comments" does not really hold up: neither the compiler checks how you name things and the same article puts a heavy effort on naming. I say this because I literally saw endless many times where naming and content go out of sync.... like "railConnectionMap.get(c)" for example ADDING c to the map if does not exists before.... who made that change was a total idiot, butt added the code there which is crazy and I got heavily surprised that this call not only always succeeded but makes it possible to out of memory the whole process :D It was once a simple getter, but it got "other shit" into it and the name stayed. I knew things where a checkRegex(r, obj) got to have a side effect of connecting to a database and do stuff related on user role - sorry I was like whyyyy why not rename if you do these kind of shit? Mostly good content, but sorryicantfukinreadwithoutcamelorsnakeorsomepropercase exceptshort.... and sorry but I find comments very usable. It is sad people are not excercising good commenting.
@metalwarrior6657
@metalwarrior6657 11 месяцев назад
Definitely agree, comments are great. It just seems Prime has bad memory from college. Comments should explain the reasoning for decision, not regurgitate code
@TetrisMaster512
@TetrisMaster512 11 месяцев назад
Yeah the anti-comments sentiment is something I disagree with a lot. Even if the code is supposedly straightforward enough to not "require" comments, I think having comments almost always reduces cognitive load while trying to understand a piece of code. Redundancy isn't necessarily a bad thing. Comments that give a brief overview of a segment of code can give you context that makes it even easier to understand it, or it can help you orient yourself in the program without having to actually read the code.
@fennecbesixdouze1794
@fennecbesixdouze1794 11 месяцев назад
The most meaningful point about abbreviations is actually not about abbreviations per se, but about consistency: The thing about abbreviation is that there are no standard conventions for how to abbreviate things, and this can cause naming inconsistencies when different programmers abbreviate similar concepts in different ways in different parts of the program. I often choose to use the full name of things simply because it sidesteps the question of exactly how to abbreviate it. This only matters of course when the concepts have a wide scope, e.g. method names or fields in public interfaces etc.
@monad_tcp
@monad_tcp 11 месяцев назад
That's a way of solving it, consistency is important, I personally use linters for that.
@TheNewton
@TheNewton 11 месяцев назад
The most meaningful point about abbreviations is not everyone speaks the same language. Do not introduce ambiguity, be consistent.
@andzagorulko
@andzagorulko 11 месяцев назад
Can't wait 'The C Programming Language' on PrimeTime sometime next month
@pif5023
@pif5023 11 месяцев назад
Loved this article! Especially the focus on data. That approach can really make a night and day difference in a program. Data is king.
@HrHaakon
@HrHaakon 11 месяцев назад
PL/SQL has a very important differentiation between functions and procedures. If you have to write stuff in it, it's really helpful to know the difference immediately, it saves you confusion.
@davewaterworth8846
@davewaterworth8846 11 месяцев назад
Plus from memory there was a global namespace despite the fact that objects were typed (i.e. views, tables, functions, procedures were different objects but each had to be uniquely names). That and the fact that keyword colourisation wasn't common meant adding type prefix/suffxes was more useful then that now.
@froge4300
@froge4300 11 месяцев назад
the thing about pointers is so true, whenever i have a loop over an array's contents i have a value like cur_ or just that is the array indexed by the index because its easier to type and theres less that could go wrong
@Nonsense116
@Nonsense116 11 месяцев назад
Apparently its a hot take around these parts but I like complete naming and don't like abbreviations. I've spent more time in C++ than I would've ever liked to have and it drives me up a wall how some of its naming where it begins to fail to even read like english anymore. It's painful, the few times I have to do something with C++ the number one thing I'm actively despising going in is the abbreviations. If it was just the full name I probably would be able to figure out what the purpose of the thing is. But I can't and now I have to pause and go read code or docs because someone couldn't take the two seconds to type 8 more characters. I'll die on the full name hill.
@MrLowbob
@MrLowbob 11 месяцев назад
yes and no. my (luckily) short time in C and C++ code bases let me agree with you... WAY TOO DAMN MANY ABBREVIATIONS.. but then there are the standard ones and I prefer them because if the lines of code are small and still pretty easy to understand as every used abbreviation is some relatively standard thing, I prefer those.
@davew2040x
@davew2040x 10 месяцев назад
I also don’t really care about writing out longer variable names when appropriate? I mean, my editor makes it mostly trivial with auto-complete, so I’m not sure what value there is in abbreviations. Are a lot of programmers just terrible at typing?
@trevorbeingtrevor
@trevorbeingtrevor 5 месяцев назад
Preach...l try to not to create unnecessary things to remember. It really helps when returning to a code base in the future.
@Selendeki
@Selendeki 5 месяцев назад
I agree with you on this, if you care about other people not becoming a living question mark when they read your code, just make the extra effort and write out a complete name.
@kyjo72682
@kyjo72682 20 дней назад
Agree. Much of C/C++ code is unreadable unless you're willing to dig in and learn what all the abbreviations mean. Bad practice, imo.
@josebalanza2755
@josebalanza2755 11 месяцев назад
I am going to be bold and try to clarify 32:55 - 33:30 for anyone who is wondering. What Rob Pike means is that you should encode your data into a format that is easy to address in your code, rather than adapting all your code to the data. By doing so, you reduce the amount of times you have to deal with the complexity of the data. In the parsing table example, encoding the grammar of the programming language into a parsing table once saves you from dealing with complex grammar rules every single time you manipulate the data. Think of it as centralizing the complexity of the data into a continuous block of logic, instead of having bits and pieces all over your program.
@henrikholst7490
@henrikholst7490 11 месяцев назад
good example: various storage format for sparse matrices. different storage formats are good for different algorithms.
@johnychinese
@johnychinese 11 месяцев назад
Flip: How many videos do you want released in 24 H Prime: YES
@highlyevolved4977
@highlyevolved4977 11 месяцев назад
“e” certainly isn’t confusing when sitting right next to the definition. But if you find it at the bottom of a 200 loc method, you’ll find yourself going back and forth to check what things are.. it hurts readability because you cba to write the thing in its entirety to begin with. Just my two cents
@TheNewton
@TheNewton 11 месяцев назад
yeah, linters should have a general rule that any variable used after more than 1 screenful code(~50 lines) has to be a full word at minimum. Kinda like how linters may warn against wide lines of code that go off screen, or git messages should be 72 characters or less.
@HappyCheeryChap
@HappyCheeryChap 11 месяцев назад
old out of date comments are very occasionally an issue. but i've found that lack of comments entirely is a problem 100x more.
@cule219
@cule219 4 месяца назад
True, plus the comments, I find, can help with clarifying the business requirements that you cannot infer from code logic, even when variable naming is on point.
@theohallenius8882
@theohallenius8882 11 месяцев назад
The only instance I'd advise from using short abbreviations is to be able to find variables quickly in the source code and navigate faster within the source code, can't really do that if all your variables are named i, j, k, o, and when you search it matches every letter in every other word. Also trying to keep them unique is crucial if you want to search and replace variables later throughout the entire codebase, so it doesn't matter what you call them for as long as you can replace them later with one click.
@voidwalker7774
@voidwalker7774 11 месяцев назад
You, Sir, are a software developer and not a script kiddy.👍
@Iaotle
@Iaotle 11 месяцев назад
Depending on the IDE some of this is solved by the ide's var detection but yeah def not nice when someone's naming variables in code as if they were mathematicians
@az8560
@az8560 11 месяцев назад
Could be very important if the language you are using doesn't have good tools for search/refactoring. But it's also worth noting that if you are forced to write in loosely typed language without tools, you primary objective should be to run from this company, not to ensure that spaghetti is suitable for building skyscrapers.
@fennecbesixdouze1794
@fennecbesixdouze1794 11 месяцев назад
Of all the arguments against using short variable names, this is easily the worst. Any developer should know how to find all the instances of the identifier "i" in their code base without matching all the other lines where the character "i" occurs.
@Iaotle
@Iaotle 11 месяцев назад
@@fennecbesixdouze1794 I mean it's not necessarily trivial to do in all cases but yea
@ThemisGaming
@ThemisGaming 5 месяцев назад
On the use of abbreviations in variable names, I worked with a guy who took that to a whole new level. Some of the notable abbreviations we had to change all over an API were dtBth for dateOfBirth, veh for vehicle, and clnt for client. It happed so early on in my career that now I, to a fault, name things way too long.
@AloisMahdal
@AloisMahdal 11 месяцев назад
I think a good argument against abbreviating is that there's usually more ways to abbreviate ("res", "rej" or "rs", "rj" ?) so it's harder to keep it consistent. IMO for short words like "result", "reject" it's probably not worth. OTOH, if it's a really ubiquitous well-known call that's also short-lived, I would not really care.
@henrikholst7490
@henrikholst7490 11 месяцев назад
it is here a case of conventions rather than clarity. if people expect to see "resolve" and "reject" rather than the abbreviated names, I think convention and domain trumps personal preference and a short-lived scope of the variables.
@casraf
@casraf 11 месяцев назад
18:30 also a good thing to consider it that extracting expressions to a var will make it easier to wrap or replace it later when necessary. It's much easier to change e.messageType to e?.messageType ?? "NO_MESSAGE" in just one line than to copy that same code to multiple places with different contexts.
@ND6K
@ND6K 11 месяцев назад
the creator of go, I wonder what is take will be? 🤔
@chromacat248
@chromacat248 9 месяцев назад
13:15 my brain interpreted the parenthetical as being unrelated to the rest of the sentence like “The Sun is a star located in the center of our solar system. It radiates energy derived from a process known as “nuclear fusion” (my family died in a drunk driving accident 5 years ago)”
@FrederikSchumacher
@FrederikSchumacher 11 месяцев назад
Reminds me of that other PrimeTime video about how much programmers hate to read code, but love to write code. And I think this happens because there's a disconnect for many people between being a reader and being a writer. As a writer, you're immersed into the context (of what you're writing about) all the time. As a reader, you have to expend effort to get into this context, and expend yet more effort to follow along when context is being modified. Additionally, it's not just the semantic context a reader needs to follow, but also the idiosyncrasies of the writer. Add to this the general complexity of programming, and you get a soup that's easy to cook, but mostly hard and unpleasant to swallow. Sometimes, and I'd say, more often accidentally than intentionally, writers get it right enough and have success. This reader/writer disconnect also seems to present a hurdle to improve one-self as writer for many. Peer reviews could help, especially when peers with alternative idiosyncrasies take part, and the writer in review can distance from code as self-expression and from the immediacy of their own context experience as writer. Unfortunately, this appears to be very hard to learn, and even after years of code reviews I've experienced as writer, they still often leave me feeling defensive. I'd say the biggest change to my perspective on code expression came from applying the Zen of Python repeatedly to my own code and that of others. Reflecting on suggestions I received and gave, and also applying suggestions I made to others to myself. Now I think it's so obvious, if you're a reader take note of positives and negatives of the materials you're reading and apply them to your own writings. If you're a writer, take breaks, switch context, read your own stuff over and over again. But perhaps most effectively, try and explain it to anyone, then observe where you had to spend more time giving context... then add this additional context to your code. I also think this reader/writer disparity also takes part everyday as listener/speaker or observer/actor. It's generally a disconnect between communicating parties, and people only experiencing themselves as one but not the other at any given time.
@monad_tcp
@monad_tcp 11 месяцев назад
one can only hope that eventually you suffer yourself at your own hand when writing and being the reader later to start considering writing better for the purpose of someone else (you without the context) being able to read it later.. hopefully (because I know developers hate their future selves for some reason)
@TheNewton
@TheNewton 11 месяцев назад
coder loves to write code but is stingy with 6 more text characters, lol. It's more like coders hate having to explain code or having it explained to them by reading. UX industry has a mantra of don't make the user think, software needs to adopt similar something like: don't make the reader get through your mindmaze you long forgot about.
@TheNewton
@TheNewton 11 месяцев назад
" get a soup that's easy to cook, but mostly hard and unpleasant to swallow" great analogy for naming ambiguities like abbreviation in code. "reader/writer disconnect" reminds me of the bicameral brain hypothesis.
@davew2040x
@davew2040x 10 месяцев назад
Very well stated! I’ve always loved the expression “write-only code” - code that was written in a way that once it’s out there, it’s impossible to read and thus impossible to really work with or change. With the way that code lives a long lifetime within organizations, there should be NOTHING more important than trying to make systems that make sense to whoever has to work on them, and yet many orgs treat that as a fundamentally pretty low priority. We collectively spend a lot of time glorifying guys who write code fast, when in the scheme of things that’s really not too valuable.
@tapwater424
@tapwater424 10 месяцев назад
​@@TheNewton No one writes abbreviations to save time. For most people, writing whole words is much faster because that is what they are used to. Short variable names are used because they are *easier to read*, not easier to type. If you have to keep track of 8-10 different variables in your head to read a snippet of code, then longer variable names can alleviate some mental burden, but this is more so a sign that you should refactor. In most sections of your code you will only need to keep track of 3-4 variables and here it's easier to read short and consistent variable names.
@sharperguy
@sharperguy 11 месяцев назад
17:40 this is one feature I really miss from haskel in other languages. There 'where' syntax would allow you to write write a short function showing the algorithm or calculation you're performing, and then afterwards you write "where type = e.type" etc at the end to show where you get the data from.
@timothyvandyke9511
@timothyvandyke9511 11 месяцев назад
At my last job we had like 15 people who ALL knew that "sis" meant "Student In School" (education tech stack). It was so ubiquitous that no one questioned it. It was wonderful. 3 chars said so much about what a variable was and meant.
@alister_
@alister_ 11 месяцев назад
In mine, SIS is "Store in Store", but also "System in SRT". Only God know what "SRT" means. Probably another system.
@fappylp2574
@fappylp2574 5 месяцев назад
I maintain legacy code that was written by people that loved to abbreviate this type of domain specific stuff because it was obvious to everyone back then. Except now it's 30-40 years later and these people have all long since retired or died and noone remains with knowledge of all these _obvious_ abbreviations. (And yes LITERALLY 30-40 years later. Some of the code I have to modify hasn't been touched since the late 70s)
@redpillsatori3020
@redpillsatori3020 11 месяцев назад
From Chat Jippity: The word "as" can function as both a preposition and an adverb, depending on its usage in a sentence. Preposition: "As" can be used as a preposition to introduce a comparison or in the role of a function word relating a noun or pronoun to another element in the sentence. For example: "He works as a teacher." (introduces a comparison, indicating his occupation) "She used it as a tool." (relates the pronoun "it" to the noun "tool") Adverb: "As" can also function as an adverb, modifying a verb, adjective, or adverb, and providing information about the manner, degree, or extent of an action or condition. For example: "She ran as fast as she could." (modifies the verb "ran," indicating the manner of running) "The car is not as expensive as I thought." (modifies the adjective "expensive," indicating the degree of expense) "He writes as well as his brother." (modifies the adverb "well," indicating the extent of writing ability) In some cases, "as" can also function as a conjunction or a relative pronoun. The specific function of "as" in a sentence depends on the context and the role it plays in connecting or modifying other words or phrases.
@alexandrep4913
@alexandrep4913 11 месяцев назад
There was an interesting article I found where some Russian fellow was talking about not using design patterns and all the other things, just trying to keep things like performance and simplicity in mind. Apparently this was the easiest system to update and maintain he had while the other ones just went down hill.
@HrHaakon
@HrHaakon 11 месяцев назад
That does sound like an interesting article. I mean, some design patterns are a good idea, when they apply to your situation at hand. You can take the DAO-pattern from my cold dead hands, for example. Do you remember what it was called by any chance?
@mrpocock
@mrpocock 11 месяцев назад
The older I get as a programmer, the more I consider code primarily a document written to other coders. It is read and written by people many thousands of times more than it is to generate production code. The only thing that matters always is that it is as clear as possible for other humans to read. Even to the point where for those very rare cases where highly optimized code is obfuscated in the name of performance, I also include the unoptimised, readable code with it.
@hamm8934
@hamm8934 11 месяцев назад
In college, I had a friend who was an English major but realized half way through that he wanted to get a programming job. He had to have written some of the cleanest and well written code I’ve see in my career, and he was still in college. He really viewed every function/class he wrote as an argument that his fellow readers (programmers) would have to read, understand, and critique. Glad I crossed paths with him so early on in my career because he really changed the way I code to this day.
@laughingvampire7555
@laughingvampire7555 11 месяцев назад
so you are falling for them meme of the waterfall
@dale5882
@dale5882 11 месяцев назад
@@hamm8934 do you have any examples? I’m self taught and am always looking to find code as you describe
@vikhr
@vikhr 11 месяцев назад
@@hamm8934 also would like examples, things like that help non native speakers. you can assume a lot of things based on your language and the specific group you are in, if english is your first language you can just assume everyone knows those common abbreviations, and if you've been working with the same people for a long time you will start to assume even more, and if other people can't understand what you assume to be common sense you tend to blame them, "works on my machine, so it must be your problem", which starts up fights about what is or isn't "correct"
@TheNewton
@TheNewton 11 месяцев назад
@@vikhr translation is one of the best takes for full words. The ego of english speakers is already bizarre but make them an English speaking coder and suddenly the ego is so huge they cannot imagine a world in which someone else doesn't understand their custom "ls" abbreviation stands for list and not listener(an event handler).
@naxaes7889
@naxaes7889 11 месяцев назад
The length/descriptiveness of a variable name can be calculated by a simple formula. It's the distance of the declaration and use, divided by its usage frequency. In other words, short variable names are for things that are used shortly after declaration (iteration variables, temp variables, ...), or things that are used frequently (sum, fn, Vec, ...). It makes sense. In the first case you have context, and in the second you have familiarity.
@nezu_cc
@nezu_cc 11 месяцев назад
I don't have a problem when people abbreviate but I do have a problem when they abbreviate the wrong thing. for(const event of events) is perfect, for(const e of events) is fine, but for(const el of events) is not. I don't think anyone would write "element of events" but some of those people find it ok if they reduce it down to el. I personally hate that.
@TheNewton
@TheNewton 11 месяцев назад
"I don't think anyone would write "element of events" " This is why abbreviate is to be avoided, there's some very bad assumptions about what's possible*: var events = document.getElementById('#events'); for(const el of events) el.innerHTML == el.nextElementSibling.InnerHTML; el.addEventListener("click",(el)=>{ console.log(el.eventtarget)} ); *syntax not tested
@magnum_dingus
@magnum_dingus 11 месяцев назад
The larger the scope, the longer the name. If it hangs around and gets used a lot, I tend to be descriptive. If it's an index or local to a small func, it gets shortened usually.
@gloowacz
@gloowacz 11 месяцев назад
about the abbreviation thing: You don't see any clarity, because english is your first langage. Start naming variables in... say, Polish, and you will see the difference. [edit] I see a lot of people missed the point. Of course everything in code should be in english, veriables, functions, etc etc. My point is that there is a difference to looking at two abbreviations in your mother language, and in learned language. For me, there is not much difference anymore, since i learned to "think" in english (my internall narrator is bi-lingual now) but some years ago, certain abbreviations in code would throw me off the correct path because i un-abbreviated them differently than intended. [edit2] I think my initial statement should have read: "If standard for language used in programming was Polish, you would see the difference". about idexes in for loops, i agree wholehartedly, but with a "*". When you have nested loops with large bodies it's sometimes advantageous to give more specific name to the indexes.
@LucasOe
@LucasOe 11 месяцев назад
I think code should always be in English. I'm saying this as a German person, all the code I write is in English. Otherwise I would have to mix multiple languages, because the libraries I use aren't written or documented in German.
@hermes6910
@hermes6910 11 месяцев назад
​@@LucasOe Same thing here in France. But for one reason or another, some companies ask you to code in French. And when it's natural for you to code in English, it's a headache to work with a melting pot of languages and names in your code base. For me, it's just a question of harmonization, and if you have to share your code, everyone's on the same wavelength (like on Stackoverflow).
@sohn7767
@sohn7767 11 месяцев назад
Just stick to English yeah. Chinese, Japanese people also just keep variables and stuff in english
@hermes6910
@hermes6910 11 месяцев назад
@@sohn7767 The problem is that comments should also be in English, which is not the case for a lot of them.
@sohn7767
@sohn7767 11 месяцев назад
@@hermes6910 eh I think comments are fine if they are in the language that the team speaks
@asdfasdf9477
@asdfasdf9477 11 месяцев назад
If combining data structures is fair game, arrays are enough for everything: 1-element arrays for scalars and indexes as pointers complete the list of building blocks needed for any data structure. Also, the distinction between data structures and algorithms is ephemeral: a data structure is a set of algorithms that work together to accommodate specific data usage patterns.
@alister_
@alister_ 11 месяцев назад
How is a data structure a set of algorithms? AFAIK is just data managed in certain ways (with, well, algorithms). Can you elaborate more? I find your statement very intriguing.
@wgr4329
@wgr4329 11 месяцев назад
8:05 In plan9 C they do use this mostly no space in binary operators convention but there is no such thing in Go, but yes gofmt will remove spaces in operators expressions in a style that is used in plan9 C, that's removing spaces to group by precedence order, that's way harder in C because there 15 levels of precedence, in Go there's only 5, so in this expression: 5 + 1
@pineberryfox
@pineberryfox 10 месяцев назад
the procedure/function distniction is still important for reasoning about programs! even if your language doesn't distinguish the two, knowing in your mind that a function doesn't change things or involve global state simplifies their analysis vs procedures
@KangoV
@KangoV 3 месяца назад
In 1989 i was starting my first job programming an IBM System/38 then AS/400. i feel old. All command were created with 3 characters of each word with a few exceptions. e.g. CRTF (create file), SBMJOB (submit job), WRKACTJOB (work with act job), WRKBNDDIRE ( work with binding directory entries). Absolutely awesome system. It would just keep running.
@egor.okhterov
@egor.okhterov 11 месяцев назад
e becomes confusing the further away it is used from original declaration. The length of the variable is dictated by the number of lines you need to scroll to find how it is declared. The size of the context spanned by the variable matters. The second parameter affecting the length of the variable is the number of declared variables in the same scope. If you have e1, e2, i, a, o then something is not right. If you only have single variable you can use the shortest name possible. If the variable is competing with common notation from math or accepted software engineering standard then the name better be elongated. For example, I refuse to accept that "i" is ever a good variable name except for iterating through a loop.
@isodoubIet
@isodoubIet 11 месяцев назад
"This paragraph predicts NPM dependency hell" It actually doesn't, that paragraph is anachronistic even when dealing with C code. Pike is essentially saying that include guards like #ifdef FOO_H_DEFINED #define FOO_H_DEFINED /* contents of header */ #endif are hard to get right. There's some room for getting it wrong, sure (like what if you pick the same guard for two different files) but they're a well-known idiom and there are ways to avoid that (you could even configure your editor to generate and append a GUID to the guard name). These days we have widely supported #pragma once which works always unless you're doing crazy stuff with symlinks and distributed filesystem (in which case you might want to consider not doing the crazy stuff). Either way, dealing with include guards and their problems, or nonstandard pragma once, is vastly, vastly preferable to having to manually include the dependencies to every single header you put in your program. These days, that would just fill your editor with squiggles and it's not worth the bother.
@isodoubIet
@isodoubIet 11 месяцев назад
(Also, most compilers will optimize right through include guards so this is not expensive at all)
@retropaganda8442
@retropaganda8442 5 месяцев назад
I agree, this part of the article, especially, is counterbrainductive. Shameful. I guess now we have to hate Go, like it's creator, then 🥸
@isaacyonemoto
@isaacyonemoto 11 месяцев назад
Its good to get into the habit of using idx as your index: someday you might work in a language/library/codebase where i is reserved for or imported as the imaginary unit.
@coolaj86
@coolaj86 7 месяцев назад
28:50 How many years ago was it that you saved multiple seconds using for instead of forEach? I also worked on a radar product and also switch to for due to processing millions of items of data, but I've tested similar loops since and I don't think the same performance issues exist now.
@HrHaakon
@HrHaakon 11 месяцев назад
Pike is very much sort of describing how Common Lisp does object orientation and it's a rather pleasant experience. People should try it out, it's a neat way of doing business.
@ThomasWSmith-wm5xn
@ThomasWSmith-wm5xn 5 месяцев назад
people who dont like go - "its to easy to do stuff i need to do while being safe enough to also be flexible"
@jazzochannel
@jazzochannel 10 месяцев назад
26:27 "don't laugh now, wait until you see it in real life". I suddenly remember reading this article about 15 years ago! And I have seen these comments in real life since then! I call them zero-info comments.
@TanigaDanae
@TanigaDanae 11 месяцев назад
The issue at ca. 42:20 (Include files) is a problem of "back then" as C programmer (Sometimes still today but we have tooling). Which is include hell, where the header uses stuff but you have absolutely no idea where that comes from. Visual Studio is still bad at finding some of these things. E.g. you include a header called which includes some library global header which in turn includes all of the library. Suddenly the header uses a "thingC" which got included over multiple corners. Back then it was a nightmare to follow all the header to the definition of "thingC". The #ifdef's help to hide this include problem very well.
@illoominate
@illoominate 5 месяцев назад
The "as" in "as sensible" is an adverb, modifying the adjective "sensible." However, "as" can be a preposition, as in "acting as a mediator."
@chordfunc3072
@chordfunc3072 11 месяцев назад
6:26 I agree that abbreviation in this case is no fuzz. It's just a pain in the ass when it is not something standard, and you have to guess what it actually is. Its made even worse by some people insisting that we should always use implicit typing. In the worste cases you end up with this variable that has a abbreviated name that is implicitly typed, where its value is returned from a function named something that is wage. Of course you figure it out fast, but when you have this everywhere, I hate reading code where everything is abbreviated.
@chordfunc3072
@chordfunc3072 11 месяцев назад
Also like you mention max, sum I have no problem with. But when people make up their own abbreviations, and you have to guess. I hate that shit.
@coolaj86
@coolaj86 7 месяцев назад
32:50 By "programming with data" he's just saying "declarative", but before it twisted to mean "force everything into an AST and pretend that it's declarative for a cool conference talk"
@illoominate
@illoominate 5 месяцев назад
I avoid nested includes too. Instead I'll group the prerequisites into sections, e.g.: #include #include #include #include #include Each group contains the prerequisites for something in the next group. I also tend to sort alphabetically within each group.
@almari3954
@almari3954 11 месяцев назад
The parsing stuff favoring data over code is essentially the Rule of Representation: Fold knowledge into data so program logic can be stupid and robust.
@isniphsi7843
@isniphsi7843 11 месяцев назад
I would not have known where for res and rej stands. I find that especially for new sounds better or easier to understand, especially if they do not have English as their mother tongue. But opinions may also differ
@TheNewton
@TheNewton 11 месяцев назад
yeah res and rej not only assume the reader knows what a "Promise" is it also assumes they know the conventions of promises and assumes the reader is english speaking. Too many assumptions when you could just choose to avoid ambiguity.
@0xCAFEF00D
@0xCAFEF00D 11 месяцев назад
33:30 My understanding is that he's expressing that often algorithms have more general parts that are best expressed through code while details fit better into data. Like the parsing table. The parser *code* encodes the process of categorizing arbitrary (implying general) symbols into tokens while the *data* defines what characters in what sequence will form tokens (details). Hoping I'm wrong.
@laughingvampire7555
@laughingvampire7555 11 месяцев назад
all of us blessed enough to have learned programming through C, have no problem abbreviating, I agree with Rob Pike on naming.
@coolaj86
@coolaj86 7 месяцев назад
6:00 the problem is that `res` is already "server response" and (in some code bases "client response" - which should, of course, be `resp`), so you should use the full `resolve` for consistency - just like `i` is always a counter and `e` or `err` can be an exception, but events should be `ev`. The shorter the name, the more context matters, and you'll *definitely* have resolve and response in the same context from time to time in JavaScript.
@CamembertDave
@CamembertDave 11 месяцев назад
"Rule 6. There is no rule 6." is the most subtle Monty Python reference I've seen in a long time.
@ravenecho2410
@ravenecho2410 5 месяцев назад
I also hate comments in code, but there's a rust library which auto-hides docstrings - which enables me to provide documentation for client, but also to have my preferred method of viewing and working on code
@farrongoth6712
@farrongoth6712 11 месяцев назад
Standard advice for C and C++ now, I am 85% certain is do it, inside #ifndef block. There was probably a point where the standard libraries didn't do it, so it probably had other issues if you tried doing it, but to the best of my knowledge all the standard libraries do it now.
@rohitaug
@rohitaug 11 месяцев назад
The thing about OOP I would consider bad are stuff like inheritance, the UML stuff, and the obsession with abstraction. Classes and methods are pretty good, actually. I feel like people are throwing the baby with the bathwater.
@isodoubIet
@isodoubIet 11 месяцев назад
(Implementation) Inheritance is how you implement mixins in languages that don't natively support them so it can be good too. I think where people go wrong is they'll make these deeply nested layers of "Is A" relationships that all quickly reveal themselves to be leaky abstractions, so you have people scratching themselves and wondering if a Temporary Manager Is A Manager which Is An Employee which Is A Person or if he's a Contractor which Is A Person, and it all goes downhill from there. Advocating composition works only so long as your classes don't have dozens of pointless pass-through boilerplate functions. This would all be alleviated if the focus were on behaviors instead of identities. I don't care what you _are,_ I care what you _do._
@TheNewton
@TheNewton 11 месяцев назад
​@@isodoubIet we all would watch a 30 minute video on this; The Story of Is A: personhood and the existential abstract nightmare.
@raianmr2843
@raianmr2843 11 месяцев назад
Really doubt anyone would want to go back to C++/Java style classes after being exposed to Rust/Go style structs. And the distinction of method vs non method functions is completely irrelevant in languages that have pipe operators, auto-currying or partials, and other niceties. Langs like Rust and Go keep this distinction because their designers wanted people to code with objects. I think this new sanitized-OOP movement gets the job done but it's important to remember that this is a design choice and not a technical necessity.
@verified_tinker1818
@verified_tinker1818 11 месяцев назад
I used to think so, but not anymore. There's little that methods add that you can't implement using the module system. I.e., instead of defining a method called `area()` for the struct `Rectangle`, you can define it as a function in the `rectangle` module and call it as `rectangle::area(my_rect)`. There's a trade-off between the convenience of `my_rect.area()` and the simplicity & purity of `rectangle::area(my_rect)`. Lately, after discovering and considering Odin and Jai, I've been leaning toward the side of simplicity (though I must write a significant project in Odin/Jai before I can make a final conclusion). That's also how Elixir works, and combined with its pipe operator, I enjoyed it a lot.
@isodoubIet
@isodoubIet 11 месяцев назад
@@verified_tinker1818 It's not about syntactic convenience. You define classes because they satisfy useful invariants.
@AbhinavKulshreshtha
@AbhinavKulshreshtha 10 месяцев назад
26:22 I do add a block comment on a whole module if module is complex enough
@Sairysss1
@Sairysss1 11 месяцев назад
People will go on an hour long debates just not to type 3 extra letters in their variables to make them more readable
@blenderpanzi
@blenderpanzi 11 месяцев назад
(res, rej) clearly stands for (response, rejuest). :P However, I do use "index" and not just "i". Because people that use "i" often use "j" for an inner loop and I had the case where "i" and "j" got mixed up and I just didn't see it because the letters look so similar. Took me a while to debug that. And when you write "index" nobody writes "jndex" in the inner loop. You write "thingIndex", like "userIndex" and then "postIndex" in the inner loop (if you have to do that via indices for some reason and not a for-each loop). And about using "e" instead of "event": Lot's of people use "e" for errors. I mean I guess clear in that small loop, but if its more complex code where you *also* have to handle errors I think writing "event" and "error" is good practice. Nothing I would argue in a code review, though, if it is really like the shown code example.
@isodoubIet
@isodoubIet 11 месяцев назад
The i and j stuff really depends on what you're doing. The vast majority of my uses of i and j are for indexing into multi-dimensional arrays so using anything other than i or j would detract from readability.
@blenderpanzi
@blenderpanzi 11 месяцев назад
@@isodoubIet The problem for me is that they are so easily confused. If it's a 2D array you could use row and column.
@isodoubIet
@isodoubIet 11 месяцев назад
@@blenderpanzi That's not that workable when you're dealing with math expressions, because obscures them even more than they're already obscured by writing them out in code. The names may not be particularly meaningful anyway, particularly if you're dealing with a code base that mixes row-major and column-major arrays (very likely to happen if your project grew out of a Fortran project)
@blenderpanzi
@blenderpanzi 11 месяцев назад
@@isodoubIet Right. I'd still would use something different that i and j of all things. Even i and k would be better, or any other letters that don't look that similar and are easily confused by someone like me. I sometimes can stare for minutes at a word and not see what the mistake is that the spellcheck is marking. I don't see these little things, so I make them not little when I can.
@isodoubIet
@isodoubIet 11 месяцев назад
@@blenderpanzi Do you have dyslexia by any chance? Completely serious question. (unfortunately k is taken,; it's the third in the i, j, k series so it's naturally used for the third dimension)
@luciusoflegend
@luciusoflegend 11 месяцев назад
You're talking about how abbreviating things is just fine, but BOY, I wish I could show you some Minecraft source code I was trying to understand becuase I was making a mod. The damage function is absolute spaghetti. It was so stupid. There were like 5 variables getting thrown around that were just single letters, and I don't even think they stood for anything. But hey, maybe that's just copium/skill issue.
@ea_naseer
@ea_naseer 11 месяцев назад
probably written by someone using Minecraft to learn programming.
@luciusoflegend
@luciusoflegend 11 месяцев назад
@@ea_naseer No, it was part of the Minecraft source code.
@shadow_vertex
@shadow_vertex 11 месяцев назад
Minecraft source code is obfuscated and you were probably looking at code deobfuscated by the community, not the code (variable names) written at Mojang.
@TheNewton
@TheNewton 11 месяцев назад
And this is why "in my head" to justify abbreviations is a bad philosophy to spread. Some expert may understand their internal project, but as a culture we lose a lot of time to this nonsense because it does percolate to non-experts as a behavior.
@theroyalblackfridge
@theroyalblackfridge 11 месяцев назад
data-driven algorithm -> reminds me of structure and interpretation of computer programs
@mvargasmoran
@mvargasmoran 11 месяцев назад
15:27 wrong, "no problemo" is from Terminator 2 (I had to search for the date) which came out in 1991, the article is 1989, then there was no problemo so "np" was a bit more specific and usable.
@robfielding8566
@robfielding8566 11 месяцев назад
i used to think that all these battles were silly. then i had to start using Braille. in that context, space vs tabs made a big deal. lines being too long was a real problem. i think Go is right to use very short and standardized names in local scopes. global variables should be as verbose as the global function names. the more distant the consequences can be, the more verbosity is reasonable.
@programaths
@programaths 11 месяцев назад
Code in a stupid way, and your program will survive longer ^^ In implementing form validation, I coded the whole thing, assuming I would have two magic functions. One is to retrieve a field from whatever structure was passed to it, and the other is to retrieve a value from whatever design was passed to it. So, relatively easy to do the validation using those functions. Then I created those two first-order functions to grab fields/values from the right place. When the same functionality was required in an Angular application, only those two functions were to be remade. I tried explaining that to the other developer, who insisted on changing the "core." I don't do Angular (I did AngularJS), but in the end, I did those two functions myself. The guy still didn't wrap his head around it. Later, we had to update the core, copying one JS file. He had the same issue; he didn't understand it was just a copy-paste...Took a few times before he became confident. I even asked my boss if I could take over that part entirely because going into a call to copy a file is...painful. In another application, I created an intermediate representation. My boss thought it was a waste of resources, but that intermediate format is more suited for processing. A small upfront cost for a lot of downward efficiency! I had to implement a new feature, and thanks to the intermediate format, it took a day instead of a week ^^ And I am the first to say comments are usually band smell (as a QAM, I used comments as a mean to quickly find code that belongs to a function), but most of them read like "do not attempt to simplify" or "bug in library, force reloading data". Now there is a considerable drawback, people not used to that way of programming are stumped because it's not a big block of code where you can read from top to bottom. In the middle of the code, you have a call to a function coming from the parameters, so you've to see how it's called to see the body of that function in context...except that you don't have to because you're supposed to work at a different level of abstraction. So, it makes stuff way simpler as you just have to assume the function does what it says it does. And that's the beauty; in the end, you concentrate on a very generic algorithm, which is relatively easy. Then you fill in the gap, which is relatively easy too. Then you end up with something complex but totally digestible if you don't freak out. On top of that, the JVM loves smaller methods. (No JIT if bigger than 8k, and I saw strategies much bigger than that ^^) I have 15 years of professional development, 25 years with hobby. (You can look up "Navigateur à onglets gérant ses favoris et qui peut se dupliquer (==>capture)" for an example)
@aCrumbled
@aCrumbled 5 месяцев назад
THE VIM PLUGIN IDEA IS AMAZING PLEASE DO IT LMAO (im a java developer and i see that bs all the time)
@CubbyBear-cn5kh
@CubbyBear-cn5kh 11 месяцев назад
Aged like fine wine.
@blenderpanzi
@blenderpanzi 11 месяцев назад
I don't write this in JavaScript: const type = event.messageType: if (type === I write: const { messageType } = event; if (messageType === If messageType is used more than once. Otherwise if only used once: if (event.messageType ===
@0oShwavyo0
@0oShwavyo0 11 месяцев назад
How does one chisel their thumb? You need one hand for the chisel and one for the hammer, so how does a thumb get in front of the chisel?
@themilkman3118
@themilkman3118 8 дней назад
I had no idea that foreach loops are considerably slower.
@Selendeki
@Selendeki 5 месяцев назад
27:40 probably masking bits, preserving bit 7 because of bit 2 somewhere else? I'm probably way off, but I've been coding a gameboy emulator for a little while and I see bitmasks in my nightmares.
@SpudMackenzie
@SpudMackenzie 11 месяцев назад
e in events is honestly better than event in events because event and events are once character apart, and like you only need to know e means event for the loop body.
@metaltyphoon
@metaltyphoon 11 месяцев назад
C# has always had “function pointer” as delegates from 1.0.
@illoominate
@illoominate 5 месяцев назад
"Functional languages have a similar problem with I/O." Unless the functional language just says screw it, we're doing side effects. In Fexl the hello world program is just: say "Hello world." You might not call that "functional," but other aspects of Fexl *are* purely functional. You can make any section of code as "pure" as you like.
@rogerdinhelm4671
@rogerdinhelm4671 2 месяца назад
Prime rants about comments being bad, simultaneously proving he needs comments.
@hakuna_matata_hakuna
@hakuna_matata_hakuna 11 месяцев назад
crabs in every pirate movie are cursed
@KMoscRD
@KMoscRD 11 месяцев назад
You should told at the end "The name is Gophergen"
@fredericbrown8871
@fredericbrown8871 11 месяцев назад
21:20 If you follow the command-query separation (CQS) principle you have would end up writing commands that are analogous to what was understood to be procedures (perform an action) and queries that are analogous to was understood to be functions (return data). In that context, the recommandation still holds up.
@monad_tcp
@monad_tcp 11 месяцев назад
CQS is bullshit
@humanlytyped
@humanlytyped 11 месяцев назад
31:37 I see why Go stuck with hashmaps and arrays. The dogmatism has been there since 1989.
@krisdabrowski5420
@krisdabrowski5420 11 месяцев назад
4:15 Ackchually, my sub sandwich is as long as the log, but unfortunately it is also as tasty as the log.
@DePhoegonIsle
@DePhoegonIsle 10 месяцев назад
II tend to not shorten them passthrough words. more because my brain doesn't immediately jump to response & reject, and more commonly for what I've been doing, I remain verbose on the names with passing in types of things like that.. because I tend to bounce around versions and unless it's crystal clear what it is via the type (like an Entity Type named XYZ, where the only thing that could be is that Entity Type, by the name), and with shit like int, double, float, etc.. I tend to be a bit verbose and label the intent of the variable rather just juts use it's name.
@Mel-mu8ox
@Mel-mu8ox 11 месяцев назад
my variables: this.x = x; this.y = y; NO!!! This. !algebra class
@Musikur
@Musikur 4 месяца назад
28:00 at this point, I am usually, "Well lets see what happens if I take that out..."
@trapexit
@trapexit 11 месяцев назад
You don't need a language server to know what something was or where it was defined or used. We've had lookup etags / ctags. But software dev tools in general back then were far more primitive.
@davew2040x
@davew2040x 10 месяцев назад
Writing clean code really boils down to expressing yourself in a way that it makes sense to another reader. Ideally, somebody should be able to read the code almost as easily as reading a newspaper article. Your choice of words is *entirely* dependent on context. It could be the case that “int amt = 42;” is obvious in a short method, but then as needs change and the purpose of the method changes, it’s more valuable to name it “initialAmount” as you add a new variable “finalAmount”, or whatever. Names should change as the context in which the code appears changes. Whether an abbreviation is appropriate or harmful will certainly depend on the complexity of the code and the number of abbreviations somebody has to juggle. I don’t think this is altogether difficult to do, but it requires putting yourself into the shoes of another person, and a lot of programmers… well, they’re just not good at that or frankly even interested in it.
@tabsc3489
@tabsc3489 5 месяцев назад
Not quite abbreviating fever, but anyone working in defense contracting knows how communicating about anything feels like regurgitating acronym soup
@CerealOverdrive
@CerealOverdrive 11 месяцев назад
You probably know this but (assuming this is Java) forEach uses streams which (in a lot of cases) tend to be slower than loops.
@robmorgan1214
@robmorgan1214 11 месяцев назад
Man, that Tom guy is a genius!
@JakeBerg777
@JakeBerg777 11 месяцев назад
You were alive in 1989. Wow such old!
@mvargasmoran
@mvargasmoran 11 месяцев назад
13:12 classic old programmer wood worker.
@_KondoIsami_
@_KondoIsami_ 5 месяцев назад
4:01 "as" can function as a preposition. "I work as a programmer."
@tuliomop
@tuliomop 11 месяцев назад
86er aswell damn the world has freaking changed
@istasi5201
@istasi5201 11 месяцев назад
Audiobooks with prime reading up old programming books, and yelling at them when?
@tiko-
@tiko- 11 месяцев назад
this essay unironically blackpilled me into using a grayscale editor theme and i've never looked back
@bertrodgers2420
@bertrodgers2420 11 месяцев назад
what theme on vs code for example please?
@tiko-
@tiko- 11 месяцев назад
@@bertrodgers2420 i like Verdandi but it has the exact same bolding of keywords Rob Pike complained about. i prefer it to a ton of colors though
@bertrodgers2420
@bertrodgers2420 11 месяцев назад
@@tiko- ha, thanks friend, I'll take a look
@ryanleemartin7758
@ryanleemartin7758 11 месяцев назад
I haven't quite reached enlightenment with grayscale but man do I hate "fruit salad" highlighting.
@bertrodgers2420
@bertrodgers2420 11 месяцев назад
@@ryanleemartin7758 haha, same. What theme do you use atm?
@incremental_failure
@incremental_failure 11 месяцев назад
Abbreviating is bad with a large codebase. You want names that are specific or even a bit odd so you can easily find them. I started with abbrvs but now I use lngnms.
@jimxu1963
@jimxu1963 10 месяцев назад
+in an expression no space, + in a statement does. But doesn't really matter gofmt makes everything written with one way. This is the way.
@sleepyinseattle4615
@sleepyinseattle4615 5 месяцев назад
When you declare or use a pointer the syntax tells you that it’s a pointer. “Node_ptr” is as ridiculous as “length_unsigned_int” as a variable name. 🤣
@LukasRotermund
@LukasRotermund 11 месяцев назад
The "comments for each line" section gave me some bad flashbacks
Далее
$400,000,000 Saved - NO MORE AWS
23:07
Просмотров 208 тыс.
How GO Was Created - Less Is More | Prime Reacts
28:15
Просмотров 129 тыс.
Едим ЕДУ на ЗАПРАВКАХ 24 Часа !
28:51
Never waste PASTA SAUCE @itsQCP
00:19
Просмотров 6 млн
What Color Is Your Function | Prime Reacts
34:05
Просмотров 103 тыс.
The Vlang Drama
43:35
Просмотров 97 тыс.
Perl Programming in 2024 | Still a Useful Language?
12:15
Object Oriented Programming is Good | Prime Reacts
31:30
The Only Database Abstraction You Need | Prime Reacts
21:42
Clean Code is SLOW But REQUIRED? | Prime Reacts
28:22
Просмотров 278 тыс.
Goroutines ARE USELESS
12:57
Просмотров 85 тыс.
The Stockholm Syndrome of SQL | Prime Reacts
31:21
Просмотров 134 тыс.
So You Think You Know Git - FOSDEM 2024
47:00
Просмотров 1 млн
Concurrency is not Parallelism by Rob Pike
31:22
Просмотров 122 тыс.