How do you design your new script?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
semblance
Forum Newbie
Posts: 5
Joined: Fri Nov 26, 2010 1:15 am

How do you design your new script?

Post by semblance »

Hi, I am a total newb, hi all,

I would like to know, how you go about designing a new application. (I dont know what classes mean or "do" yet) but I understand you would start by making a class php file first of all?

If you wanted to make a kick a** perfect application, starting with a blank sheet of paper, what do you do first?

I have an idea for a website and I have divided the whole thing into users section, contributors section and admin section.

Thats as far as I got so far. I think I have a good chance of building something adhoc, just by googling for specific functional code and haunting the w3c schools when I need a specific function without even being able to write code fluently. Theres so much out there to make forms and connect to database etc...Why should I spend years learning php, when I dont want to be a coder, but I dont like my experiences buying coding services, so have decided to try and get my php feet wet.

So my question is, how do you layout your site, what type of "roadmap" do you use to keep you on the trail?
semblance
Forum Newbie
Posts: 5
Joined: Fri Nov 26, 2010 1:15 am

Re: How do you design your new script?

Post by semblance »

oh I forgot to also ask,

can someone please please tell me, how do I find a specific line of text in a completed program. I have downloaded and installed joomla and I have ftp it to my local server. When I use the vista search to look in all files for all instances of a "specific line of text" it fails aggravatingly.

If I can find instances of specific text and identify the file path and find the file, I can play with it and test different formatting and attributes until I got it how i want.

So, Im asking and please this question is really crucial to me. How do coders search and locate a 3000 file program for specific areas or functions of code they are trying to edit or work on?

Is there some free or cheap program I caqn buy to search all files for instances of text I want to locate?

thank you so much for any responses!
s992
Forum Contributor
Posts: 124
Joined: Wed Oct 27, 2010 3:06 pm

Re: How do you design your new script?

Post by s992 »

To answer your second question, Windows Grep is a great program for what you described.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: How do you design your new script?

Post by McInfo »

semblance wrote:I dont know what classes mean or "do" yet
When you start learning to program, you first learn to store data in variables, and display the contents of the variables with commands like echo and print. Then you learn how to branch the logic flow of your program with control structures like if and switch.

As you write more code, you begin to notice patterns and repetition in consecutive statements. You learn to condense the repetitive code with looping control structures like while and for.

Then you notice patterns that repeat in non-consecutive areas of your code. You learn to use functions to isolate those patterns and refer to them by names.

Eventually, your program grows large enough that it becomes difficult to predict how all variables and functions will influence each other; and you are running out of distinct, concise names for your variables and functions. You notice patterns in the way some variables and functions are used together in different parts of you program. You learn to use classes to combine variables and functions that are related, thus condensing the code and freeing up names.

At some point, you find a need to import a class written by someone else. Unfortunately, the name of the class conflicts with a class you wrote. You learn to use namespaces to allow the use of two classes with the same name in one program without changing the class names.

In summary, programming structures are simply ways to control variable scope and provide meaningful names to patterns. They often provide a performance benefit, too.

Write code. Make mistakes. Learn from your mistakes.
semblance wrote:how do I find a specific line of text in a completed program
IDEs like Eclipse and NetBeans (both free software) offer search functionality as well as other fantastic features.
semblance wrote:Why should I spend years learning php
If you want something done "the right way" (according to your own criteria), you must do it yourself. In order to do it, you must know what you are doing.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: How do you design your new script?

Post by califdon »

Nice summary, McInfo!

@semblance: On a scale of 10, with 10 being a sure thing and 1 being no chance at all, I'd rate your chances of writing a serious application following the approach you described, as 2. Programming is a tedious, high-precision activity that is highly intolerant of errors at many levels. Just grabbing for little bits and pieces of knowledge in this field just doesn't yield useful results.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: How do you design your new script?

Post by McInfo »

califdon wrote:Nice summary, McInfo!
Thanks. I thought so, too. :wink:
semblance
Forum Newbie
Posts: 5
Joined: Fri Nov 26, 2010 1:15 am

Re: How do you design your new script?

Post by semblance »

Thank you McInfo and s992! :D

I will look into all three applications mentioned. It just seems obvious to me, a tool like this is the very first thing you need if you want to customize an existing cms, even if you do know php inside out, how the hec do you find what you are looking for without some sort of search ability lol. Thank you again, will update later and let you know which one worked for me :)

@califdon, yeah, I sense I would have a small chance, 2 out of 10 sounds about right depending on the complexity of my ambitions. Thank you for your honesty. I reserve the right to sound like a total novice right now, because I am lol.

I have tackled php several times over the years and always gave it up as futile. Only last week a light switched on about how to name a variable. All these years I was getting confused about the naming examples I cudnt work out what they meant, I suddenly realized, php designates a variable by the dollar sign and thats it. I couldnt work out why sometimes some examples had VAR_ in it and others didnt I realize now variables are a container and u put things in them and name them anything u like! lol, As long as you got a dollar sign at the beginning.

When I realized that, all sorts of things started clicking and I have a new found interest in php. Like operators and condition statements and loops. They all suddenly make sense to me whereas before last thursday, It was like reading ancient greek. Now I see its quite a rudimentary system with of course many many details and variations that need learning and understanding.

McInfo, thanks for this clear and concise outline, before last week it would have gone over my head, and I still probably dont grasp how nicely you have actually put it, so will read your post again in a few months.

Thanks again!

Does learning php or any other computer language for that matter change you as a person? Did you become self actualized or in some way become a better more robust personality due to the rigorous strictness? I have spoken to many coders over the years and they all seem to have a uniform character when talking about a project. A sort of respectful humbleness for the power of the code itself.

just an observation. Thanks again!
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: How do you design your new script?

Post by McInfo »

semblance wrote:if you want to customize an existing cms
The CMS's documentation is usually very helpful, too. It should explain the "why" whereas the code explains the "how".
semblance wrote:variables are a container
Thinking of variables as containers is fine in most cases.

However, it is possible for two distinctly-named variables to "contain" data from a common memory location (references). It is also possible to disconnect a variable name from one memory location and connect it to a different memory location (reassignment).

So, it makes sense to think of variables as grasping data rather than acting as a container. It is the variable that is transient, not the data. You can say a variable holds data, which is ambiguous as to whether you mean grasps or contains.
semblance wrote:I have a new found interest in php.
I like your enthusiasm.
semblance wrote:Does learning php or any other computer language for that matter change you as a person?
I have noticed that I think of things outside this virtual world in a more structured way than I once did. That may be a symptom of age, but I do think programming has played a part in forming my perception of things other than programming.

One side effect I must frequently suppress is the urge to program other people. I find myself advising others on how they could do certain tasks more efficiently or in ways that have more desirable outcomes.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: How do you design your new script?

Post by McInfo »

Maybe this topic should be moved to Theory and Design.
Post Reply