Lex Fridman on PHP programming

  Рет қаралды 107,914

Lex Clips

Lex Clips

Күн бұрын

Lex Fridman Podcast full episode: • Guido van Rossum: Pyth...
Please support this podcast by checking out our sponsors:
- GiveDirectly: givedirectly.o... to get gift matched up to $1000
- Eight Sleep: www.eightsleep... to get special savings
- Fundrise: fundrise.com/lex
- InsideTracker: insidetracker.... to get 20% off
- Athletic Greens: athleticgreens... to get 1 month of fish oil
GUEST BIO:
Guido van Rossum is the creator of Python programming language.
PODCAST INFO:
Podcast website: lexfridman.com...
Apple Podcasts: apple.co/2lwqZIr
Spotify: spoti.fi/2nEwCF8
RSS: lexfridman.com...
Full episodes playlist: • Lex Fridman Podcast
Clips playlist: • Lex Fridman Podcast Clips
SOCIAL:
- Twitter: / lexfridman
- LinkedIn: / lexfridman
- Facebook: / lexfridman
- Instagram: / lexfridman
- Medium: / lexfridman
- Reddit: / lexfridman
- Support on Patreon: / lexfridman

Пікірлер: 378
@LexClips
@LexClips Жыл бұрын
Full podcast episode: kzbin.info/www/bejne/Y3W5qp2arJmnb6s Lex Fridman podcast channel: kzbin.info Guest bio: Guido van Rossum is the creator of Python programming language.
@FrankHarwald
@FrankHarwald Жыл бұрын
Historically it wasn't even first Unix-shell (Thompson shell) in the mid 70-ies that invented the dollar-sign before the variable but even earlier the BASIC programming language in th 1960-ies that first came up with it.
@Sergio_Loureiro
@Sergio_Loureiro Жыл бұрын
Try to learn Tcl and you will see why there the $ is essential for reading values of variables. Hint: you can have a "variable of variable" in Tcl.
@tankie9997
@tankie9997 Жыл бұрын
@@FrankHarwald Quickbasic got me used to the convention of the dollar variable, so I feel a bit more at home with php. Anything else feels like magic, 'how does it know?!'
@fnamelname3209
@fnamelname3209 Жыл бұрын
If PHP is the PCP of the coding World, Python is becoming weed, the gateway drug.
@raysubject
@raysubject Жыл бұрын
using PHP for 25 years.. working on large scale applications (current on on which i'm working has prolly 500k lines of code).. $ sign at the start of variable looks totally intuitive and handy.. i like it
@overclucker
@overclucker Жыл бұрын
In college I used to program drunk, and having clearly identified variables made a large improvement to my productivity
@ce9916
@ce9916 Жыл бұрын
Plus, it makes for ultra intuitive and legible string interpolations
@sfalpha
@sfalpha Жыл бұрын
Yeah and you have something nice to use keyword name as variable where you see it fit. Also differentiate the function calls vs closure function reference by variable clearly.
@darkwoodmovies
@darkwoodmovies 10 ай бұрын
@@overclucker In college? I feel like half of my code for work is written while I'm either drunk or stoned. Work projects are boring otherwise.
@soufiane4527
@soufiane4527 8 ай бұрын
feel you ...@@darkwoodmovies
@evilcultleader
@evilcultleader 8 ай бұрын
I like the dollar sign. It’s quick visual reference and when you type it into the editor you immediately get a list of all variables in scope.
@JS-jh4cy
@JS-jh4cy Ай бұрын
Which editor?
@evilcultleader
@evilcultleader Ай бұрын
@@JS-jh4cy I use Jetbrains IDEs mostly
@AtiqSamtia
@AtiqSamtia 29 күн бұрын
​@@JS-jh4cy phpstorm
@ob34915
@ob34915 18 күн бұрын
@@JS-jh4cy phpstorm
@netsudro
@netsudro Жыл бұрын
I still like the $ in php. It helps me identify variables quickly. When I started learning Javascript I missed this feature it a lot. Over the years I don't write a lot of code, I simply reuse a lot of my old functions that I copy and paste. Laravel also makes my life a lot easier with a lot of build in functionality.
@przemekkobel4874
@przemekkobel4874 Жыл бұрын
But you can use $ in JS the same way as in PHP. Personally I wouldn't do that to avoid confusion when working in editors with opened both JS and PHP files.
@videomakville
@videomakville Жыл бұрын
I actually use the $ in my JavaScript. Probably my old php brain, but it works for me.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 Жыл бұрын
Variable reference: $var Function call: func() Instance variable reference: $ins->var Instance method call: $ins->func() Why isn’t the instance variable reference “$ins->$var”? Why can’t you “identify variables quickly” in that situation?
@jaredbouwer3053
@jaredbouwer3053 Жыл бұрын
I’m not as bothered with the $ as having to type -> for a method call. A simple period is just so much better imo
@alexandersuvorov2002
@alexandersuvorov2002 Жыл бұрын
-> came from C++, it was pretty much standard back in the day to call methods on objects using -> syntax, most software engineers were familiar with it. Also dot is reserved for string concatenation
@JavierAlbinarrate
@JavierAlbinarrate Жыл бұрын
@@alexandersuvorov2002 absolutely true, nevertheless still annoying, much more than the $ sigil
@alexandersuvorov2002
@alexandersuvorov2002 Жыл бұрын
@@JavierAlbinarrate I have no issue with any of these things. PHP by far IS the most advanced language for web development. Nothing can beat it.
@outofboundsbro
@outofboundsbro Жыл бұрын
I never knew people were annoyed by '->' syntax. But I guess it's because my first programming language was C++ from my intro to CS course so I liked it for that reason.
@Doug_Diego_Cazadores_Cassidy
@Doug_Diego_Cazadores_Cassidy Жыл бұрын
Me too. I think $obj->propertyormethod and $ra['key'] are really over punctuating. Either could be a dot. Afa string concatenation, the + or & would actually make more sense, cuz youre adding strings to stuff. The => is totally goofy, there's no reason it couldnt just be an = sign.
@minor12828
@minor12828 Жыл бұрын
I love the $. I think it helps a lot for code readiability.
@jantuitman
@jantuitman Жыл бұрын
PHP is actually ahead of python in terms of how usable the type annotations are, and they are also enforced in PHP (not in python, see other clip of Lex and Guido for discussion about that). Yes, the syntax is very dated but I love how fast PHP currently is improving and modernizing. Also code written with the Laravel framework is very testable, highly structured code and I have seen other frameworks in more “mature” languages (e.g. Java) that cant stand up to it in terms of testability and quality.
@takeiteasyeh
@takeiteasyeh Жыл бұрын
PHP 8.1 is such a nice improvement. Thank you strict types and named arguments, and return types just to name a few
@parlor3115
@parlor3115 Жыл бұрын
@@takeiteasyeh And constructor-defined properties. I mean, I still hate PHP, but the way the core team is racing against time to make development in it not such a terrible experience, is truly commandable.
@ClaudioBrogliato
@ClaudioBrogliato Жыл бұрын
My last contact with PHP was with 7.4. It was awful for me. The dollar sign, the arrow (which in italian keyboard you are forced to type by also holding the shift but on just one character) instead of a dot, the plus sign in string that works but not as in other languages, the typing system which is nice but the language still is duck typed (so you get an error on the IDE but the code still "works"). It's not my cup of tea.
@bdnugget
@bdnugget Жыл бұрын
@@ClaudioBrogliato The arrow thing is a C/C++ thing. And to enforce the typing system you put declare(strict_types=1) in the beginning of your script (similare to the 'use strict' in JS
@ClaudioBrogliato
@ClaudioBrogliato Жыл бұрын
@@bdnugget If we were to enforce types the whole thing would explode since it's old legacy code. As for the arrow many languages which derived from c++ have no arrows, so could have PHP, it didn't and it sucks.
@bkucenski
@bkucenski Жыл бұрын
I felt at home with dollar sign variables because I came from BASIC. In PHP, constants don't have a dollar sign. So it's easy to tell when something is a constant and when something is a variable. Many of the quirks in PHP like floating point math and parameter order come from the underlying C. I think the biggest source of bugs with the dollar sign is when people use $$ for variable variables. PHP lets you code like a fool which is good for the hiring team. They can see which coders do things that make life difficult just because they can and "it works" and not hire them. Good PHP coding comes from developers learning how to code properly through experience and guidance, not the language.
@StoneColdMagic
@StoneColdMagic Жыл бұрын
Same. We always pronounced it "string" so X$ was pronounced "X string" It makes me feel at home.
@raysubject
@raysubject Жыл бұрын
deep truth ! i'm saying this all the time, only really great coders can write clean robust quality code in PHP .. it's like test how good coder is.. if i see great code in PHP, i know i'm looking at work of exceptionally good coder .. or turn it upside - if you can write great code in PHP, you will easily great code in C++, JAVA or any other language 😂
@miguelgd1985
@miguelgd1985 Жыл бұрын
Marvelous Sir
@fisharepeopletoo9653
@fisharepeopletoo9653 Жыл бұрын
I have been learning kotlin in my own time. I have built a few applications (very simple stuff, I built a connect four game, a calculator, first thing I made was a simple password generator etc.) I am now near the end of my first year of my computer science degree, and god I have learned to hate php. I get assignments and I think about them in kotlin, I literally go write the code in kotlin as a form of pseudocode then try to swap it to php, and it just doesn't. Currently doing my final for PHP which involves building a database from API retrieval if no records already exist in the database, else pulling the records from the database and taking specific data from each entry to create a new, more specified database. I did this in kotlin in less than 2 hours as practice, but I'm now on day 3 of trying to do it in PHP haha
@evilcultleader
@evilcultleader 8 ай бұрын
The fact that PHP lets you code like a fool like this is one of my absolute favorite things about it. PHP is a *fun* language, and it’s my favorite language because of it.
@xbmcme9768
@xbmcme9768 Жыл бұрын
I have found that most people complain when they learn a second language because they have a first language to compare against. The $ in PHP is a bit odd, but doesn't bother me at all. Neither does the arrow. What bothers me the most is the arrays with the => due to bad keyboard ergonomics for those two keystrokes.
@nachocdbz
@nachocdbz Жыл бұрын
Spanish layout is great for programming. [] and {} are ALT + keys that are really close, ' and ` are also easy to reach (but ` requires a space after the key or it could be used as tilde), - and > on the opposite sides of the keyboard and < > are its own key.
@СергейЯрмошук-ц8л
@СергейЯрмошук-ц8л Жыл бұрын
🤣Seriously? I think you needed to write something and you did it. Use a normal IDE, such as phpstorm, in which it works out of the box, and you will be happy
@Sergeant_Camacho
@Sergeant_Camacho Жыл бұрын
For me the dollar sign is very helpful to notice variables. In JS, variables can be mistaken for in-built properties.
@kayakMike1000
@kayakMike1000 Жыл бұрын
Maybe if you practiced real programming languages for a little while you wouldn't need a dumb crutch. Look at Hungarian naming convention for even worse bullshit
@ivanpartida7467
@ivanpartida7467 Жыл бұрын
Not if your editor does syntax highlighting correctly
@nikolas4786
@nikolas4786 Жыл бұрын
@@ivanpartida7467 he must be one of these sublime text weirdos
@OliverUnderTheMoon
@OliverUnderTheMoon Жыл бұрын
nothing stopping you using $ in your JavaScript code🌚
@gerogep3666
@gerogep3666 Ай бұрын
The $ makes my eyes bleed. And it's annoying to type.
@SzaboB33
@SzaboB33 Жыл бұрын
as someone who learnt coding by learning PHP I had the opposite problem: "how do I know if it's a variable if there is no $ before that? :D" Now I don't use php anymore but it would just annoy me. Even more because I use the US keyboard layout instead of the hungarian and it's really unconforable to use the $ sign in my opinion.
@dhdhhxhxdhdhdhdhdh9742
@dhdhhxhxdhdhdhdhdh9742 Жыл бұрын
magyar fiútestvér 😅
@ichanmich
@ichanmich Жыл бұрын
either everything is a string and you have to mark variables explicitly (e.g. with a dollar sign) or everything is a variable and you have to mark strings explicitly (with quote characters)....
@markmuir7338
@markmuir7338 Жыл бұрын
That's a nice simple explanation, but it's not actually the case. It's easy to create language grammars that have context sensitive tokens - eg if a word matches a predefined variable name, then interpret it as a variable; otherwise it's something else (eg a string). That's how most programming languages are today. A context dependent parser is more complicated and takes up more memory however - but that's irrelevant today. There are some exceptions from the past, including a language which I've forgotten the name of, which treated any unrecognized syntax as comments. This made the code very readable, but minor typos would cause code to unexpectedly disappear. I wonder why that never caught on...
@infinitelink
@infinitelink Жыл бұрын
@@markmuir7338 now do that in a calculator... Suddenly the memory consumed by first stopping to define variables before they're used matters a lot... These langs aren't compiled and they're meant for real time use on machines that defined memory in terms of a number of WORDS.
@markmuir7338
@markmuir7338 Жыл бұрын
@@infinitelink Even so I would argue that the memory footprint of a linear reduction parser with context-dependent identifiers is tens of KB. Well within the limits of even sub-threshold CMOS chips used for very low-power calculators.
@volvoxpl
@volvoxpl Жыл бұрын
I was using PHP for some time and I can't remember any bugs that occured because if $ sign.
@notDacian
@notDacian Жыл бұрын
Sorry Lex, i dont agree with you on this! For me (PHP developer with 5+ years exp) the $ sing is very helpful, it clearly defines what a variable is and what not. Also i dont see how this impacts bugs and issues with code, if you are using any modern syntax highlighting you should see immediately if there is a variable without the $ sign.
@DreamskyDance
@DreamskyDance Жыл бұрын
Yeah, same here. I mean..you just type it automatically when writing the name of the variable, dont even think about it... Lex is probably sporadically programing in PHP so its weird to him.
@kayakMike1000
@kayakMike1000 Жыл бұрын
You have been exposed to an awful language for so long, you have been infected with a mind virus. C++ is a similar cognito hazard.
@GonzaloMassa
@GonzaloMassa Жыл бұрын
I understand that for you, the dollar sign is a PITA, but error prone and source of a lot of bugs? If you program in PHP you'll simply not forget to use the $... can't see your point on that argument...
@RyanHellyer
@RyanHellyer Жыл бұрын
Interesting. I always thought the $ was just there to make it more clear that it was a variable.
@sidewaysdesign
@sidewaysdesign Жыл бұрын
Given that PHP is typically mixed in with a bunch of HTML, I don't mind the dollar sign as a little beacon to make variables stand out more.
@derghiarrinde
@derghiarrinde Жыл бұрын
$ is NOT a source of a lot of bugs. (Maybe for 5-year olds it is.) You can say the same thing about strong typing and pretty much any feature of any language. The more it is used, the more "source for a lot of bugs" it is. Nonsense.
@colinm3130
@colinm3130 Жыл бұрын
i like the dollar sign for readability. Not a deal breaker, but very visible.
@ChrisHorneVL
@ChrisHorneVL Жыл бұрын
I wish PHP had adopted dot syntax for object to property vs the -> syntax. And used + for concat instead of the "." but it is what it is. I'm really happy with how far PHP has come; especially in the last 10 years with Laravel.
@psychopath_syd
@psychopath_syd Жыл бұрын
True that. At least offer this keeping that dot concat and arrow.
@yungifez
@yungifez Жыл бұрын
You get muscle memory though But switching to and from languages can be annoying
@ChrisHorneVL
@ChrisHorneVL Жыл бұрын
@@yungifez For sure.. I just mean purely for aesthetics.
@yungifez
@yungifez Жыл бұрын
@@ChrisHorneVL yeah
@JJJMMM1
@JJJMMM1 Жыл бұрын
Small breaking changes can be painful in migration. This would break about every other line of code on every library in existence. So obviously not going to happen since it's just an aesthetic change. What actually bugs me is that PHP uses the same syntax for indexed and associative arrays, and the core functions may or may not treat those differently. Which do and which don't? RTFM I guess 🤷It has led to some non-obvious bugs over the years. I wish they bit the bullet and added a dictionary structure (like in PHP HACK) with low-level function support.
@DreamskyDance
@DreamskyDance Жыл бұрын
Such a dumb take. Why would you have a problem with $ ... only from pure readebility standpoint its more practical. I mean, if you program enough there is no way you can forget adding $ at the start of the name of the variable, you just type it automatically. I even use $ for variable names in JS when declaring global / higher level of scope variables, so i know at a glance which scope this variable has.
@trex511ft
@trex511ft 21 күн бұрын
Anyone coming from another language notice right away how annoying is to have to type it ALL THE TIME and not only at variable declaration. $somesht = 10; $someOthersht = 0; for ($i = 0; $i < $somesht; $i++) { $someOthersht += $i } echo $someOthersht; notice how in a simple 5 line code I've written $ about 9 times. The $ sign is good for readability but terrible for writeability.
@razt3757
@razt3757 Жыл бұрын
Lex should interview Rasmus some time. There are some interesting things to say about Php, especially about some of the new programming styles outside standard platforms (apache, fpm etc), like libuv paradigms which have completely different programming styles than traditional php and huge performance boosts with the JIT. Sometimes I wonder if php-apache and fpm were really good inventions all things considered. Rasmus famously said in an interview that that's php's strength because it allowed providers to lease out portions of servers instead of whole dedicated servers... but I wonder if that's really still a strength in a world with docker and wasi. It would be an interesting interview, and you should really push a bit on the libuv stuff since so many people just don't know about it (and probably will never find out about it) simply because it's not being taught as standard php at all, instead young programmers are being shoved into CMS stuff just because at this moment in time it offers better jobs. Would be an interesting interview to say the least. PS: the "$" syntax is annoying in most cases, but there are some quite unique things you can do with it, like referencing a dynamic variable name. like this: $$myVariable, using "$$". In other languages you would need and actual pointer reference, or you straight up can't do it without some middleman logic. It looks like reflection, but it's not, it actually getting JITed on the spot. Another example would be: $myInstance->$methodName() Really bad practice in most use cases, but you can do it, and it's still not using actual reflection, which makes it fast.
@alexandersuvorov2002
@alexandersuvorov2002 Жыл бұрын
The last example can be done in JavaScript as well. There’s nothing wrong with this syntax.
@WinstonHope
@WinstonHope Жыл бұрын
Rasmus would lose brain cells coming on this show talking about programming!
@alivenumber5
@alivenumber5 8 ай бұрын
I'm not sure I follow on the dollar sign being a source of a lot of bugs. It's always provided me a very quick and readable way of visually parsing code. It seems that help rather than hurt. Typing an extra character isn't any more onerous than using semicolons or using tabs for scoped code.
@HarpreetExplores
@HarpreetExplores Жыл бұрын
Imagine not liking php because there’s a dollar in variable. Seems like lex just looked at someone’s php code and went “nah”
@podcasthostel
@podcasthostel Жыл бұрын
Lex is an NPC , with mob approved takes being his norm from what I can see. The best these PHP haters can muster is $ signs lmao. They just jelly that us PHP devs out here makin $bank
@elijahbuscho7715
@elijahbuscho7715 Жыл бұрын
Right before this they were talking about syntactic design choices of programming languages, specifically the indentation in python. This is just an additional example of an odd syntactic choice. He never said that is the reason he doesn't like PHP. He never even said he didn't like PHP. He just said, the $ part of it is cringe, which it is. I'm a big fan of PHP, but there is a reason why every other modern language doesn't use a $, and it's not because plain variable names have just become convention; it's because the $ is superfluous.
@podcasthostel
@podcasthostel Жыл бұрын
@@elijahbuscho7715 bruh the $ is tight. Helps you know that you are makin $bank
@swordarmstudios6052
@swordarmstudios6052 Жыл бұрын
@@elijahbuscho7715 A strong opinion in either direction on this is actually kind of weird. It's got some positives for readability - but it is both the least of PHP problems or the least of it's advantages, however you look at it. It's sort of like counting cup holders when deciding which car to buy.
@elijahbuscho7715
@elijahbuscho7715 Жыл бұрын
@@swordarmstudios6052 no one was deciding to buy a car in this video though. They were discussing interior design features of cars. PHP with the $ is like a car without cup holders. You can make up advantages to that like saying cupholders incentivize people to bring in drinks, which distracts from the driving, and going cup holder-less makes the PHP car more drivable, but in reality it's an out-dated artifact that only detracts from the language. Cup holders alone shouldn't sway you to buy the car or not, but having no cupholders detracts from the value of the car like how $ detracts from the developer experience of PHP. Does that make sense?
@jasontfrom713
@jasontfrom713 Жыл бұрын
Came here to listen to Lex talk about PHP, left with a CS degree in CLI
@dataanalystbynight4375
@dataanalystbynight4375 Жыл бұрын
He thought he was being smart then the old man sat him down and was like “let me tell you about life, “my son” lol”
@TricoliciSerghei
@TricoliciSerghei Жыл бұрын
Working with PHP for 9 years now.. I don't think that the dollar sign is a source of bugs for me, I put the dollar sign automatically.. Just human inattentiveness and flawed program flow usually screws me up.
@Olegatorse
@Olegatorse Жыл бұрын
It's a source of bugs for people who don't use php often enough. I can easily switch from js to python, for example, but php is always painful for me.
@gregmattson2238
@gregmattson2238 Жыл бұрын
yeah I disagree here with lex. seeing a dollar sign and knowing where all the variables are its super easy to do a sanity check. In fact thats the ironic thing - out of the box, python is VERY prone to errors of this type. Spell a variable wrong in python and without doing an extra linter you have a bug just waiting to go off, your code is a minefield. And not being able to scan the code for the variables makes it even worse - for example, its very difficult to tell between what is a function call versus a code reference.
@Trongate
@Trongate Жыл бұрын
If you see a dollar then it's a variable. How is that complicated?
@swordarmstudios6052
@swordarmstudios6052 Жыл бұрын
I always wonder about developers who are counting key-strokes. You don't spend your days pressing keys. You spend your days reading, diagramming, understanding, subdividing problems, saying "WTF!" and then a few hours on a good day actually typing.
@promisenwanno5969
@promisenwanno5969 Жыл бұрын
Baseless arguments. You have not mentioned any problems with the functionality of the language. The language performs excellently where it promises. If you don't understand it go ahead and use what you understand. Moreover, you emphasize in getting better as a programmer and not fight about languages. Every language has its users. We can argue forever which is better than the other. Can you just be a good programmer and get some rest?
@davidpham7937
@davidpham7937 Жыл бұрын
It is interesting noting how these choices at the birth of computing still influence things so far down the road, similar to the evolution of languages themselves. All the French, Latin, Greek, and German packed into English placed in strange sharp corners, or in math where Delta is used idiomatically to represent rates of change. The protocols and practices we come up with take on a life of their own and spread mimetically-- the descendants of the shell interpreters live on.
@TheNewton
@TheNewton Жыл бұрын
And constrained to what characters are on keyboards and its lack of math symbols.
@cmoullasnet
@cmoullasnet Жыл бұрын
Funny, I've always preferred having the leading $ to indicate a variable. Regardless of technical requirements, I feel it just makes things more human readable - particularly if you get stuck in a basic text editor without code highlighting. You always know what's a variable and what's not.
@clintquasar
@clintquasar Жыл бұрын
I like it too
@ElteHupkes
@ElteHupkes Жыл бұрын
I've never been sure if it was because my first language was PHP, but almost 20 years and many languages later I think I agree I like the dollar sign variables. If only because it some times allows me to name variables after certain keywords.
@yungifez
@yungifez Жыл бұрын
How to find all variables in a file Highlight dollar sign
@tristunalekzander5608
@tristunalekzander5608 Жыл бұрын
When do you need to use a basic text-editor? You should never need to do that... And it arguably makes things less readable, sometimes it's not clear whether a variable is being initialized or reassigned, because it looks the same everywhere. It's also just ugly and a waste of bytes.
@tristunalekzander5608
@tristunalekzander5608 Жыл бұрын
@@yungifez That's true but then again, I've never needed to do that in my 7 years programming in all variety of languages lol
@CdrRogue
@CdrRogue Жыл бұрын
I'm not sure how $ is a source of bugs, it's never been an issue in all the years I've been using it. It's never bothered me personally, but I'm extremely glad PHP didn't bring along the @ and % prefixes from Perl's array and associative array syntax.
@СергейЯрмошук-ц8л
@СергейЯрмошук-ц8л Жыл бұрын
That's right, it can only bother those who use it little.
@10x-developer
@10x-developer Жыл бұрын
With all the respect Lex, I suppose you might be wrong. The Dollar adds the Value to PHP. It is a rich language.
@harland5535
@harland5535 4 ай бұрын
A dollar sign in front of a variable feels natural to me, but it's probably because PHP was the first programming language I learned - it's just what they taught me when learning web development in college.
@AndrewTSq
@AndrewTSq Жыл бұрын
Would have been interesting to hear why you think $ would introduce bugs? not sure I get the logic behind this.
@jefriaritambunan2796
@jefriaritambunan2796 Жыл бұрын
Guido knows how to explain the dollar sign of PHP.. Wow...
Жыл бұрын
I generally like the dollar sign. Despite it being a bit annoying to type on a Danish keyboard. It's particularly helpful when calling closures or using variables to reference a property on an object, e. g. $object->$property or $result = $callback(). Apart from that I'm mostly indifferent. I don't remember it ever causing me any problems in terms of bugs, though. That sounds more like a case of being used to a language that doesn't use them, just like I constantly add semicolons in languages that don't support them, as I primarily work with PHP. For JS you can just add the dollar sign if you like it, and I actually use it to distinguish jQuery elements from vanilla elements.
@mucholangs
@mucholangs Жыл бұрын
*That sounds more like a case of being used to a language that doesn't use them* You nailed it. People generally are creatures of habit. Once we get used to something, we do not want to learn to do it another way, unless the new way confers significant advantage. var myvar - Javascript $myvar - PHP These are just different ways of saying the same thing.
@charmingjinx9379
@charmingjinx9379 Жыл бұрын
As Guido said, see a $ you know instantly a variable is defined here. What would Lex suggest? It annoys me to type 'var' for every javascript named variable, but we all have our crosses to bear.
@trefwoordpunk2225
@trefwoordpunk2225 Жыл бұрын
Shouldn't be using var in 2022!!
@maniaq77
@maniaq77 Жыл бұрын
an absolute HUGE bonus for me (compared to, say, Javascript) is I can include that variable - because of the $ - *inside* a string, using double-quotes, and not even have to do any awkward "bla " . $variable . " bla" nonsense - because the compiler understands "bla $variable bla" - something only recently worked around in other languages by using back-quotes
@JavedSyedTheGreat
@JavedSyedTheGreat Жыл бұрын
I swear just two days back (as a DevOps engineer, part of the product team, We have our own offerings as a central team) I was assigned a task of creating a Front end UI, for advancedsearch backend API built on Api gateway, lambda function and a DynamoDB for Database. This was the first time that I was expected to work on HTML-CSS, Javascript/Jquery and on the Backend side was PHP. The task became so complex for me when I had to send back a string of multiple array with special characters included, I was so stressed with making logic for it.... my approach was to make a function in jquerry that will handle all the string manipulation and then send it to backend for a valid URL search... it took 2-3 days for me in figuring out the logic for it itself as the search was not consistent at all.... I decided to take help from other team's UI guy, he suggested me to rather let php do the string manipulation and front end just accept value that will send it to backend php side, we were using f3 function object, which again was old... It only took my guy 30 mins to sort everything with a couple URL Encoding function to string value. I realized how important it was to have the basics first for the approach of creating a logic to then how the urls are handled and how PHP eases up a lot of it....
@stewartdahamman
@stewartdahamman 10 ай бұрын
Totally, coding in PHP is alot like diarrhea - it really helps with the flow
@enriquesneffels3053
@enriquesneffels3053 Жыл бұрын
The only ones killing PHP is the JS community, but PHP had 72% of the web by 2010, and 79% by december 2021. The part where Lex says "I still program in PHP" it's like saying "I shouldn't at this point", but the truth is there are very few programming languages (if there's any, really) that could be better than PHP for the web, and Python is not one of them. I would only put C# ahead of PHP in terms of "advantages".
@thatonesnowboarde
@thatonesnowboarde Жыл бұрын
I have been using PHP for years and have decided to switch to golang for web programming. Having everything in one package, to include the webserver and it being compiled is a no brainer. And go is simple to pickup
@kp8752
@kp8752 Жыл бұрын
Elixir
@dmonitize9011
@dmonitize9011 Жыл бұрын
@@thatonesnowboarde Most of the web runs on apache, throw your php files on there, no compile, done.
@jonathanlaperle6165
@jonathanlaperle6165 Жыл бұрын
it's not a very good metric, a stupidly high % of the web is just wordpress(php) created by non-tech people which is why the number is so high, but these people aren't really php devs they just build on top of something built in php. A single person can create/maintain dozens/hundreds of simple websites like that but you need thousands of devs to maintain a single website like google.
@thatonesnowboarde
@thatonesnowboarde Жыл бұрын
@@dmonitize9011 I am aware of that, but I am annoyed by PHP frameworks, I dont think the go web frameworks are going to change much, and I think its easier to deploy large scale applications that can do much more than PHP can do and much faster
@xyzzyx348
@xyzzyx348 Жыл бұрын
Just don't use php if it bothers you that much
@motomono
@motomono Жыл бұрын
If you don’t like the PHP just don’t use it. You don’t have to. I can’t understand all this religious crusade against the PHP. Seriously. It’s ridiculous. Totally ridiculous.
@14types
@14types Жыл бұрын
The dollar added because PHP works with a big bunch of text in HTML and to make it easier to distinguish between text and code, a dollar was added.
@jaumeguimeramarquez2244
@jaumeguimeramarquez2244 Жыл бұрын
What I like the most of $ is that it allows me to loop throught the vars just typing '$' in the search tool of the IDE. On the other hand, a file-by-file strict_type declaration is kind of annoying. I hope someday php will be strongly type by default.
@playtf2
@playtf2 Жыл бұрын
Guido explaining a senior google ML developer with a huge c++ background what interpolation is, good times.
@mp9305
@mp9305 Жыл бұрын
Lex is a fraud
@32gigs96
@32gigs96 Жыл бұрын
Dudes spent 11 minutes talking about indentation vs curly braces. Neither of these clowns are deep. Do not try to come back with “guido invented python”. It is a trivial stack machine with hash maps for objects. Algorithm W is probably above their heads. Lex probably couldn’t cps convert identity.
@snarfbomber298
@snarfbomber298 Жыл бұрын
Be nice
@tomydurazno6243
@tomydurazno6243 Жыл бұрын
@@32gigs96 yes, random guy in KZbin knows more about software than the creator of python
@bruuuuuuuuuh
@bruuuuuuuuuh Жыл бұрын
Context is it's a podcast, they're not just talking to each other, they're breaking down how things work for the audience to better understand.
@coced
@coced Жыл бұрын
7min of Lex's face saying "i fu****g hate PHP"
@StoneColdMagic
@StoneColdMagic Жыл бұрын
I think typing $x is a lot faster and easier than typing "int x" or worse "String x" or (in JS) let x, const x, var x, etc. I think $x is about as simple as it gets. :0]
@gessegoncalves6493
@gessegoncalves6493 10 ай бұрын
These people overestimate Python, as a php programmer who also programs python, I prefer php
@JS-jh4cy
@JS-jh4cy Ай бұрын
$ before variable alot like basic language using $ signs
@patrickpaganini
@patrickpaganini Жыл бұрын
$ sign is great. Not quite sure why Lex or whoever he reads, finds it such a terrible thing.
@akhilbabu_
@akhilbabu_ Жыл бұрын
Noice
Жыл бұрын
I'm so happy with PHP8.1 + Laravel
@5014eric
@5014eric Жыл бұрын
If you don't like the $ in PHP, you wouldn't have liked Perl. $ for single value, @ for array, % for hash. Then the 3rd member of array @a is not @a[2] but $a[2], because we're talking about a single value.
@illegalsmirf
@illegalsmirf Жыл бұрын
Perl is for gay weirdos
@illegalsmirf
@illegalsmirf Жыл бұрын
The fact is that it's no big deal, if you dislike an entire language because of one small convention then you're nuts.
@JagdeepSinghKalsi
@JagdeepSinghKalsi Жыл бұрын
Despite the clarification on the topic, the question at the end being "How many people actually *like* the $ sign" - this demonstrates the resilience to change perspective. The answer to that would be "It does not matter - how many people like it or not", or even if it is a pain-in-the-neck or not. Lex asked a question, Rossum answered it - if you don''t like it, it doesn't matter. If you have to write code in shell script using variable, you have to use the $ sign. You may very well happily continue to dislike it. The dislike does not makes it "unusable" or "difficult-to-use". It's the way it is. This is the best thing about computers, and computer-programming-languages - these do not care if you like something or not, but the output will be provided based on the input. You may continue to dislike the output you see. (I think I stopped making sense before writing the comment, and I have realised it just now, hence, shall stop).
@eugrus
@eugrus Жыл бұрын
The $-sign looks UNIX to me! I love it!
@NicholasDunbar
@NicholasDunbar Жыл бұрын
The most annoying thing is all languages rely on a lot of punctuation which will give you pinky arthritis 😂
@jibkas
@jibkas Жыл бұрын
Oh PHP is a great coding language but I can't use it because there is a dollar sign ... What a LAME excuse for haters.
@takeiteasyeh
@takeiteasyeh Жыл бұрын
Coming from basic to perl to php, the change in symbols was somewhat welcome, although the alure of non-symbolized variables in C i always thought was cooler, and somewhat preferred in the back of my head
@goktugerol1127
@goktugerol1127 Жыл бұрын
I use peso sign $.
@treyday5200
@treyday5200 Жыл бұрын
This is the smartest comment section on youtube
@SH-zf7in
@SH-zf7in Жыл бұрын
this guy lex seems like the type of guy who just scratches the surface of a subject and then thinks that he's an expert.
@RickBeacham
@RickBeacham Жыл бұрын
Haha! Yeah that annoying $ might be bothersome however it can be a blessing since it identifies the variables. Switching between other languages I admit I forget to type the dollar sign often. Its never been a source of bugs for me though. The biggest problem has always been deprecated functions, legacy PHP code, poorly written PHP code, and exploits.
@hermanyosef1276
@hermanyosef1276 Жыл бұрын
I love php variable use $, it makes me feel rich, dollar..😊
@some_lurker
@some_lurker Жыл бұрын
Why didn't he explain why he thought the dollar was the source of a lot of bugs? I've never heard that, and it was glossed over. I don't watch Lex much, but I feel like he thinks he's smarter than he is, or at least doesn't know everything he's talking about. "Fake it 'till you make it"
@dschledermann
@dschledermann 4 ай бұрын
The "$" is just some old baggage which PHP has. Like the "->" for method or property access. There're many places where PHP is more verbose than it really needs to be, but that's mainly a product of PHP being old. If you were to design a programming language from scratch today, you could design something much less "noisy" and with fewer pitfalls. Compare PHP to Rust: - "function" becomes "fn" - Nothing like "$" - "->" is just "." - Namespaces are implicit. - "return" statement is implicit in most cases. - No such thing as exceptions. If a function is fallible, it will return a type where errors can be contained. Most of the time it's just a lot less typing. This is not specific for PHP and Rust. It's just a natural development.
@elderofzion
@elderofzion Жыл бұрын
don't ask simple questions if you don't want uber complicated and long answers
@tuxlector
@tuxlector 10 ай бұрын
The most biggest problem with programmers and coders is emotional attchment towards tool they use. Nobody ever complained about jQuery's main character or JS template literals. Nobody ever complained about bash or pearl implementation decisions .. no one ever complained about default shell style (user:~$) for regular user on each and every terminal .. but when the word is about PHP .. oh boy. :))) I mean, It's simply hillarious how easily noobs can be spotted. Not a single medior/senoir ever complained about those implementation decisions. Yes, that can mean $ = serpent .. $atan or whichever .. but, does it ? Even if it does, then, one should simply abandon writing scripts for the http(s) protocol and internet in general, because www = 666 and You can't avoid hell and lake of fire if You continue to do so.
@zbynekriha
@zbynekriha 8 ай бұрын
before PHP I used to program in qbasic, pascal, c/c++. at first writing dollar was very annoying, but I got used to it quite quickly, when we wrote something in java I wrote dollar again many times, now I alternate PHP and TS a lot and I don't care, but in python I miss dollar a lot.
@laughingvampire7555
@laughingvampire7555 Жыл бұрын
excuses for mediocrity & lazyness. the `$` & every other quirk in PHP/PERL can be removed in new versions and if you want people to update to your new version of software add a transpiler just like Apple did when they changed syntax for ObjectiveC
@babatundeojerinde
@babatundeojerinde Ай бұрын
Just say you don't like PHP. The dollar sign isn't error prone. You may not be used to it, but it sits well with it. In fact, it's one of the features that makes it a bit more readable compared to other C styled languages that don't use ir.
Жыл бұрын
I think a somewhat important detail is that the dollar sign is necessary in shells particularly because strings don't need to be quoted. In PHP it technically isn't necessary. Strings without quotes still worked in PHP until recently, when they finally did something about the whole undefined constant business.
@jonnyso1
@jonnyso1 Жыл бұрын
But its still neat for concatenation "foo$bar"
@fpgroups
@fpgroups Жыл бұрын
To question the $ as prefix to a variable reveals lack of depth and lack of history on OSes like XENIX, UNIX and other flavors of UNIX ... not to mention sed, awk, printf and other command line tools once life savers now, evidently, forgotten.
@delturge
@delturge Жыл бұрын
It is not a matter of liking the dollar sign. If you come to PHP from sh/csh/ksh/bash/Perl, then the dollar sign is consistent with what you are use to. In that linear trajectory, nothing is strange or cumbersome about the dollar sign. In the modern era of Python, JavaScript, Java, and other languages, the dollar sign used to denote variables would seem antiquated and out of place. I do not quarrel or contradict this idea, just that if your programming order included UNIX / Linux shell and Perl first, then the dollar is fine. This perspective is not a modern perspective, however, and I understand why some dislike the dollar sign convention. However, since shell programming is still used with dollar signs, my suggestion is to get over it, or do not use PHP.
@ZenoLee0
@ZenoLee0 Жыл бұрын
What is this question about the $ sign? Has this person never worked with shell scripts? It's not just PHP, but all Bourne shell children, BASH, Korn, Z-shell.
@osmmanipadmehum
@osmmanipadmehum Жыл бұрын
Im thinking they should be able to allow for coding without the prefix
@MatveyAndreyev
@MatveyAndreyev Жыл бұрын
As a person whose webdev job has ditched PHP, I'd like to warn others that this did not make anyone happy. it's just a social standard - to whine about PHP but not whine about the problems we are currently in. PHP as a language has its problems, they are listed on i.e. PHP sadness website. PHP as part of webdev stack probably has less problems than not PHP, like some out-of-the box stuff or adoption by hosting providers.
@timebroua
@timebroua Жыл бұрын
the $ isn't source for a lot of bugs, as Lex said. This isn't true. Wondering where he get opinion like that. In over 18 years of programming, the $ had never be a source of bug for me.
@WinstonHope
@WinstonHope Жыл бұрын
I can see why this video only has 56k views. Who actually believes you even know what code looks like? Notice how SLOWLY this other guy is talking for Lex to understand!
@fran.sancisco
@fran.sancisco Жыл бұрын
If you're not a php programmer, of course "the dollar sign" is error prone. The fact that you are lazy to SHIFT 4, is another subject :).
@justinhale5693
@justinhale5693 2 ай бұрын
It's interesting that 'DNA wouldn't be designed like that' and code, a designed thing, is designed with bugs and redundancy.
@user-baev
@user-baev Жыл бұрын
"like biological systems" that's a great analogy, makes you think whether IT is just a next step of evolution
@Trooper266
@Trooper266 Жыл бұрын
PHP is a freaking mess. You shoud rewrite whatever web stuff that you have from PHP into Python/Django.
@theaugmenter
@theaugmenter Жыл бұрын
Lex doesn't know anything about PHP, $ sign is the only thing he know about it. Why even mention it. Props to Guido for not bringing PHP down without need.
@kadwallenboscogne1745
@kadwallenboscogne1745 Жыл бұрын
Started with C/C++ and $ sign in PHP is far less annoying than indentation system in Python. Do devs nowdays are really plan to waste their time whining about variable naming convention ?
@aftalavera
@aftalavera Жыл бұрын
Sure everyone is bothered with the dollar sign! Outraged! Then, they go and TRY to do it in Rust! 😂 Rust is a lot less cumbersome.
@nickvledder
@nickvledder Жыл бұрын
Ah, come on, what are these guys talking about?! A $-sign in front of a variablename…. How uninteresting.
@johnsample9640
@johnsample9640 10 ай бұрын
Using $ permeates thru time because it worked, perfectly, why change it ?
@bestopinion9257
@bestopinion9257 Жыл бұрын
This is not about PHP, it is about $ symbol. Yeah, PHP uses $ symbol, so what? That is the last thing you should worry about.
@ZAcharyIndy
@ZAcharyIndy Ай бұрын
They use $ , so we can print() more money on demand 😂
@virgiliustancu9293
@virgiliustancu9293 Жыл бұрын
I find those tabs in Python so stupid... You can find stupidity in everything.
@cactus1
@cactus1 5 ай бұрын
I've always seen the $ sign in code as storing value, just as a dollar stores value (inflation aside).
@adalbertomania
@adalbertomania Жыл бұрын
there is nothing more disrespectful than criticizing the foundations of a language. No one criticizes your language for not using ;
@degecko
@degecko Жыл бұрын
Weirdly, I dislike using $ in JS, but it was never an issue for me in PHP. I've also started to learn PHP when I was 14, so I guess it's just dear to my heart, I don't have much to criticise about it.
@LonersGuide
@LonersGuide 11 ай бұрын
Lex, I feel you about having to stretch your finger way up to the 4 key while simultaneously holding shift at just the right time, then releasing it before hitting the next key, and doing that over and over and over again. OTOH, we don't even have to stand up or bend over, get in an uncomfortable, awkward, or unsafe position, let alone break a sweat to do that. What would your ancestors say?
@cbbcbb6803
@cbbcbb6803 Жыл бұрын
I do not like the $. We should be able to have it for people that like it, and not have it for people who (me) do not like it.
@venelinborisov3377
@venelinborisov3377 10 ай бұрын
Only a non-programmer can say that $ in front of a variable is a source of bugs.
@El_Bartto
@El_Bartto 26 күн бұрын
PHP is moving forward, despite the hate
@sjswitzer1
@sjswitzer1 Жыл бұрын
Amazed that so few people remember the Bliss language. But at the same time glad because it was bad.
@Khalyomede
@Khalyomede Жыл бұрын
Sorry, I still did not understand what actually is the issue with the dollar sign before variable names. How can it be a source of bugs? What is the use case I would be curious to know. Coding for nearly 10 years in PHP (Laravel) and on all the bugs I ever experienced in this span of time, literraly 0 could be associated with... Dollar sign. I don't even know how can you have a bug because of a language token, it is like I say I have bugs because I use async keywords before synchronous code. This makes no sense to me unfortunately. I guess this kind of argument represents the vast majority of critics against PHP. Lacking true meaning, and most of the time outdated. Let's just solve users problems first. If your users' would rather not see the loading icon on their browsers then fine go for an SPA. Else do not try to over engineer things, just make it work, add automated tests, get some descent user base, and when you have 503 errors then congratulations you've became popular!
@plopiaplopia3736
@plopiaplopia3736 9 ай бұрын
Lex i assume is more of a researcher than a programmer, and probably doesn't have any experience productively programming (in any language for that matter). So i think what he means with bugs, is just typo's in a text editor when trying out some scripts. In reality obviously your IDE will "dude wtf" you, when first introducing such "bugs" to your code. And if you care about bugs at all it's pretty straight forward to have your repo not save such shenanigans even if you wanted to.
Lex Fridman: What programming language should I learn?
15:33
Lex Clips
Рет қаралды 104 М.
PHP 8 3 Released
11:03
ThePrimeTime
Рет қаралды 107 М.
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 135 МЛН
Running With Bigger And Bigger Lunchlys
00:18
MrBeast
Рет қаралды 117 МЛН
An Unknown Ending💪
00:49
ISSEI / いっせい
Рет қаралды 57 МЛН
Would I still use PHP in 2023?
9:51
Stefan Mischook
Рет қаралды 32 М.
Future of Python - Guido van Rossum
1:43
The Data Science Channel
Рет қаралды 5 М.
Go IS Slower Than PHP | Prime Reacts
5:22
ThePrimeTime
Рет қаралды 81 М.
PHP doesn't suck (anymore)
10:48
Aaron Francis
Рет қаралды 207 М.
Is PHP the Secret King of Code?
6:42
Stefan Mischook
Рет қаралды 56 М.
Interview with Senior Rust Developer in 2023
9:46
Programmers are also human
Рет қаралды 709 М.
Guido van Rossum explains Python programming
20:54
Lex Clips
Рет қаралды 226 М.
Is Coding still worth it in 2024? (as an ex-Google programmer)
13:36
PHP is Wack. (Coding in a Random Language Every Day)
14:41
Low Level
Рет қаралды 61 М.