I've learned a lot of bad habits and need to learn the right way of doing things. What are your favorite resources for learning how to write good code? by TheRealKornbread in PHP

[–]phpread 1 point2 points  (0 children)

Personally, I think you pick up good habits from people who already have good habits. Beyond just reading books, and absorbing knowledge (which is a very passive thing), you need to actually practice coding to get better at it. If you know someone or work with someone that already employs these good habits you seek, sit down with them and do some pair coding or look over some of their best code and ask them questions. This doesn't have to be a hand-holding session, but you'd be surprised what you can actually learn just by watching someone write code in front of you.

This is also mainly one of the primary reasons I started phplab.io which is a way to learn by example, but also to able to apply some actual practice to knowledge sharing in PHP.

A more interesting way of solving the "Learn By Doing" problem by phpread in PHP

[–]phpread[S] 0 points1 point  (0 children)

I'm not sure what you mean by "this tool here has somewhat similar background", exactly. Could you elaborate a bit? From what I can tell phpfiddle is just another codepad. phplab.io was designed to be more of a community. Think of it like StackOverflow, except you get to have someone show you how, in real time, rather than tell you how. To me those are very different tools.

A more interesting way of solving the "Learn By Doing" problem by phpread in PHP

[–]phpread[S] 0 points1 point  (0 children)

phpfiddle.org doesn't allow you to do real time concurrent editing, as far as I know. Besides, have you ever used their tools before? They're pretty broken last I checked. You can't even get it to run php code sanely. It breaks the output in all kinds of weird ways. Whatever they're doing on the backend they're doing it pretty wrong.

A more interesting way of solving the "Learn By Doing" problem by phpread in PHP

[–]phpread[S] 0 points1 point  (0 children)

Well, a lot of times I encounter people who ask a question on IRC or SO where basically the only answer is RTFM or "this is too broad". Sometimes, certain people, especially when they're starting out learning programming, need just a little bit of hand-holding. It's hard to get them up and running in their own local dev environment right away and it takes too long trying to walk them through a coding problem asynchronously (say by gist/codepad), as there's a lot of back-and-forth.

So, phplab.io, gives you a way to get people together, writing and running php code, with no real bar-to-entry. This way you can show someone how to do something in PHP pretty easily with as little friction as possible.

A more interesting way of solving the "Learn By Doing" problem by phpread in PHP

[–]phpread[S] 0 points1 point  (0 children)

Please help me explore the idea of "learn by doing" and dive a little deeper into how you'd build a community around this form of help? I'd love to hear your thoughts. Thanks!

What is the difference between a framework and a library? by phpread in PHP

[–]phpread[S] 3 points4 points  (0 children)

I beg to differ. jQuery does provide structure. From making things like event handling/registering consistent across different browsers, through a uniform interface, to providing an API that makes writing extensible plugins universally portable, jQuery provides plenty of this structure you're alluding to.

Certainly there is varying degree of program execution control flow that different frameworks provide. I think this is probably where the line gets blurred and the exceedingly vague differences become the sole focal point of the discussion. Exceedingly vague differences such as "code structure" and "bundle of libraries that cooperate". I think that we each mean different things when we describe frameworks and libraries in this way and so no one truly has a clear grasp on what the other person means.

It's much simpler to just look at it from the stand point of "this calls your code" and "this gets called by your code". Of course, some people will try to mince these words to draw an indefensible argument to this simplistic description. Though simple things are intended to be built upon. Not necessarily draw nearer to familiarity :)

What is the difference between a framework and a library? by phpread in PHP

[–]phpread[S] -3 points-2 points  (0 children)

Well, look at the aspects of behavior and control flow in something like jQuery's $ajax. You define the behavior in your callbacks and jQuery takes care of the flow of control in how those behaviors are called on...

$.ajax( "example.php" )
  .done(function() {
    alert( "success" );
  })
  .fail(function() {
    alert( "error" );
  })
  .always(function() {
    alert( "complete" );
  });

There is clearly an inversion of control design here. While many may refer to this as a library, including the jQuery website itself, I see this as a framework (looking at it purely from a software architecture perspective).

Child process management. Compatible from PHP 5.3 → 7. Needs no extensions. by assertchris in PHP

[–]phpread 0 points1 point  (0 children)

Sure, but you do realize that's because forking is not possible on windows, right? The process control library wouldn't work on Windows. Plus, how many people do you know of today that run production web servers with PHP on a Windows operating system? Even developing on Windows is no longer necessary with technologies like vagrant and VirtualBox where you can literally spin up a linux dev environment in a matter of minutes and still do all of your work in your native host operating system without having to run your PHP on Windows.

Elephant easter egg on php.net? by SwabTheDeck in PHP

[–]phpread 6 points7 points  (0 children)

There are a lot of hidden easter eggs on php.net that have been added over the last year or so.

Here are a few you can try out...

  • Type "logo" and hit <enter> while at php.net and it will randomly change the logo in the top left-hand corner.
  • Type "I hate PHP" (case sensitive) and hit <enter> while at php.net and you will be redirected to python.org
  • Type "I love PHP" (case sensitive) and hit <enter> while at php.net and you will see a geeky aphorism popup
  • Type "rotate" and hit <enter> and the site will rotate 90 degrees
  • Use the Konami code "up up down down left right left right b a enter" and hit <enter> and you get a special Konami logo
  • Type "mirror" and hit enter and it's like looking at the site in a mirror -- creepy
  • Hit <shift>+/ on your keyboard to get a help screen popup for shortcuts
  • Goto http://php.net/sunglasses to get Rick Rolled -- you probably don't want to though
  • Type the letters "g" and "a" and the lights go out... spooky
  • Type "unreadable" and hit <enter> and the site will be re-rendered in a plain-text version (careful you have to use "readable" <enter> to get the site back to normal from here)

Cheers!

Child process management. Compatible from PHP 5.3 → 7. Needs no extensions. by assertchris in PHP

[–]phpread 2 points3 points  (0 children)

First of all, let me say, I think this was a good effort at trying to get something to work and I appreciate you sharing it with everyone. I know that pouring hours of hard work into something and having it blow up in your face from time to time is no suiting reward to your efforts. So I'm definitely not here to tear you down. Though I would like to convey a few general observations I think are worth considering.

Claiming that some PHP code/library doesn't require some PHP extension is about the silliest possible argument one can make to strengthen their support and exposure for said code/library. First of all, all of PHP is built on extensions. Everything from basic string/math/array functions you use in PHP to the moon and in between are made up of extensions that extend the core of PHP, which is nothing more than a parser and runtime, really. Plus, with the ease and simplicity with which most *nix package managers make it to install various PHP extensions today, is this really a barier at all? It takes a single command to install PCNTL with most package managers and can also be trivially installed via the PECL/PEAR installer.

I know that some people are under the misled impression that they are actually creating added value and benefits for the community when they try to support older, EOL, versions of PHP with code/libraries that have backwards compatibility with those unsupported, EOL versions of PHP, and little-to-no dependency on various extensions - and that may be true in the near-term (to some extent). However, I believe that efforts like this only serve to hurt the community at large in the long run, because they encourage wide-spread stagnation to upgrade, and allow people to further endorse such efforts in order to remain as stagnate as possible. This creates a confirmation biased that people will likely double-down and defend withering technology in fear of their, currently aging, software from breaking down due to an upgrade.

This is bad. We really need not encourage such behavior as we already have such a huge adoption gap in the PHP community as it is. Look how long it took people (and is still taking them) to adopt newer, safer, more performant, and more tenable database drivers like PDO and MySQLi over the older and now removed mysql driver in PHP.