On Saturday 24 April 2010 10:01:03 Ashley Sheridan wrote:
> On Sat, 2010-04-24 at 07:14 -0400, David McGlone wrote:
> > On Friday 23 April 2010 07:45:16 Michiel Sikma wrote:
> > > On 23 April 2010 13:15, David McGlone <da...@dmcentral.net> wrote:
> > > > Is there a good strategy to studying PHP?
> > > >
> > > > For instance, is there a way to break everything down into small
> > > > managable topics?
> > > >
> > > > --
> > > > Blessings,
> > > > David M.
> > >
> > > Just build what you want to build and look things up when necessary.
> > > The biggest part of learning any language is becoming able to
> > > creatively solve problems within its realm of possibilities, and that's
> > > something you can't really learn just by reading and solving textbook
> > > problems. Hands-on experience is a very important key to understanding.
> > >
> > > Keep an open mind, ask people for answers if things get difficult,
> > > always assume that there's a better way to do something, and in a while
> > > you'll be able to write perfectly decent programs.
> >
> > This is the route I have been following for the past couple years and I
> > have always assumed there is a better way to do something and that is, in
> > a way what makes me lose confidence.
> >
> > I always feel like my code is crap and sometimes even ashamed to even
> > show any of it.
> >
> > --
> > Blessings,
> > David M.
>
> For personal sites, I think as long as the code works, and doesn't have
> any glaringly obvious security holes in, then it should be fine.
> Personal sites tend not to have a huge amount of traffic, so speed
> doesn't really become an issue unless you're doing something totally
> crazy (like generating all of your header images on the fly with PHP for
> example without any caching)
>
> For commercial sites, more time should be spent on security and testing,
> and working over things in your head about how the site is going to get
> used. If an area of the site that you feel is going to be very popular
> will be busy, then is creating a lot of large objects and making many DB
> calls such a great idea?

In a sense it seems to me that this is the bridge I'm trying to cross. 
Developing personal sites aren't all that hard, because they don't require 
much functionality and most of the complexity shouldn't be too hard to solve 
with a little PHP. 

But when it comes to commercial sites, the complexity is even greater and also 
more intimidating to me.

>
> I look at some code I did a while back and shudder. It started off well
> enough, but then feature creep set in and now it looks like a creation
> of Frankenstein! I think it happens to all of us at some point, it just
> depends how well we deal with it. I'd rather have less then stellar code
> than have to tell a client it's going to take more time to add a feature
> and then have them go elsewhere.

To me my code is more like a bunch of kiddie scripts thrown together with an 
occasional thing I like to call "smart block" (a block of code that I 
concocted and wrote, that works and actually makes me feel proud of) LOL

here's a snippet of code I wrote:

$directories = array('gemstone', 'bella', 'passage', 'sedona', 'deepstar', 
'crystalline');


foreach ($directories as $directory){
echo "<h1><span>$directory</span></h1>";

        
                
$mydir2=opendir("images/laminate/Wilsonart_Laminate_Colors/$directory");
                $cats2=array();
                
                while(($cat2=readdir($mydir2)) !==false){
                        if ($cat2 != "." && $cat2 != ".." && 
strpos(strtolower($cat2),"-thumb.jpg") 
!== false){
                                array_push($cats2, $cat2);
                                
                                echo "<img 
src=images/laminate/Wilsonart_Laminate_Colors/$directory/$cat2 
onclick=Another_Big_One(this)>&nbsp;";
                        }
                }
                closedir($mydir2);

        } 

To tell you the truth, I have absolutely no clue how I did it. There's 
probably a much much better way to do it, but at my current level, I was 
surprised I even wrote this.

There is only 1 thing I don't particularly like about it. That is, the fact I 
used some HTML, but it doesn't bother me too much because it was way before I 
knew much about separating the presentation from the logic, but now days I 
have come to love SMARTY.

SMARTY forces me to separate things and to work in tiers and in turn forces me 
into standards and organization of my code. (I hope I explained that 
correctly).

-- 
Blessings,
David M.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to