Jump to content

andychurchill

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

andychurchill's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Cheers, that's opened my eyes quite a bit. One thing I need to figure out is how to get a CI environment running on the same machine as the local dev environment. I guess the obvious answer here will be a virtual machine. Certainly something for me to dig into and set up.
  2. My "day job" experience is with Visual Studio, and I have a number of cool addins that I find invaluable for development so I'm looking for a dev environment for PHP with similar shortcuts. If the IDE doesn't provide it natively, then I'm hoping plugins might do the job. I'm using Netbeans for PHP at the moment, but have heard Eclipse is also quite good for extending the dev environment. Chances are I'm going to have to stick with Netbeans and write the plugins myself, but that might be a bit time consuming Here's my wishlist: 1. Code Completion - Netbeans seems to do a good job with this, including the CodeIgniter MVC framework I use, so I don't have a problem with this. 2. Code Analysis (StyleCop on Visual Studio) - improves readability, enforces documentation, etc - currently using PHP CodeSniffer for this which I'm pretty happy with, though any additional Code Analysis tool for PHP would be worth a look. 3. Auto documenting (Ghostdoc on Visual Studio) - quickly documenting classes, fields, and methods, parameters and return values, with a right click - auto generates comments based on the names you've given, and does a reasonable job at it. 4. Sandcastle - generates (compiled) html from your documentation, ideally would like something similar to generate documentation. 5. JSLint.VS - quickly validates a JS file, block selection or entire project against Doug Crockford's standards, more info can be found here: www.jstlint.com. 6. Code Metrics - Cyclomatic complexity is probably the most important here. 7. Built in SVN support 8. Functionality for implementing tests Anyone know of an IDE and/or plugins that would meet my requirements?
  3. I took this base collection example from here: http://www.devshed.com/c/a/PHP/Collections-and-Sorting/2/ interface ICollection { public function Get($i); public function Append($object); public function Sort(); } interface ISortable { public function GetSortKey(); } abstract class Collection implements ICollection { protected $data; public function __construct() { $this->data = new ArrayObject(); } public function Get($i) { return $this->data[$i]; } public function Append($object) { $this->data->Append($object); } public function Sort() { } } I then added a new function to the abstract collection class function Count() { return $this->data->count() - 1; } so that in my code I can now do this, where $someCollection is a collection of objects that inherits from this base Collection class. $maxcount = $someCollection->Count(); for ($counter = 0; $counter <= $maxcount; $counter += 1) { print_r($someCollection->Get($counter)); } which works, but my question is, is there a better way to modify the collection so that I can do something like this, which from what I can tell doesn't work currently as I've not provided this new class with any form of iteration? foreach($someCollection as $item) { print_r($item); } I'm new btw, just learning the ropes
  4. Well I've managed to get a nusoap client working with a 3rd party service, but I want to turn the results I received into a proper class structure. That's the bit I'm struggling with - deciding how best to create those structures to replicate the results coming back, e.g. one one class (SomeObject) I have a property (StuffCollection) which is a collection of another class (Stuff). So for example, that StuffCollection constructor could be called via the SomeObject's constructor, with results coming from the original soap response: $newObject = new SomeObject($resultFROMSoapResponse) so if I then did $newObject->getStuff(), this would be a collection, but the IDE wouldn't know this because it doesn't have type hinting on return values? but in theory, because I know what I'm being returned, I could do: $newStuffCollection = new StuffCollection($newObject->getStuff()) That way my IDE now knows that newStuffCollection is a collection of Stuff, and would give me the correct properties/methods on this variable? Similarly: $newStuff = new Stuff($resultFromOriginalSOAPRequest); // used in the construct of StuffCollection when built from soap request whereas I might later want to do: $newStuff = new Stuff($newStuffCollection->getItem(0)); to ensure that the result of getItem is treated as a Stuff object, because I know that's what will be returned by getItem. This is what sparked this thread on whether it was worth me bothering to go to all the trouble of doing that, just to get a better IDE experience, when I should perhaps KIS(S), and not bother, which would be less processing overhead. As I say, this doubt stems from my background in VS/ASP.NET/C# where you get treated very kindly, and are able to create strongly typed collections with excellent intellisense, so perhaps I just want too much from PHP. As I say, this isn't necessarily a weakness of PHP, just a "new" way of thinking from a development point of view, which I'll get used to if need be, but thought I'd ask some experts first before I start on the project.
  5. Hi All, I'm new to PHP other than doing basic things like form mailing scripts and so on, and I've just begun to use it for a more indepth project. Coming from a Visual Studio/ASP.NET/c# background, the way of doing things in PHP has surprised me a little (although really it's not much different to classic ASP programming, I've just forgotten it all!). I realise that the flexibility of PHP is its strength, even if it feels like a weakness to me right now I've started by installing Netbeans IDE, along with PHP_Codesniffer, and I've been doing a lot of reading before I get dirty with code, (though I would love to find a Netbeans tool that allowed me to right click on a function and it try to guess what the function did based on the name of it, similar to ghostdocs in VisualStudio). I'm obviously spoilt by Visual Studio's intellisense, and the heavily OO approach to development in that environment, but now that I've started coding in PHP it's a bit of an eye opener. My natural way of developing would involve Enums, strongly typed clases/collections, etc. Even with Netbeans IDE, the lack of type hinting on function return values, for example, and a number of other things, makes me a nervous I just wonder if there's a trade off with creating strongly typed classes, collections and enums in PHP, in terms of processing, just to get better code structure? Collections: For example, I've seen these examples for collection classes: http://eide.org/2008/07/21/splobjectstorage/ http://codeutopia.net/blog/2008/09/17/generic-collections-in-php/ http://www.devshed.com/c/a/PHP/Collections-and-Sorting/ http://webscripts.softpedia.com/script/PHP-Clases/PHP-Collection-Class-11421.html Does anyone here have any thoughts on this kind of thing? I find that comments on these blogs tend to be a bit dismissive of each others efforts rather than having an unbiased discussion on the best way to do something. Constructors: Then I started reading about constructors, and how you can't create multiple constructors as easily as you could in my usual environment, using these 2 articles as research: http://ordinarywebguy.wordpress.com/2008/01/31/multiple-constructor-in-php/ http://www.alfonsojimenez.com/computers/multiple-constructors-in-php So for example, if I wanted to be able to create a new object from a SOAP Response or as an item retrieved from a collection, I would effectively want to have two constructs like this: public function __construct(SomeObject $result) public function __construct($resultFromSOAPResponse) which isn't possible as such, but can be recreated, sort of, using static methods? Again, what do people here suggest? Enums: Then I started reading about Enums, using the following examples: http://it.toolbox.com/blogs/macsploitation/enums-in-php-a-native-implementation-25228 http://stackoverflow.com/questions/254514/php-and-enums http://forums.devarticles.com/php-development-48/php-and-enumerations-8.html and so on. It's enough to make me want to run back to C#, but I thought I'd ask here first and find out what people think about these "issues". I now wonder if it's worth even bothering trying to "recreate" what I'm used to in a PHP environment, and just stick to simpler coding to keep to PHP's strengths? I just want to get my hands dirty with some code now, but I want to ensure I start off on the right foot with my coding efforts, so that my PHP coding doesn't go the same way my old classic ASP coding used to go, with horrible undocumented unreadable spaghetti code, with no real structure.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.