Spaghetti Code - What is...

  Рет қаралды 9,613

Eli the Computer Guy

Eli the Computer Guy

Күн бұрын

Пікірлер: 54
@tacticalrants8559
@tacticalrants8559 6 жыл бұрын
Your definition of spaghetti code is in itself spaghetti. Spaghetti code is code with POOR STRUCTURE. It's not just about syntax and formatting. It's how you define classes, how you separate concerns, how you decompose complex structures (OR NOT) into smaller simpler functions. Python is a programming language that forces you to use proper formatting and syntax but you can still write spaghetti code in python if you use a lot of global variables and you create functions that depend on functions that depend on functions, calling values by reference etc. So a python program could look really good (NOT UGLY) well formatted with lots of comments but it can still be spaghetti code
@Bunkabusta73
@Bunkabusta73 5 жыл бұрын
Code with poor structure? So the entirety of League of Legends?
@diswardexia6105
@diswardexia6105 4 жыл бұрын
"decompose complex structure OR NOT" Exactly! many ignorant people accidently made sphageti code by splitting and branching code like crazy. "Only God and him know how the code works"
@noferblatz
@noferblatz 6 жыл бұрын
I've coded in PHP for about 20 years. Before this, I coded in mainframe BASIC, Pascal, C, Perl, Python, Javascript and FoxPro. If you can find any secretary anywhere who can code in this language, I'll eat 'em. PHP is basically C for the web, though it can be used as a generic scripting language. I wouldn't expect anyone to simply pick up a language and start coding in it from scratch and turn out anything worthwhile. Not only that, but PHP was designed to work in concert with HTML, which you really should also know, if you're going to use PHP. And HTML is vastly easier to understand than PHP. Yet most secretaries couldn't handle HTML either. I'm not sure who came up with the idea that secretaries could code in PHP, but I'm betting it wasn't the guy who invented the language, Rasmus Lerdorf.
@AzaLPs
@AzaLPs 6 жыл бұрын
I don't think he has quite the perfect wording, I wouldn't say that it is literally the case, but generally speaking, he's right. The best way to describe it is that it has a very easy learning curve. A random ten year old can hop in with no programming knowledge and cough up a functional yet horribly written website by the end of the day. You can't really do that in other ecosystems. They don't allow you to do that to dramatically reduce the number of bugs in the long run and to reduce the maintenance burden. It's a very deliberate decision. Many of the decisions made for the PHP Language were made to make it as approachable as possible, so that they don't scare people away and so that a newcomer can have at-least something to show for their efforts really quickly. Also, PHP was originally a template language, it wasn't a scripting language at all, that came later when they decided to rewrite it, and it still carries some of the baggage from that time.
@AzaLPs
@AzaLPs 6 жыл бұрын
php.net/manual/en/history.php.php If you don't believe me that it used to be a template language. The original PHP
@vaibhavkothari8240
@vaibhavkothari8240 6 жыл бұрын
I revisited his channel after a very long time and he still comes off as a condescending prick in everything he has to offer. He would have been way more successful if it were'nt for his degrading tonality. Making it sound like PHP is for noobs shows to what extent his knowledge is expanded to. "Those who can't do, TEACH!"
@AzaLPs
@AzaLPs 6 жыл бұрын
@@vaibhavkothari8240 I think he cuts straight to the point, if not a little bluntly. Better to get the important things across than to let people dawdle around with misunderstandings about how things are. It is extremely easy for a newbie to accidentally think that PHP is the entirety of programming, I have seen it happen. Generally speaking, you probably want to learn multiple languages either way, otherwise you're in danger of being what one would call an "expert beginner" where you think you have all the answers, but you really have no clue what you're doing and you wind up leading other people down your own path. Each ecosystem has it's own way. And like it or not, but PHP being for noobs is the reputation that it has picked up in the field and for good reason. This does not mean that you're a noob just because you use it, but there are aspects which have been pushing more competent people away for the past decade. It's the programming equivalent of being a janitor. That is not to say that janitors don't have their use to society, but you're barely going to see people jumping up and down in excitement at the idea of taking up that job. Ultimately, people want to further their careers, learn more and step up the ladder.
@AzaLPs
@AzaLPs 6 жыл бұрын
@@vaibhavkothari8240 You know, Linus Torvalds, the creator of Linux every now and then, tells his contributors to st*fu in public when they do something really stupid, and then, they start trying to make excuses for it. I think at this point, I'm just used to people being blunt in this industry.
@Iraxvii
@Iraxvii 4 жыл бұрын
Spaghetti code is a nightmare to refactor
@jamesh3639
@jamesh3639 4 жыл бұрын
Yanderedev sent me
@markusnordin6213
@markusnordin6213 6 жыл бұрын
Who doesnt love code with alot of GOTO statements :D
@AzaLPs
@AzaLPs 6 жыл бұрын
I don't think goto has been a big problem for 30 years lol
@FreeER
@FreeER 6 жыл бұрын
​@@AzaLPs That's probably because of the pervasive "never use/teach goto!" that's sprung up lol. I still use it on rare occasions to avoid duplicating code in loops, and of course the obvious mostly-acceptable use case of breaking nested loops but people like to complain regardless.
@haleyblackburn4336
@haleyblackburn4336 3 жыл бұрын
I am a prolofic spaghetti coder and use it heavily it accomplishes great feats when trying to prevent others from knowing how you achieved your goal.
@alfredoperez9017
@alfredoperez9017 6 жыл бұрын
So good coders compile and categorize their code so its easier to make sense of it?
@joezupko
@joezupko 6 жыл бұрын
Trying to modify a javascript interactive Google map overlay at my job was 2000 lines of a spaghetti nightmare. 0 comments...
@sebastienberger2890
@sebastienberger2890 6 жыл бұрын
I was never really sure what programmers had with PHP, but now that you explained it I can understand. When I learned about PHP the first time I was shocked by the flexibility in the right that PHP had.
@brandonfarfan1978
@brandonfarfan1978 4 жыл бұрын
Ahhh. It all makes sense now. Thanks for the explanation Mr. Eli.
@daniel71626
@daniel71626 5 жыл бұрын
The problem with php is that is mixes everyting. Like the html and css. And you often get a LOT of files. But react on the other hand lets you structure the project in a better way. But then agian you have to use a lot of libraries. So it is diffucult to say what's best.
@confusedwolf7157
@confusedwolf7157 6 жыл бұрын
born by the great spaghetti monster??
@JF32304
@JF32304 6 жыл бұрын
I love these videos. I knew what spaghetti code was and I'm not even a coder by any means. Although, if a secretary can code in it...... Lol
@wholewurld
@wholewurld 6 жыл бұрын
By my definition of "ugly" code, I think spaghetti code is subtly different. To me, ugly code is code that is not idiosyncratic. It is writing code with bad style, as you have described in this video. An example would be that JavaScript doesn't really care about whitespace, but you would always want to properly indent when you write it. There actually is something called "uglification" and there are frameworks to help you do it. They do things like remove whitespace, semi-colons, and basically anything unnecessary to the uglifier's targeted language. It becomes unreadable, but still runs the same. If you "uglify" well-written software it is not spaghetti code, but it is ugly. Ugly code is often a strong indicator of spaghetti code, but not always. Sometimes very talented (if slightly old school) C programmers will write some, for example, Python script that is ugly as hell, but still not spaghetti code. The reason it is a strong indicator of spaghetti code is that a strong programmer often adheres to good style and more novice programmers usually do not. Spaghetti code, to me, is more about a sloppy management of the application's state. This would be things like global variables being referenced and modified in unrelated functions, not modularizing your code into multiple files, accidentally overriding said global variables, and maybe even stuff like using bad or unnecessarily-abbreviated variable names. The reason it's called "spaghetti code" is because debugging it feels a lot like trying to trace an individual noodle throughout a bowl of spaghetti. Any endpoint you pick leads you into the noodle labyrinth. I am so happy to see you making this series of videos. Several years ago, I was learning programming, networking, and Linux from ground zero and your channel helped immensely.
@Cognitoman
@Cognitoman 6 жыл бұрын
you should always think ahead.
@theultimatereductionist7592
@theultimatereductionist7592 6 жыл бұрын
The code, the CAD & the ugly.
@HG-mt3vl
@HG-mt3vl 6 жыл бұрын
Great man
@greg3087
@greg3087 3 жыл бұрын
WRIT-TEN
@MrSupermanito1
@MrSupermanito1 4 жыл бұрын
Riot Games in a nutshell
@hotandsillycinnamonrollget6697
@hotandsillycinnamonrollget6697 6 жыл бұрын
Mama mia!
@ChesterTheGod
@ChesterTheGod 4 жыл бұрын
Yanderedev lol
@TheMaslakxD
@TheMaslakxD 6 жыл бұрын
Eli, good programmers don't use comments in code. They name stuff such as classes, variables and methods in logical way to indicate what is the intention behind a particular element. For people intristed in good code look up book "Clean Code".
@jieniu9128
@jieniu9128 6 жыл бұрын
You still need to have adequate documentations. Not necessary in the code file but be in a separate file (i.e. readme / javadoc).
@CodeTalkerLooter
@CodeTalkerLooter 6 жыл бұрын
@@jieniu9128 Even though, people many times DO NOT read the readmes or other documents, they jump into the code immediately. So for simplicity's sake is better to comment in-code.
@wholewurld
@wholewurld 6 жыл бұрын
Sure they do. Look up John Carmack's well-known comments in his implementation of the fast inverse square root for Quake III Arena. Hilarious, and a good example of when to use comments. Generally, I agree with you though! Almost all good code doesn't need to be commented at all.
@noferblatz
@noferblatz 6 жыл бұрын
JK: Even Linus Torvalds, who's not a big comment guy, would disagree with this statement. Comments help immensely when I have to go in and hack my own past code. And if properly formatted, the code can be used to generate more generic documentation about the code. Lastly, commenting the code at an early stage tends to solidify the programmer's thinking about large chunks of code before he gets too far into it. It's like writing an outline for a novel before you write the book. Many or most writers will tell you this is essential. I've been coding since 1974. And, oh yeah, my mom's prettier than yours. So there.
@TheMaslakxD
@TheMaslakxD 6 жыл бұрын
@@jieniu9128 fair enough :) you need documentation but you shouldn't put it in source code (maybe information where to look for documentation- readme or wiki and one line comment with direction or link).
@exogendesign4582
@exogendesign4582 4 жыл бұрын
Yeah like people who thinks its fancy to use goto error syntax damn i hate them.
@IvyANguyen
@IvyANguyen Ай бұрын
One time I had an assignment in Java class to make a program to rank 4 racers in order for gold/silver/bronze/4th place, and the only thing I came up with was literally a bunch of if statements for ALL 24 POSSIBILITIES. On top of that, for some reason I was taking in the times as keyboard input as a string then parsing those strings as doubles. It was a mess that worked but looked so clunky and would be virtually not doable if I needed to add a 5th racer. I guess this was a great example of spaghetti code. Her was one part of it for 1 possibility: if (racerAtimeParse < racerBtimeParse && racerAtimeParse < racerCtimeParse && racerAtimeParse < racerDtimeParse) { System.out.println(racerA + " is the Gold medalist!");
@theultimatereductionist7592
@theultimatereductionist7592 6 жыл бұрын
I write the worst code imaginable, because I am simply incapable of finding any better way of writing it. I code only in Python now: mathematical calculations. And nobody else has ever used any little computer program that I have written. Not once. Ever.
@Alkajatomota
@Alkajatomota 5 жыл бұрын
Generally you should actively look for any repeating computation and turn it into a function with a descriptive name for the function. This will make the code itself read closer to English and will mean you've technically written less code which means less possible errors. Also functions can be ripped out of your program's context and tested for ease of bug squashing
@haleyblackburn4336
@haleyblackburn4336 3 жыл бұрын
spaghetti code is effecient and effective
@Bunkabusta73
@Bunkabusta73 5 жыл бұрын
Play one game of League of Legends & you’ll see spaghetti code in it’s strongest form. The makers of LoL are so lazy & bad at coding that issues in their game have been around since the very beginning. No engine update, no coding update, nothing. The foundation of the game is very broken & unstable, & sadly they have defined League’s 10 years of life.
@shade0636
@shade0636 5 жыл бұрын
How can you determine the structure of source code by playing a game?
@Dgero
@Dgero 4 жыл бұрын
I am curious how you came to this, I never played league so I am interested a bit
@upsyndrome4964
@upsyndrome4964 6 жыл бұрын
Eli please stop caring about tech. Go back to making rambling/rant videos.
@Cognitoman
@Cognitoman 6 жыл бұрын
Spaghetti code is what Eli writes lol.
LAMP Server - What is...
3:38
Eli the Computer Guy
Рет қаралды 16 М.
PHP - Why Coders Hate...
9:00
Eli the Computer Guy
Рет қаралды 55 М.
$1 vs $500,000 Plane Ticket!
12:20
MrBeast
Рет қаралды 122 МЛН
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 226 М.
PHP - Why Learn...
6:30
Eli the Computer Guy
Рет қаралды 24 М.
DNS Registrar - What is...
14:02
Eli the Computer Guy
Рет қаралды 28 М.
Domain Forwarding - What is...
9:02
Eli the Computer Guy
Рет қаралды 10 М.
Doxxing - What is...
6:18
Eli the Computer Guy
Рет қаралды 35 М.
Colocation Facility/ Datacenter - What is...
9:59
Eli the Computer Guy
Рет қаралды 15 М.
Linux - Introduction
2:34:06
Eli the Computer Guy
Рет қаралды 40 М.
VPS (Virtual Private Server) - What is...
6:56
Eli the Computer Guy
Рет қаралды 10 М.
How to Become a Tech Professional
2:46:10
Eli the Computer Guy
Рет қаралды 8 М.
Introduction to Programming
1:59:47
Eli the Computer Guy
Рет қаралды 7 М.