When even PHP programmers call each other lazy



  • @blakeyrat said:

    JQuery has nothing to do with JavaScript.

    From http://jquery.com (emphasis mine):

    jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.

    Translation: jQuery has everything to do with JavaScript.


    Filed Under: My pedantic dickweedery is bigger than @blakeyrat's



  • It's a JavaScript library, meaning a library written in JavaScript. I can't believe I had to type that.

    Look, I get exactly what anotherusername meant, I'm just fighting to unentangle the fate of JavaScript from DOM. Because DOM is indeed fried ass, and DOM attached to any programming language is also fried ass. That's not poor JavaScript's fault.



  • Yes. Javascript has its faults, which jQuery tries to remedy. Not unlike PHP and some of its libraries.

    I'll grant you that DOM being a clusterfuck is not Javascript's fault, though.



  • Ok, maybe I need to highlight another portion from that excerpt:

    jQuery has changed the way that millions of people write JavaScript.

    You use jQuery in JavaScript. Yes, it's a library written in JavaScript, but it's also a library referenced when writing JavaScript.



  • Right but JQuery to my knowledge doesn't add anything to the JavaScript language. It just replaces the DOM API with a different, better, API.



  • @cvi said:

    I always feel like half of the source code is missing when the file ends with a line dangling somewhere in the middle of the window. :-(

    Obligatory "WHERE IS SHE!?!?!" Dark Knight meme, where "she" is, of course, the closing curly brace.



  • @tarunik said:

    I find that the whitespace-as-syntax only weirds you out if you let it creep into your head that it's somehow magically different from how you've been indenting your code in $insert-other-language-here all this time. If you have an editor that isn't as brain-damaged as Notepad, EDLIN, or ed (read: any editor under the sun that a programmer'd actually use, never mind a decent IDE), you can simply whack the Tab key at the same places you would when writing your favorite block-structured language, and it'll work. (About the only thing that trips people using that logic up on a regular basis is unholy mixing of spaces and tabs in indents; Python doesn't like that for understandable reasons.)

    I've seen developers intentionally use spaces for indentation, and in that case, you simply whack the developer with a trout.



  • @Zemm said:

    My comment was a little tongue-in-cheek, it's just that I've been doing Perl/PHP/JS/etc for over 16 years so leaving that safety would take a bit of getting used to. (Half my life, wow). I do like to remove a lot of the extra characters that are optional when using Perl, such as where a bareword will be autoquoted, or using postfix "if" just so I can strip the brackets.

    Do any other languages have quote operators like qq~String~? This is one of the best features of Perl IMHO, allowing one to use both of the "normal" quotes in a string without having to escape either, and easy to change interpolation on off (q vs qq).

    The quote operator is one of my favorite pieces of Perl. I wish every language had it, done as well as Perl.

    Totally noooooooooooooooot making fun of PHP here



  • Coming as an ignorant normally enterprise style coding coder person guy thing,

    is it weird that the difference between javascript and jquery often feels to me the same as the general differences between normal c# programming functions and linq? (at least when it comes to assigning variables, and initiating functions/responses)

    Granted, I'm not very deep in either at this point, and am just using it to enhance page functionality rather than replace a full page.



  • @Matches said:

    is it weird that the difference between javascript and jquery

    Quit yer trollin'.

    @Matches said:

    often feels to me the same as the general differences between normal c# programming functions and linq? (at least when it comes to assigning variables, and initiating functions/responses)

    I could see that. They both seem to be coming from the vaguely-same school of thought. The difference is that Microsoft was able to add language features to help LINQ out, where Jquery has to rely on what's in JavaScript already.


  • I survived the hour long Uno hand

    It also has its own AJAX library, and its own callback management functionality using promise-objects, and a whole bunch of useful "should have been in the language" utility functions like each, grep, trim, makeArray, isArray, inArray, isNumeric, map.... Common plugins add new UI widgets with their own functionality as well, though that's not in core.



  • @blakeyrat said:

    Right but JQuery to my knowledge doesn't add anything to the JavaScript language. It just replaces the DOM API with a different, better, API.

    Not arguing that. I was only arguing this statement:

    @blakeyrat said:

    JQuery has nothing to do with JavaScript.



  • @Yamikuronue said:

    It also has its own AJAX library,

    AJAX is part of DOM, not part of JavaScript.

    @Yamikuronue said:

    and its own callback management functionality using promise-objects,

    Mm. That one is kind of different, I could see that billed as an improvement to JavaScript itself.

    @Yamikuronue said:

    and a whole bunch of useful "should have been in the language" utility functions like each, grep, trim, makeArray, isArray, inArray, isNumeric, map....

    About half of those are DOM, but I concede a bunch are not.

    @Yamikuronue said:

    Common plugins add new UI widgets with their own functionality as well, though that's not in core.

    UI widgets are all DOM.

    Again, the problem with people not being able to tell JavaScript apart from DOM is that most people have never used JavaScript outside of the web browser environment. You give them Flash ActionScript 3 project, or tell them to write some JScript to automate some Windows administrative tasks, and you can straighten them out.

    JavaScript is an excellent embeddable language. But that's all it's designed to be; when you hook it up to the web and start writing abominations like Discourse in it, you're waaay outside the purpose it was designed to fill.

    Even worse, as an embeddable language it has almost no native library (I think "Math" and "Date" is pretty much it...) So if it's paired with an asstastic library, like DOM, it's crippled by that library. And DOM includes a lot more than people generally assume-- AJAX functions are all in DOM. The new JSON decoder? In DOM. setTimeout(), setInterval() and related? All DOM.



  • Feels like CSS and SCSS/SASS/whatever those things are.



  • Random question. What is the right way to include a header/footer in PHP these days?



  • @veggen said:

    Random question. What is the right way to include a header/footer in PHP these days?

    If you're using a framework, you'll generally have a layout file which contains the header and footer, and the content for each page will be inserted into it.



  • Depends whether you're using a framework or not (since most of them have their own ideas about how to do that) and how strongly set up your environment is towards something like MVC. If you're doing an MVC style app, it's going to be buried in a view component somewhere.

    But if in doubt, include() still comes up a lot 😛


  • Discourse touched me in a no-no place

    @blakeyrat said:

    Right but JQuery to my knowledge doesn't add anything to the JavaScript language.

    There might be a few bits and pieces ($.each perhaps?) but jQuery is definitely a library for making working with the HTML DOM much less painful. If you want a world of surprising pain, try using jQuery for XML…



  • Been there, done that, it's only marginally better than doing it all by hand.



  • A bit late whenever I hear a developer say the equivalent of "only lazy devs dont reinvent the wheel", I stop talking to them.

    There are times when it is necessary to make your own framework, but it is few and far between.

    As for jquery unless you know you can use vanilla js and dom methods in the browser ... use it.


  • Discourse touched me in a no-no place

    @Arantor said:

    Been there, done that, it's only marginally better than doing it all by hand.

    Hardly even that. It appears to work well, but doesn't. jQuery just does not understand the XML DOM (which, admittedly, isn't nearly as broken as the HTML DOM, so doing it all by hand is possible).



  • Personally I think you should have to go through a competence test to use frameworks: if you can build something like it yourself, then you get to play with the grown up toys. If you can't, you have no business playing with one.

    Yeah, well I don't know about you, or anyone else who uses PHP on here, but I've seen my share of people trying to build "something like it" themselves, and my experience is that people build POS systems when they decide they want to build a framework.

    I only learned how it's done by experience and by being exposed to proper frameworks, and I don't see why exposing people to decent software development at an early stage is a bad thing.

    Are you suggesting people need to be the next Taylor Otwell to aspire to use Laravel? Because that, being an experienced PHP developer, makes no sense to me whatsoever.



  • Also the longer I program the more I learn about what frameworks really do and about the problems they solve, and that just makes me realize I can't build a framework at all as well as existing frameworks.

    Do you see the irony there?



  • True, true, I'm certainly not suggesting that people should be able to build production quality, battle-hardened frameworks before being let loose with them.

    What I was getting at is that the people who sneer at frameworks are the people who have no business playing with one because they have no understanding of what the framework is doing for them. Thus my take on it that they should learn how to do the underlying stuff first, to gain that understanding and then be let loose with the grown up toys.

    Could I build a framework to the same standard as Symfony or Zend Framework? In time, sure. If I couldn't do the same job from scratch to a production standard, I'd have really messed up the last 11 years of my life :P But I understand the benefit a framework gives me - it doesn't fill in functionality I can't do. It fills in for things I can do already, and does them so I don't have to.

    That's what it gives me: a pre-stabilised, pre-ruggedised, pre-testing foundation upon which to build so I don't have to reinvent the wheel, but they're tools, not crutches. Some stuff I've done and likely will do, those frameworks are not entirely appropriate and I can still roll my own scripts to suit the job at hand without dragging hundreds or thousands of files into a project from the off.

    The equivalent is being taught how to do basic maths without a calculator. Yes, the calculator can do it for you better/faster/whatever than you can, but the point is that you can still do it yourself and understand what benefit the calculator is giving you. And there are times the calculator is the wrong tool for the job anyway.


  • :belt_onion:

    @blakeyrat said:

    Right but JQuery to my knowledge doesn't add anything to the JavaScript language. It just replaces the DOM API with a different, better, API.

    ORLY :( well fuck, someone else already took that battle.
    <-- going somewhere else now.



  • The likes thread is over there: 🔄 ↗ ⬇



  • Yeah, and I didn't even get a Pedantic Dickweed badge for it :'(



  • I'm still trying but my dickweedery is, thus far, insufficient.



  • @blakeyrat said:

    It's a JavaScript library, meaning a library written in JavaScript. I can't believe I had to type that.

    Look, I get exactly what anotherusername meant, I'm just fighting to unentangle the fate of JavaScript from DOM. Because DOM is indeed fried ass, and DOM attached to any programming language is also fried ass. That's not poor JavaScript's fault.

    JavaScript and DOM are separate entities now, but that wasn't always the case.

    "DOM Level 0" (basically a part of HTML4) was basically "whatever Netscape is doing in JavaScript" at the time it came out and most of DOM still stems from it even today.

    So yes, DOM's suckiness in general is entirely the fault of JavaScript's creators... Netscape in general and Brendan Eich specifically.


Log in to reply