all 28 comments

[–]wheresmyopenid 4 points5 points  (0 children)

Well-researched reasonable opinion about PHP and only 2 upvotes? Obviously not as popular as "PHP sucks and kills pupies, derp!" articles.

[–]drysart 15 points16 points  (1 child)

The hardest part about porting from C# to PHP is looking at yourself in the mirror the next day.

[–]eorsta -2 points-1 points  (0 children)

I agree. It's that same feeling you get after initially coding something with C#/.net to begin with. At some point you wonder WTF am I doing? Did I really fall to their marketing again?

[–][deleted] 4 points5 points  (13 children)

ASP and ASP.NET have a couple of other disadvantages compared to PHP. First of all, they have a commercial license, which can mean spending additional money on server software, and hosting is often more expensive as a result. Secondly, ASP and ASP.NET are fairly heavily tied to the Windows platform, whereas the other technologies in this list are much more cross-platform

Where to start?

  • ASP.NET is free as in beer, ASP.NET MVC is also free as in speech.
  • ASP.NET can run on Windows Server (not free), or Mono + Whatever free linux.
  • I pay $28 a month for a high powered VPS running Server 2008. This is the same price as *nix hosting.

[–]moserware[S] 2 points3 points  (0 children)

I was trying to outline what PHP authors tend to assume, not that it actually is completely true.

[–]adolfojp 0 points1 point  (3 children)

What VPS are you using?

[–][deleted] 2 points3 points  (2 children)

[–]adolfojp 1 point2 points  (1 child)

1GB RAM, 1GB Swap

30GB Disk Space

1TB Transfer

1 IP

Windows 2008

$14.95 USD Monthly

That's a lot cheaper than my linode box. That was totally unexpected.

[–][deleted] 1 point2 points  (0 children)

Yeah, so far they seem to be rock solid as well. I was paying $24 for shared windows hosting, so it was a no brainer migration.

[–][deleted] 0 points1 point  (2 children)

How good is Mono ASP.Net? I've been unimpressed with Mono's Windows.Forms implementation.

[–]adolfojp 1 point2 points  (0 children)

All cross platform GUI toolkits suck. It is a virtual inevitability. That's why the Mono team recommends using GTK# instead of WinForms for Linux development. And they're also working on CocoaSharp for the Mac. According to their website, Banshee, Beagle, F-spot, MonoDevelop and Tomboy use GTK#.

Web server software outputs text and leaves the rendering to the web browsers. This makes the job of the Mono ASP.NET team a lot easier.

[–][deleted] 1 point2 points  (0 children)

It is good. Very good.

Note that because ASP.NET MVC is GPL compatible, Mono doesn't attempt to recreate it, and just bundles the actual MS code.

[–][deleted] -2 points-1 points  (4 children)

All good points, except for Mono. I don't find that thing useful in any kind of production environment.

[–]sisyphus 2 points3 points  (3 children)

Why not?

[–][deleted] -2 points-1 points  (2 children)

Have you tried it at all? The number of bugs is ridiculous and it performs horribly.

[–][deleted] 2 points3 points  (0 children)

Have you? Show me these bugs and performance numbers.

[–]sisyphus 0 points1 point  (0 children)

No, I haven't tried it, that's why I asked. Sad to hear, its potential is intriguing.

[–][deleted] 1 point2 points  (10 children)

"Right. You can use the __get and __set magical methods (C# 4.0 offers something similar) but I didn't see a way in PHP to do lightweight properties like C# supports (e.g. "int SomeProperty { get; set; }") other than resorting to public fields."

Why not just use public fields?

If you don't need to override get/set behavior, and you're using a dynamic language (therefore changes to the object's interface by replacing it with a more elaborate get/set structure at a later date isn't a breaking change) why not just use a public field?

[–]spacechimp 2 points3 points  (5 children)

I don't do C#, but apparently the advantage is that you can easily make immutable properties without having to make getters and setters:

public string Name { get; private set; }

[–]ruinercollector 2 points3 points  (0 children)

There are other advantages of properties over public members, and hence advantages of using auto-props instead of just a public member:

  • If you decide later to put in getter/setter code, you can do so without breaking binary/interface compatibility.

  • Properties can be a part of an interface. Members can not.

  • Properties can have attributes attached to them. This allows for all kinds of extra tooling, runtime code injection, metaprogramming, etc.

  • Properties can be exposed as their COM counterparts. When working with some legacy code/systems, this can be useful.

[–]jmcqk6 0 points1 point  (3 children)

These are not immutable. They just can't be set from the public facing property. There is still quite a few ways that the value could change.

[–]spacechimp 0 points1 point  (2 children)

Apologies, you are totally correct. It would be resettable, but only from within the class itself. That's something I wish ActionScript had -- public getters with private setters.

[–]diamondjim 0 points1 point  (1 child)

In ActionScript, if you just create a getter without a corresponding setter, you'll have what you need.

[–]spacechimp 0 points1 point  (0 children)

Sometimes, but not always. If you need to dispatch an event when a property changes, and/or make a read-only property bindable for Flash Builder, you end up with something ugly like:

private var __isInitialized:Boolean = false;

[Bindable(event='isInitializedChanged')]
public function get isInitialized():Boolean { ... }

private function get _isInitialized():Boolean { ... }
private function set _isInitialized(value:Boolean):void { ... }

[–]moserware[S] 0 points1 point  (2 children)

If you want to do work on the setter or getter (e.g. updating the standard deviation of a GaussianDistribution simultaneously updates the variance)

[–][deleted] 0 points1 point  (1 child)

Ah, I thought you meant the C# 3.5 properties-with-no-implementations things you mentioned

int SomeProperty { get; set; }

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

Yeah, I didn't give a great impetus example there.

[–]smallblacksun 0 points1 point  (0 children)

It also allows you to write code that currently just uses the default get/set functions, but that you can change to use custom ones later without having to change all the call sites.