1

(14 replies, posted in Shoot the Breeze)

I use Ubuntu pretty much all the time at home. I'm forced to use WinXP at work. Ubuntu is, for the most part, really good. The one thing I *really* miss is Adobe Fireworks. That, and testing sites in IE, is pretty much the only reason I keep a Windows installation on my machine.

2

(17 replies, posted in .NET Discussion)

I use it at work, but I'm a PHP boy at home.

I got it, and like others here loved it (although not on the first listen). I wrote two reviews of it, one during/immediately after the first and doomed listen (http://www.stillbreathing.co.uk/blog/20 … -rainbows/) and one a few days later: http://www.stillbreathing.co.uk/blog/20 … ws-part-2/

Yes, the decision to offer the download for any price was genius. I think we'll be seeing a lot more bands following that example.

4

(20 replies, posted in Ajax + JavaScript)

I wouldn't be doing my duty if I didn't point out my little library (built on Prototype) to do tabs, and a whole lot more. Get the skinny, as the young people say, here: http://www.stillbreathing.co.uk/project … ormer.html

5

(14 replies, posted in PHP Discussion)

It's for object-oriented PHP. For a general description of object oriented code look here (http://en.wikipedia.org/wiki/Object-ori … rogramming) or I wrote a little explanation here; http://www.stillbreathing.co.uk/experiments/datatable/.

Basically you have an object and the -> syntax gives access to properties and methods. For instance, if I have an object called "$Bob" then I would get Bob to perform his dad-dance method like this:

$Bob->DadDance();

And I could get Bob's tie colour property like this:

print $Bob->TieColour;

It get's a lot more complicated than that (what you've got above is an object within an object, i.e. $object1->$object2->MethodOrProperty) but them's the basics.

Also check out http://www.maccaws.org/ and http://icant.co.uk/webstandardsforbusiness/

7

(11 replies, posted in Shoot the Breeze)

tank wrote:

You end up doubting yourself and not getting paid what you are worth.

There's the crux for us poor freelancers. Charge what we are worth (and what we need) and risk putting people off because there are "cheaper" people, or drop our prices. It's a tough situation when you've got bills to pay and only tight-fisted clients coming through the door. Still, we've got a moral and commercial interest to continue to produce high-quality solutions, and they don't come cheap. There will always be clients willing to pay a fair price for good work, just as there will always be people that expect the world for nothing.

aim, that looks great. I'm not sure some of the features would be used very much by some churches (I'm in a middle-of-the-road Anglican church) but the overall look and functionality is excellent. Well done!

9

(8 replies, posted in PHP Discussion)

You can also use $_SERVER["QUERY_STRING"] - see here for more details: http://uk2.php.net/reserved.variables

10

(39 replies, posted in Shoot the Breeze)

Chris Taylor
contact: MSN = mrwiblog@hotmail.com
website: http://www.stillbreathing.co.uk
status: occassionally logged in, but generally only available to talk sporadically
topics: CSS, JavaScript, design, the web world, accessibility, assorted items of general interest and entertainment

11

(122 replies, posted in Shoot the Breeze)

You're a hero, thanks!

12

(122 replies, posted in Shoot the Breeze)

Hey chaps, any chance someone could send me the following?

Yuletide Snow
Manhattan Symbol
Manhattan Smilies 1
Manhattan Smilies 2
Manhattan Finance

I've got these if anyone is interested:

Ashbury Menagerie
Dresden Atmosphere
Farewell Snow
Groom Lake Invasion
Helsinki Hi-Fi
Mallow Buzz 2
Manhattan Night Life
Oslo Atmosphere
Oslo Finance
Shanghai Tech
Shanghai Tech Vector
Taipei Buddies 1
Taipei Buddies 2
Taipei Monkey
Taipei Night Market
Tower Grove Melee
Turkey Hunt

Thank you all smile

I use Dreamhost and can't really fault them. And when they do have problems they are extremely communicative. So if you want to sign up contact me wink

14

(18 replies, posted in .NET Discussion)

Heh, maybe. But then again maybe not. I'm starting to get into Mono, so I'll soon have a penguin with a .aspx file extension wink

15

(18 replies, posted in .NET Discussion)

I've just accepted a new job which is for .Net. I know what you purists are thinking smile but I'll still be doing as much PHP and RoR as I can.

16

(5 replies, posted in PHP Discussion)

I use Mint on one of my sites and I haven't seen any encryption or privacy code in it. But then again I haven't been looking for it.

17

(2 replies, posted in Shoot the Breeze)

In my experience it depends. I've written systems that are nothing more than glorified address books but people have still called them "intranets". On the other hand I've spent 18 months on a system to manage an entire department with many complex workflows, but it's still called an intranet.

If it's a good client then it's always worth finding out exactly - or as exactly as possible - what they want. It could be a simple CMS will do the job very well.

18

(2 replies, posted in Shoot the Breeze)

I couldn't find a place to share random funnies, so here goes the first.

http://www.pi.pwp.blueyonder.co.uk/creation.html

Kenny, that's fantastic. Can you do the rest of the bible - maybe then I'd understand it a bit more :0)

I agree with what you say. The only language I know pretty well where everything is an object is Javascript, and knowing that certainly has changed the way I work.

RayCMorgan wrote:

...now its 3 Rubyist vs 1 PHP(ist/er/ dude)... this can get ugly.

You're right, it could. But don't worry, I'll go easy on you all wink

So I think we can sum this up as OO will rule the web soon, although the formats that are output, are surely less OO in feel compared to the Models and the Controllers.

Yes, this seems to sum things up. I was pretty convinced of the OOP thing before this discussion, but it's certainly helped to confirm some of the more esoteric nuances of this methodology. Maybe I had unrealistic expectations, but seeing code that was this:

<html stuff>

<instantiate an object and set some properties>

<more html stuff>

<invoke a method>

<more html stuff>

<output the methods' return property (or similar) >

<more html stuff>

<a bit more stuff with the object>

<finish html stuff>

Rather than this:

<html stuff>

<set some variables and include a set of functions>

<more html stuff>

<call a function>

<more html stuff>

<output the functions return property (or similar) >

<more html stuff>

<a bit more stuff with some functions and variables>

<finish html stuff>

Made me a bit confused. It happens a lot, I know. However there are definite advantages to wrapping things in classes, and I also have to say that Ruby/Rails looks very, very impressive. More of an investigation is obviously needed - when I find time roll

Robert Evans wrote:

Then it is merely a difference in how we view *pages*. In the conception of the internet, HTML was used to display text, a text holder per say. It wasn't used for interaction. Today, we used server side languages that pull data from a database and display it for the user to read. It is still the same thing, a text holder. What changes is when you start getting the user to interact with the application and the application either interacts with the user or connects users to connect with each other or both.

In many respects, people still use the internet to display information that is meant to be read, but not interacted with. I'm used to when people talk about pages, they are refering to a page that is used to *just* display text, nothing more, hence my different view point on the word pages in the context of the internet.

OK, I thought so. I've certainly learned to be more careful with my choice of words when describing certain aspects of web apps. Thanks Robert, what you've said is certainly appreciated.

ryenski wrote:

But to me, the real sugar is in the ActiveRecord database handles. The fact that I can have a User object that maps directly to a users table is pure luxury. I often forget that I'm working on a database at all - the db fades away leaving only the data, my app, and a very happy programmer.

That, more than anything else, sounds wonderful. Now, can anyone write a system to give me more hours in the day?

Wow. Ray, can I make a request? Can you draw an ASCII diagram of my brain exploding? smile

OK, there's loads to think of there. Robert, I absolutely see what you're saying. And yes, I have been guilty of seeing things everything in terms of pages. There's a valid reason for that; all my apps so far have been accessible (wther they spew out HTML, XML, JSON etc etc) at a URL, for example http://myapp.com/users/edit/123/. And where I see a URL, I think of a page. Maybe that's not quite what you mean, but that's what I meant when I said the page model isn't going anywhere soon.

However (you knew there'd be one of those, didn't you) I don't agree with a few things you said:

Robert Evans wrote:

There may be a form that takes input and stores it, but no real interaction like we see with desktop applications. Applications, interact with users. Applications provide solutions to problems. Pages serve information, but not working solutions to help solve problems.
...
Thus, I can provide more than a mere page that can interact with a community of people to help solve their problems.
...
A simple example: Campfire. If campfire was a page, it would only provide information, not allow a group of people to interact with it and each other. The software keeps records that can be viewed at any time. It connects people with people. It solves a real problem.
...
Now, maybe you view pages differently than I have explained here, which is how I view them. As Ray said, it is a way of thinking about our online environment and realizing it is more than just a text holder.

OK, where do I start? Firstly I see that Ray is absolutely right about the semantics surrounding the word "page". I see a page as a resource which may or may not have any level of interactive functionality attached to it. Campfire is, in my view, a series of web pages with come nifty client-side scripting going on to provide the interaction. However I get the feeling what you see a "page" as nothing but a static display of information, and that's why you provide "more" than a mere page.

But I provide pages that do a job: in your parlance, a website that gives interaction, serves information AND gives working solutions. I'm sure we're all singing from the same hymn sheet here, and discussions about something as esoteric as the meaning of the word "page" aren't very productive, and it's obvious we have a different view on that particular word. Maybe I should use the word "resource" instead to make things clear. Anyway, as you've rightly said, it's the quality of the solution that makes the difference.

There is a reason why the 37signals are doing so well. They have stopped seeing the web as place that solely delivers information and see it as a place that can deliver solutions to people who have real needs and problems.

Nope, don't agree with that either smile 37signals aren't the only people in the world to build interactive web applications. They weren't even the first, not by a long way. They are successful because their solutions are simple but powerful, elegant and aimed at the right market. The rest of the web-world isn't still stuck in 1996, and even average-sized companies now have websites that provide useful solutions to fill real needs. Still, the 37signals boys are an inspiration to me because of the way they constantly allow users to do more with less hassle - much like the Ruby language itself, I would guess.

ChrisT wrote:

The other thing PHP really kicks donkey in is it's awesome range of built-in functions. You need to do something to a string or an integer? Chances are PHP has the exact thing you need as part of its core library.

Ruby, being a pure OO language, also has its own cool things. If I wanted to convert a number to a string = 1.to_s. If I want to convert a string to number = "10".to_i. This is a classic example that every number and string is an object. And because it is an object, each has its own set of methods and that means every thing in Ruby has methods for it. PHP does not. And surely you wouldn't tell me that a non object has more depth than an object.

Absolutely not, and I made exactly that point myself earlier in the discussion. However PHP does have the equivalent functions to do what your examples do there, just using procedural rather than OOP techniques. Which, in simple apps at least, is more than adequate. Note I said 'adequate' and I also said earlier that PHP is good for smaller apps. If we're talking enterprise-level stuff then we're into a whole new world, and one in which Ruby has yet to make big in-roads, too. Maybe it will, it certainly has the passionate support of a lot of developers, only time will tell.

Ray, your diagrams were a great help. And the snippet of Ruby (hey, it really is easy to understand!) is extremely impressive. Traditionally I've had to write functions to do all that array-to-output-format stuff myself, if it's built into Ruby then that's a great thing. Your and Roberts explanation of other output formats and devices was also useful, as I think a lot of developers (myself included) get a buit myopic when they're writing web apps day in, day out. I get asked to provide things in XML (or JSON, or CSV, or PDF, or other formats) regularly, but still it's easy to slip into seeing these outputs as less important.

class Bar
  include Foo

  def say_goodbye
    puts "goodbye"
  end
end

Well strike me down. That's great. But what I really want is something like this:

class Bar
  include Foo
  include Boo
  include Goo
  include Soo

  def say_goodbye
    puts "goodbye"
  end
end

Is that possible?

Yes, great thread.

Firstly in response to Ace of Dubs: I would largely concur with Ray. PHP is great for sites that require basic dynamic scripting as it is very easy to get into. You can do much more complex stuff - Ray and I have both posted some pretty advanced examples of what you can do in PHP - but it is harder to do than, for example, Ruby. The other thing PHP really kicks donkey in is it's awesome range of built-in functions. You need to do something to a string or an integer? Chances are PHP has the exact thing you need as part of its core library.

OK, back to the discussion. Ray, thanks for the encouragement. I got halfway through your post and thought "But I need these methods to be available to more than just the User class!" and then you gave the answer smile The validation class idea (or even just a general string manipulation class) is something I've used on a couple of projects and it works well. I've met up with PHPs limitations with regard to inheritance (why oh why can't I have a list of inherits values like .Net? Does Ruby do that?) when doing that, and I'm not sure what the performance overhead is when using potentialy hundreds of static properties and methods without ever initiating an instance of a class. That's a bit of a wooly question, though, so I doubt I'll get an answer.

Robert, I'm afraid I don't quite agree with this:

Robert Evans wrote:

One problem with your approach to the web is seeing it as only pages. This is a 1990's way of thinking, and I mean no offense, but things are rapidly changing right now in how we use the internet. More applications are being deployed on the internet than on the desktop, and this isn't going to change, but rather continue with an increasing effort. It is all about portability.

Just to clarify: I am NOT saying that OOP doesn't have a very important place in the future of the web, without a doubt it does for all the reasons you have stated. What I am failing to see at the moment is why web developers shouldn't see web applications as collections of pages. After all, that's what they are unless you're writing a single-page app with oodles of client-side script to send and receive data that then update parts of that page (AJAX, basically). However I've not seen many of these apps, and certainly een the most Web 2.0 of my systems has multiple pages.

I understand that we have to be aware of different output formats - not just HTML pages, but web services, XML files, JSON etc etc - but surely an understanding and appreciation of the main output of a web application is crucial to making sure that app is as widely received as possible? Remember, when we're building web apps the ONLY things the users browser ever sees is the CSS, Javascript and HTML pages. Despite the huge changes afoot on the web right now I don't see the HTML page model disappearing anytime soon.

Do you get what I mean? What I'm saying is let's use OOP but within the HTML page model that websites are built on. This would be using the include capabilities of any scripting language that we've all be using for years to centralise code. That code could be classes; as I demonstrated above I've been mainly using OOP techniques rather than procedural ones for several months. Check out my last post, you'll see I've even wrapped up each HTML page into it's own object:

ChrisT wrote:

The biggest problem, and this is something that amazingly Microsoft have tackled pretty well, is making the entire page an object. In the Ruby code above you hard-coded your HTML, interspersed with Ruby. That's exactly what I've been doing for years, just not with classes. So I've tried to go one step further by incorporating a home-grown templating system in my apps that gives me access to methods like setTitle(), setJavascriptInclude() and properties like bodyID and bodyClass. Obviously I could take the page's methods and properties to the nth degree, but in general I leave little HTML to the processing page as possible - everything I can is put in the template file.

Using a similar idea I could create an XML or JSON object that then has it's content set by my other data classes. Don't you agree this is a step in the right direction?

Thanks Ray, that's really useful. I suppose as that was your "sermon" I should say a hearty "Amen, preach it!" wink

The good news is that I'm doing pretty much what you described. Sample code from the e-comerce system I'm working on today below:

// general system settings, URLs, password etc
require_once "system.class.php";

// the database connection details, and methods to get/set data
require_once "db.class.php"; 

// loads the correct template, and sets methods to do various standard things - set
// the title, enable/disable the Javascript framework etc
require_once "page.class.php";

// methods and properties for the current user - save details, reset password etc 
require_once "user.class.php"; 

// the users shopping basket, add item, remove item etc
require_once "basket.class.php"; 

// general functions: THIS ISN'T OOP, just plain vanilla functions to validate email
// addresses, querystring parameters etc. See notes below
require_once "functions.php"; 

// create the new system
$system = new System;

// create the database connection
$conn = new DB;

// create the users basket
$basket = new Basket;

// create the page
$page = new Page;

// set the page body
$page->body = "<h1>Welcome</h1><p>Welcome to my lovely shop.</p>";

// show the basket
$page->body .= "<h2>You have ".$basket->numItems." items in your basket.</h2>";

// get the list of categories
$conn->sql = "select category from categories;";
$conn->open();

// loop the rows
while ($row = $conn->getRow($conn->recordset)){
$page->body .= "<p>".$row["category"]."</p>";
}

// finally, draw the completed page
$page->draw();

Obviously I've missed out a load of error checking and shortened the SQL and loop bit to make it readable. But you get the drift. So, is this OOP? I would guess so, but I'm still not sure if I'm capturing everything I could in classes.

For example, in my functions.php file I have a load of standard functions that validate email addresses, validate querystring parameters, things like that. Now I suppose I could wrap them up in a class, but the problem I have is making every class aware of and able to use every other classes methods and properties. That's a problem with PHPs inheritance, and I've not yet found a satisfactory solution (although setting every property to be a global static seems to work, similar to your :variable code above).

You'll have noticed al my classes have their own PHP file. I find that makes it easier to keep track of things, include what I need and not other stuff (and therefore save compiling cycles), and version the classes if I want. That means sharing methods and properties is a bit tricky. Would it be better to wrap everything up in a superclass, so it the entire system is just one class (a la .net)? How does Ruby handle that? Any PHP gurus out there? What do you do?

The biggest problem, and this is something that amazingly Microsoft have tackled pretty well, is making the entire page an object. In the Ruby code above you hard-coded your HTML, interspersed with Ruby. That's exactly what I've been doing for years, just not with classes. So I've tried to go one step further by incorporating a home-grown templating system in my apps that gives me access to methods like setTitle(), setJavascriptInclude() and properties like bodyID and bodyClass. Obviously I could take the page's methods and properties to the nth degree, but in general I leave little HTML to the processing page as possible - everything I can is put in the template file.

So, can you see any big shortcomings in this method? Would you class this as OOP, or a wierd hybrid?

Oh, and thanks for the great discussion smile

Thanks for your comments, Robert and Ray. I can see two things: firstly I haven't explained what I'd like to learn very well at all, and secondly that you are (like all Ruby programmers I've talked with so far) in love with the language. I'm not disagreeing that Ruby is a great language, what I've seen of it is very impressive, and that you can do more with less code. What I am questioning is whether a complete OOP approach is actually the right thing for web development. After all, we deal in pages that are - by the very nature of HTTP - transitory and stateless. Does a pure OOP model actually make sense for this kind of application?

My simple example with the include scripts above tried to explain that whether you use an OOP model or a procedural model when building web applications, you still meet the problem of having to include central code repositories - whether they are classes or just sets of functions - in your pages. Therefore in my experience a lot of time, effort and lines of code can be saved by clever encapsulation of methods and properties - regardless of your methodology.

I've got quite a lot of experience writing Javascript, in which everything is an object (like Ruby). Therefore I understand the extending classes thing pretty well - and the Prototype library (my favourite so far) does this to great effect. However I realise that Javascript is limited to one page, it being a client-side technology. In that regard it is akin to traditional application development which is all self-contained and never meets the problems of state or reloading entire apps (which is basically what happens when someone requests a new page in a web application).

Do you see what I mean? It's quite a slippery question to ask, and I know what your answer will be smile but still I'd like to find out HOW (not why) Ruby does what it does on a page-by-page basis. Code examples may well be necessary.

Thanks for your help in this, guys.

25

(67 replies, posted in PHP Discussion)

Regarding the whole OOP thing, I realise I'd taken this thread off-topic, so I created a dedicated thread here. I'd appreciate anyone (especially Robert and the other Ruby guys) to weigh in there with teir thoughts and advice. Thanks, back to your proper discussion smile