Thursday, November 15, 2007

Random Thoughts Of The Day

A few random thoughts I had today...

  • When I joined Innovectra I needed to upgrade my wardrobe from .com startup t-shirts and shorts to professional starched shirts and dress pants. This morning I realized that I need to upgrade my wardrobe again, but this time to be optimized for the web based entrepreneur. This is all to say, I really need to buy some more sweat pants.
  • I knew When Harry Met Sally was an inspiring movie - but even I was surprised to see that it could inspire a country music song.
  • What kind of language offers a built in function to convert newlines to BR's? PHP, of course. That seems a bit excessive to me, but as I'm doing more and more PHP these days I'm finding that's the norm. In general, if you want to do something relatively common, PHP probably has a convenient way to do it. Compare file_get_contents(path) with the gobs of code you need to accomplish the same thing in Java.
  • Whoever claimed that PHP was more readable than say Scheme, needs to have their head examined. Now, tell me, which one is easier to parse?
    (if (unset? model)
        `(span ,make)
        `(a (@ (href ,(build-url make model)) (style ,link-style)) ,make))
    
    <?php if(empty($model)) { ?>
      <span><?php echo $make ?></span>
    <?php } else { ?>
      <a href='<?php echo build_url($make, $model); ?>' 
         style='<?php echo $link_style ?><?php echo $make ?></a>
    <?php } >
    
    And PHP is even harder to read after it's been picked over by a few different programmers. Seriously, it makes perl look easy to follow.
  • ShowMyPC was a godsend this this morning while working with a customer. It's hands down the best desktop sharing app I've seen. And the fact that it's free and doesn't require a login or registration just makes it all the more impressive.
  • Sometimes a song can teach history better than history books. I'm not sure the lyrics alone can do it justice. While listening to the song, I just had to Google the event mentioned to learn more.

3 comments:

  1. Anonymous12:50 PM

    I believe that by default, you can use "short open tags" in php. That is , to improve readability you can just use

    <? and ?>

    If it's not on by default, you can turn it on in the php conf.

    ReplyDelete
  2. That kinda helps, but not really. It's still tricky trying to balance all the { } in conditionals and loops, and it's still not valid xml to have:

    <a href=<? ... ?>>...

    Not to mention you need the explicit call to echo too.

    What I don't understand is why PHP hasn't done what Java did with their tag libraries and expression language.

    Basically, JSP 1.0 was the same as PHP, and folks realized it's a mess. They then found a fairly clean solution and ran with it, and apps written in JSP 2.0 are much cleaner.

    ReplyDelete
  3. Anonymous2:39 PM

    I've never really done a ton of work with either, but just one more php tip I'm aware of that you might find useful, you can use

    <?=

    instead of explicitly calling echo.

    Or, maybe it'd be worth it to consider a php template engine? Smarty might be too kitchen-sinky, but I believe there are a lot of lighter alternatives.

    ReplyDelete

LinkWithin

Related Posts with Thumbnails