As I have written earlier, modern software development for me is to automate the "accidents" of computing to reduce errors. Toward this end, I had installed NetBeans which worked beautifully with PHP. However, I failed to get NetBenas to work with IDE debugging of PHP scripts. It was hugely disappointing because NB came with a recommendation and I liked the refactoring of PHP variables. I wasn't crazy about how NB ran the script in the browser window instead in the IDE window but...nobody is perfect.
Thus, I abandoned NetBeans on the Mac and instead installed Eclipse PDT and EasyPHP on Windows 8. I still struggled a bit but managed to get single-step debugging working.
The trick is to put the project on the local server. Unfortunately there are no instructions as to how to do this. Yet after floundering around, I found the option under Preferences | PHP Servers which positions all project scripts under the web server root. Once that is set up, Eclipse will breakpoint every time at the first statement of the PHP script (this is configurable, I believe) and furthermore, the web page displays in the Eclipse IDE.
Variable inspection is available as well as variable inspection.
Unfortunately, Eclipse PDT does not do refactoring except for the script as a whole.
Sunday, June 9, 2013
Saturday, June 8, 2013
An elemental Scala parser
I've been writing a parser for Scala to gather complexity information. It doesn't need to "compile" Scala, just extract method information. Thus, I'm duly impressed that anyone could possibly parse Scala, given the difficulties and doubts I have that I've gotten it right. Indeed, some people seem to think that one cannot write a parser for Scala without, in effect, running it to compute the types and sort out implicits. However, as I was cleaning house, I came across an CACM article, Inexact Design--Beyond Fault Tolerance. It deals with hardware but nevertheless struck me as a cool idea, that is, of "inexact," "probabilistic," or "approximate" computing. I think that's kind of what my Scala parser is doing.
Wednesday, June 5, 2013
PHP class properties
The possibility of dynamically creating new properties in a PHP class seems like a slippery slope. Nixon (2012) says to avoid it because of the potential to create bugs. I agree. Then, why is the possibility there. A programming language's job, among other things on the path of automation, is to automate the detection and elimination of errors.
Tuesday, June 4, 2013
PHP super class constructors
In C++, Java, and Scala, instantiating an object automatically invokes the parent class's constructor. Not in PHP 5. Instead you have to invoke it yourself. I am surprised. This potentially a huge source of awful errors.
And for a silly reason because PHP creators couldn't put in the automatic invocation? Is there some other explanation?
Then again, Obj-C doesn't automatically invoke it's parent constructor. I've been waist deep in Obj-C for the past few years and while I won't say that never caused a problem, I've had far bigger issues with Obj-C (e.g., not crashing when accessing uninitialized variables).
And for a silly reason because PHP creators couldn't put in the automatic invocation? Is there some other explanation?
Then again, Obj-C doesn't automatically invoke it's parent constructor. I've been waist deep in Obj-C for the past few years and while I won't say that never caused a problem, I've had far bigger issues with Obj-C (e.g., not crashing when accessing uninitialized variables).
Sunday, June 2, 2013
PHP: First impressions
I had heard from others not good things about PHP, how it is used, at least. In fact, it seems that some websites want to hide the PHP behind them.
Working with a beautiful, Edward-Scissorhands-like language like Scala and recently exploring Haskell which I don't get, PHP feels to me like a throwback to another era, specifically C, which was one of the first languages I learned. After completing chapter 3 of Nixon (2012), I've concluded so far that PHP is not as elegant as Awk but (thankfully) appears to lack the obscurity of Perl. Forget Basic, Fortran, Scheme, and Prolog. It is perhaps closest to Korn shell scripting. The point it seems to me is not what PHP is but what it can do. Scala is my first choice language. Scala is wonderful for what it was designed to do. But I must remember one size does not fit all. If PHP is going to make me more productive, reduce errors, and help deliver innovative, original solutions, what does functional programming have to do with it?
Working with a beautiful, Edward-Scissorhands-like language like Scala and recently exploring Haskell which I don't get, PHP feels to me like a throwback to another era, specifically C, which was one of the first languages I learned. After completing chapter 3 of Nixon (2012), I've concluded so far that PHP is not as elegant as Awk but (thankfully) appears to lack the obscurity of Perl. Forget Basic, Fortran, Scheme, and Prolog. It is perhaps closest to Korn shell scripting. The point it seems to me is not what PHP is but what it can do. Scala is my first choice language. Scala is wonderful for what it was designed to do. But I must remember one size does not fit all. If PHP is going to make me more productive, reduce errors, and help deliver innovative, original solutions, what does functional programming have to do with it?
Saturday, June 1, 2013
NetBeans with Zend
First thing is to download to right NB, the "All" version which supports PHP.
Did that.
Next to create a PHP project in NB:
File | New Project… | PHP | PHP Application | (use default Name and Location) | (Run Configuration) Project URL = http://localhost:10088/testing/PhpProject2, check “Copy files from…” = /usr/local/zend/apache2/htdocs/testing/PhpProject2 | Finish
That worked. Meaning, the PHP runs fine.
Now for debugging. Unfortunately I get "Waiting For Connection (netbeans-xdebug)" on the NB status line. Nothing happens.
The URL is localhost:10088/testing/PhpProject2/index.php?XDEBUG_SESSION_START=netbeans-xdebug
which looks correct. My sense is that there is something trivially wrong in the connection between NB and Xdebug.
This link here is not very hopeful. I'll have to decide what to do.
NetBeans vs. Eclipse PHP development
Some developers like to work directly with the source editor, in some cases without even syntax highlighting. Call it old school. Purists. Definitely not me. For electrical engineers it might be designing circuits at the transistor level. Or programmers working only in assembly language. These things might some day be useful but they are not very productive.
An IDE allows the programmer to focus more on the problem at hand, automating more of the "accidents, as Brooks (1986) observed.
So when I learned there were Eclipse plugins, PHP Development Tools (PDT) and PHPEclipse, I was naturally relieved.
However, I stumbled upon this page comparing Eclipse and NetBeans and this fellow definitely gave NB the edge.
This in turn lead to a more systematic discover of IDEs for PHP here. I was surprised. NB is free and supports not only a PHP debugger but refactoring, too. NB (All option) comes ready "out of the box," where the Eclipse plugins seem to need more configuration.
I've decided to try NB for these reasons.
An IDE allows the programmer to focus more on the problem at hand, automating more of the "accidents, as Brooks (1986) observed.
So when I learned there were Eclipse plugins, PHP Development Tools (PDT) and PHPEclipse, I was naturally relieved.
However, I stumbled upon this page comparing Eclipse and NetBeans and this fellow definitely gave NB the edge.
This in turn lead to a more systematic discover of IDEs for PHP here. I was surprised. NB is free and supports not only a PHP debugger but refactoring, too. NB (All option) comes ready "out of the box," where the Eclipse plugins seem to need more configuration.
I've decided to try NB for these reasons.
Subscribe to:
Posts (Atom)