What do you want out of a framework?
Had an interesting discussion with blowmage (Mike Moore) over Twitter. I said that having the “param1/param2″ pattern in the ASP.NET MVC made me itchy from a security standpoint. He replied.
Eh, just don’t add them to the URL. The ASP.NET MVC assumes you know what you are doing. I’m sick of frameworks babysitting me.
and yet you use a managed language that holds your hand and cleans up your memory for you.
![]()
Which came out a little harsher than I meant. But my gist is, isn’t a GC system babysitting you already? How much abstraction do you want out of a framework?
Bottom line is: a web application, is basically an abstraction for sending and receiving headers and HTML to/from a browser. You can dress that process up with domain models and other abstractions. But you *can* build a web application strictly using sockets if you really don’t want to be babysat.
Now that’s absolute crazy talk. No one wants to build an eCommerce site by sending packets over a pipe. That’d be a crazy as writing an operating system today using 32-bit/64-bit x86 assembly. So we accept some levels of abstraction. In fact, we embrace abstraction. Hunting down errors in a memory dump is no fun. Neither is making sure all of your string buffers are properly allocated and sized. We don’t want to have to malloc() and free() char buffers when we want to concatenate strings, so we make a StringBuilder class that handles all the nastiness for us.
It’s also not fun to get stuck in a framework that is so opinionated that when you stray from it’s primrose path you are assaulted by rabid dogs. Opinionated software is good, but a framework should allow you to inject your own opinion.
So what do you really want out of a framework. Ultimately, I think developers really want a framework that will nerf the sharp corners of the underlying hardware for us. We want to be babysat.But we also want the freedom to rip things out and route around the hard parts. And frankly, we want frameworks that work for us, not against us. It’s when the framework is working against us that we rail and rant and cry out for change.
Me? I want the full on Star Trek-Computer:write-me-a-program-that-will-let-me-sell-my-”My Little Pony”-collection-on-eBay” framework.
Feel free to leave your own thoughts below. Difficulty: No Linking to Spolskys “Leaky Abstractions”
Language performance doesn’t matter when a database is involved
All of the latest Rails/Twitter performance bruhaha made me think about some advice I got a long time ago and that I dish out whenever someone asks me about some performance concerns they have with their code.
Nothing else matters once you hit the disk. Once you do any kind of activity that involves reading/writing to a hard disk, that activity instantly becomes your greatest performance drag. No matter how slow any language is at interpreting/JITing/compiling, it’s still orders of magnitude faster than interacting with a hard disk with physical, moving parts.
Changes in PHP 5.0
Most of the radical changes are in the Zend Engine 2.0 and the most important change is the addition of many keywords associated with object oriented programming (final, destructors, abstract, etc…). Which makes me wonder; If PHP supports a C syntax and has the object oriented features of C++, why wouldn’t you go ahead and use one of the bajillion C++ CGI/HTML libraries out there and just code your web application in C++? What about Java, or C# (either on an MS platform or on MONO)?The addition of the SQLite engine to PHP makes it pretty compelling, but a C++ API already exists for SQlite. I think the most compelling reason for using PHP still is it’s built in DB functions. Not that there aren’t existing libraries out there for any DB in almost any language, but PHP does kind of lump them all into one attractive package.
Why choose PHP over other Languages?
PHP has been around for a few years now and has matured as a language. Why should you use it over ASP, JSP, or Perl when you are building a web application? With a veritable alphabet of programming languages to choose from when you decide towrite a web based application, why should you choose PHP over ASP, JSP, Perl, CGI, or Cold Fusion? While any decision you make also has to be based on the business requirements of the application, as a consultant you often have the choice of what language to use. So barring an IT department that tells you "It’s Microsoft or nothing!" or a gaggle of UNIX developers demanding that all their applications be Java based, here are a few reasons why PHP is the best solution for web applications.It was created for the web – PHP started as a collection of C applications that the author wrote for use on his own web site. It evolved into a server-side scripting language built for building logic into web pages. This single-mindedness in design has resulted in a language that is both flexible and streamlined for use on the web.It’s cross-platform – PHP runs on UNIX, Linux, Mac OSX, and Windows. In addition to being cross-platform, it has built in functions for connecting to most popular database, including general ODBC connections. It’s cross-language – What does that mean? It’s a term I coined to show that PHP can use objects in languages other than PHP. It can call Windows COM objects and Java objects, making it easier to separate the business logic from the user interface. The PHP team is even working on letting it call .NET assemblies.The syntax is based on C – Being based on C makes it easier for Java, C, even Javascript programmers to pick up. It also has built in functions for handling regular expressions, XML parsing, and cryptography. You can compile in different libraries that allow you to manipulate graphics. One feature of the language where it breaks from the C syntax is it’s object-oriented nature. It supports the creation of custom classes and allowing other classes to inherit from your custom classes. Future releases should futher enhance it’s object-oriented capabilities.PHP is much faster than CGI – It’s not as fast as JSP’s, which are compiled, but it is faster and uses less system resources than CGI programs do.My final reason for choosing PHP over other languages has to do with the popularity of the languages. Thousands of web pages are running PHP and it has a dedicated following. If you choose to learn PHP, you can be assured that you can find enough resources to answer any question you have and in most cases you’ll find that someone has already written code that does exactly what you need and is giving it away for free.


