When even PHP programmers call each other lazy



  • Just wanna say, if you need a PHP Framework like CakePHP, you are not a good coder in my book. I don't care what people think, or what recruiters want. PHP Frameworks are for lazy and/or incompetent coders IMHO.

    This from a guy who is not the greatest coder and once tried to tell me that well written code doesn't need comments because it should be self-documenting.

    Make of that what you will. FWIW, this makes me lazy and incompetent in his eyes. Which is a shame because I'd be quite happy to show him real competence sometime.



  • @Arantor said:

    PHP Frameworks are for lazy and/or incompetent coders IMHO.

    Say what now?



  • That's what the dude said. As usual I can see the point he's trying to make (that frameworks encourage API gluers rather than competent programmers) but as usual he's managed to eradicate whatever semblance of argument he could have made in favour of his own arrogance.

    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.



  • @Arantor said:

    That's what the dude said.

    I know, I just decided to let Discourse incriminate you.

    I don't understand that guy's opinion at all. The glued code of someone using plain PHP is going to be much worse and more dangerous that the glued code of someone using a framework. At least frameworks help to protect you from most exploits.



  • Exactly. I bet this guy likes to make mixed spaghetti pages, with header.inc.php and footer.inc.php included in appropriated places.



  • Fortunately SMF mostly beat him out of doing that because for all SMF's faults, it is still a kind of framework and does have some MVC-ish stuff going on.



  • @cartman82 said:

    I bet this guy likes to make mixed spaghetti pages, with header.inc.php and footer.inc.php included in appropriated places.

    I'd managed to forget that those existed. I hate you.



  • @Keith said:

    I'd managed to forget that those existed. I hate you.

    You forgot WordPress existed? I hate you.



  • @Arantor said:

    You forgot WordPress existed? I hate you.

    Fortunately, I've never had to deal with WordPress in a development context. My wife has used it to write her blog for many years and she seems quite happy with it.



  • @Keith said:

    Fortunately, I've never had to deal with WordPress in a development context. My wife has used it to write her blog for many years and she seems quite happy with it.

    Now I hate you.


  • BINNED

    Well, yeah, it works... just DO NOT TOUCH IT!

    Seriously, even slightest tweaking can make the whole thing keel over.



  • Just wanna say, if you need a programming language higher level than machine code, you are not a good coder in my book. I don't care what people think, or what recruiters want. Programming languages are for lazy and/or incompetent coders in my overrated opinion.

    Maybe use an abacus. In fact, we are all equipped with perfectly functional fingers to count on.


  • BINNED

    I allow for pebbles, but only for the purposes of storage.


  • ♿ (Parody)

    Bullshit. Real Programmers Use FORTRAN.



  • I know you're all trying to get me to post that XKCD strip, but I won't bow down to your peer pressure.


  • ♿ (Parody)

    I don't know which xkcd strip you're thinking of. I was making an entirely different (and much older) reference, you quiche eater.

    EDIT: Oh, I think I know the strip, but my reference is still better. Gawd...you probably use PASCAL, too.



  • @boomzilla said:

    Gawd...you probably use PASCAL, too.

    How freaking dare you ⁉


  • Discourse touched me in a no-no place

    @boomzilla said:

    quiche eater

    Om nom nom


  • Grade A Premium Asshole

    @boomzilla said:

    Bullshit. Real Programmers Use Assembly.

    FTFY



  • @Arantor said:

    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.

    I am currently working on a site with a home-made framework. (not my work, thank god)

    Features include, in no particular order:

    • non-MVC spaghetti, with <?php include('include/prepend.php'); ?> et al everywhere

    • a DB Access layer (and I use layer in a very loose sense) which comprises of a class for each Database table, which is instantiated by passing it an object, which itself is instantiated with the DB table name, the ID column, and the column to use to order results passed to the constructor.
      The naming convention here is that the files in the "DB Access layer" take the format news.lib.php but contain a class named lib_news which extends lib_Data.
      Except they do not add any functionality that is not in the parent class, nor do they add clarity.

    • Once instantiated - let us not forget that EVERY data access object, one for each of the DB tables , is instantiated on EVERY page load - and of course this is done in an include that is in an include that is in the above-mentioned <?php include('include/prepend.php'); ?>, - every single instance is put into $GLOBALS. Because that is a good idea. (the FileSystem access class is also instantiated in the same way, every page load)

    • The methods in the lib_Data class have some required arguments, and some that are not required, forcing the use of such insanity as this attempt to get the "whitepapers" to order DESC by the column declared at instantiation.

         $dl = $GLOBALS['lib_WHITEPAPERS']->getAll('1 = 1', 'DESC');
      

    Note, a "WHERE" clause must be passed, else the getAll() method will for an uncommented reason, get the record with id 1. I'm not sure if that is a side-effect or a symptom of Ebola.

    • Naturally such a system has a means to sanitise user input.

      // filter malicious html
      function cleanInput($string='') {

        $search = array(
        	'@<script[^>]*?>.*?</script>@si',   // Strip out javascript
        	'@<[\/\!]*?[^<>]*?>@si',            // Strip out HTML tags
        	'@<style[^>]*?>.*?</style>@siU',    // Strip style tags properly
        	'@<![\s\S]*?--[ \t\n\r]*>@'         // Strip multi-line comments
        );
      
        $output = preg_replace($search, '', $string);
        return $output;
      

      }
      //=====================================================================================================
      // filter malicious sql statements and prevent sql injection
      function prepare_sql($string='') {

        return mysql_real_escape_string($string);
      

      }

    This shit is spread all over the place via copy/paste with variations.

    And while I'm bitching, lets throw in a couple of classic anti-patterns:

     class ui_formErrors {
    
    public $errors = false;
    
    //=====================================================================================================
    public function __construct() {
    	
    }
    //=====================================================================================================
    // adds an error field for display
    public function addField($field='',$label='') {
    	if(!empty($field) && !empty($label)) {
    		$fieldArr['field'] = $field;
    		$fieldArr['label'] = $label;
    		$this->errors[] = $fieldArr;
    	}
    }	
    //=====================================================================================================
    public function displayErrors($errorInput=false) {
    	
    	if(is_array($errorInput) && !empty($errorInput)) {
    		
    	?>
    		
    		<div class="formErrors">
    		The following errors occurred while processing this form:<br />
    		
    		<ul>
    		
    		<?php
    	
    		foreach($errorInput as $key => $val) {
    			foreach($val as $key1 => $val1) {
    				for($i=0;$i<sizeof($this->errors);$i++) {
    					if($this->errors[$i]['field'] == $key1) {
    						echo "<li>".$this->errors[$i]['label'].": ".$val1."</li>";
    					}
    				}
    			}
    		}
    		
    		?>
    		</ul>
    		</div>
    		
    	<?php			
    	}
    }
    //=====================================================================================================
    

    }

    Yes - the displayErrors() method emits HTML.

    Anyway, the culprit was kind enough to add his name to every page: so fuck you Ryan Christopher Delport 2011, fuck you.


  • :belt_onion:

    @cartman82 said:

    Exactly. I bet this guy likes to make mixed spaghetti pages, with header.inc.php and footer.inc.php included in appropriated places.

    I bet his passwords are google-able in every site he makes, in a file called site_settings.config


  • BINNED

    @Arantor said:

    well written code doesn't need comments because it should be self-documenting

    Mostly true, but not everyone who says that is capable of writing self-documenting code.

    @Arantor said:

    PHP Frameworks are for lazy and/or incompetent coders IMHO.
    This is TRWTF.


  • Discourse touched me in a no-no place

    @Arantor said:

    Frameworks are for lazy […] programmers

    Damn right. I'm lazy, and I like a framework if it lets me do more with less effort.



  • @Shoreline said:

    Just wanna say, if you need a programming language higher level than machine code, you are not a good coder in my book. I don't care what people think, or what recruiters want. Programming languages are for lazy and/or incompetent coders in my overrated opinion.

    Maybe use an abacus. In fact, we are all equipped with perfectly functional fingers to count on.

    Additionally, all your code has to be submitted on punch cards.



  • @Arantor said:

    Which is a shame because I'd be quite happy to show him real competence sometime.

    THAT'S GOING STRAIGHT IN THE FANFIC/EROFIC



  • @Arantor said:

    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.

    I'm reasonably competent in Java and C#, but for some reason I can't wrap my head around Groovy.



  • @powerlord said:

    Additionally, all your code has to be submitted on punch cards.

    Damn it, why'd you drop the box?! Again ⁉ Guess we're sorting 10k cards for the next 8 hours.



  • You guys are all wrong. Real programmers program the system using jumper cables and a patch board.


  • ♿ (Parody)

    @Intercourse said:

    @boomzilla said:
    Bullshit. Real Programmers Use FORTRAN.

    FTFY

    Acceptable, but not required.



  • There's absolutely nothing wrong with using a framework to speed up development. Relying on one to cover for one's lack of knowledge is obviously bad, but that goes without saying..

    He's probably one of those guys who writes everything from scratch every time and takes 10x longer to deliver anything.



  • @aapis said:

    There's absolutely nothing wrong with using a framework to speed up development. Relying on one to cover for one's lack of knowledge is obviously bad, but that goes without saying..

    He's probably one of those guys who writes everything from scratch every time and takes 10x longer to deliver anything.

    It's like you know him!



  • NIH syndrome?



  • @chubertdev said:

    NIH syndrome?

    National Institute of Health?



  • Not Invented Here syndrome. The intense desire to rebuild everything from scratch every time.


    Edit - PJH: Awarded a badge...


  • BINNED

    Nominated for whoosh badge.



  • I get his basic point with comments, but "no comments" is an extreme. In my experience comments can often be a crutch. "I can write crappy code, because I can just explain what $i $j $k $l and $n are." Not to mention the stupidity and cluttering nature of the "$i++; //Increment $i" style comments.

    Still, if he literally meant no comments anywhere, that's over the top.



  • He did actually mean no comments at the time he originally wrote it. I did, fortunately, finally get through to him about it.



  • I like to plot out a function using comments. Once I have the flow figured out, I'll write the code, but the original comments usually stay. They often seem pretty obvious because of that. No one but me really looks at my code anyway.



  • I thought that said $| instead of $l and was wondering when we switched to criticizing Perl.



  • All Perl should be replaced by Python.



  • I do that too, helps keep me focused on what needs to be done.



  • @chubertdev said:

    Python.

    All that lack of curly brackets and depending on whitespace scares me.



  • @Zemm said:

    All that lack of curly brackets and depending on whitespace scares me.

    The whitespace is weird, but you get used to it, especially if you have a good IDE.

    The lack of curly brackets is soooooooooooooo much better.



  • @chubertdev said:

    The whitespace is weird, but you get used to it, especially if you have a good IDE.

    The lack of curly brackets is soooooooooooooo much better.

    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 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. :-(



  • @tarunik said:

    (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.)

    There's all too much of that going on in the Perl that I've been working on for almost two years. I have scripts that clean it all up. (UEStudio: it's not perfect but it seems to do the job) Most of it uses two-space=tab but one long-departed developer liked four-space=tab. But there were still actual tabs in the source so you'd often find lines prefixed with both spaces and tabs.

    Don't get me started on the files that Dreamweaver was allowed to touch. Whitespace completely and utterly broken, and null characters at the end of many files.



  • @chubertdev said:

    The whitespace is weird, but you get used to it, especially if you have a good IDE.

    The lack of curly brackets is soooooooooooooo much better.

    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).



  • I'm going to pretend we're talking about Javascript and jQuery.

    The programmer who thinks, "I could do this in Javascript, but jQuery makes it so much easier", is probably right.

    The one who thinks, "I probably can't do this in Javascript, but I can hack at jQuery long enough to get it to do what I want", is lazy/incompetent.



  • JQuery has nothing to do with JavaScript. It is a DOM API. My biggest pet peeve is people blaming JS for faults in DOM.

    #PedanticDickweed



  • This post is deleted!

Log in to reply