TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-05-2007, 04:22 PM   #1 (permalink)
Nor
The Addict
 
Join Date: Nov 2007
Posts: 282
Thanks: 61
Nor is on a distinguished road
Default How do you plan your programs?

Whats your method for planning a script/program that you work on. (Trying to learn a new way to create/plan for stuff I create and actually finish from head to toe)
__________________
PHP/XHTML Freelancer:
Cleanscript.com v3 - Programming starting at just $5 act now!
Nor is offline  
Reply With Quote
Old 12-05-2007, 05:15 PM   #2 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Brainstorming!

What does it need and what do you want it to look like
First thing I question myself always. How do I want the outcome to look like? And what functions does it need.

For example if I'm creating a user system. How do I want it to look like? Do I want it to be with classes? Do I want user profiles, user PM's, etc etc..

How would I achieve this
I start by coding the base. For example, a database handler. If I'm doing classes, a DB class could come handy.

Next, how would I code the user system. Let's first go back and look at what functions it needs. Then I code each function.

Putting together and error testing
Creating the object from the class for example, and use the functions, and see if it works. If it doesn't, why? Try possible solutions, if the editing doesn't work, then try figure out a way to solve this with another function(s).



Something like that
Tanax is offline  
Reply With Quote
Old 12-05-2007, 06:23 PM   #3 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

heh i do a search for some open source code already written that fits almost what i want then mod the hell outta it. That gets about 50% of all my projects done.
CoryMathews is offline  
Reply With Quote
Old 12-05-2007, 07:30 PM   #4 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

In this order (each one expanding on the last)
1. What is the project
2. In English, what are the functions this site would do
2.1 Database design (done at the same time)
3. What files would be used and what would they do
4. How much time with expected debugging would this take

That gives me an accurate quote and a guideline to go by.

Quote:
Originally Posted by CoryMathews View Post
heh i do a search for some open source code already written that fits almost what i want then mod the hell outta it. That gets about 50% of all my projects done.
Thats illegal is almost all cases.
Village Idiot is offline  
Reply With Quote
Old 12-05-2007, 07:32 PM   #5 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

In extension to Village Idiot's list:

2.2, Draw up a UML diagram to describe the project to the other programmers.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-05-2007, 07:36 PM   #6 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
Thats illegal is almost all cases.
No thats one reason open source is out there.
CoryMathews is offline  
Reply With Quote
Old 12-05-2007, 07:43 PM   #7 (permalink)
bdm
The Acquainted
Good Samaritan 
 
Join Date: Nov 2007
Posts: 127
Thanks: 14
bdm is on a distinguished road
Default

Quote:
Originally Posted by CoryMathews View Post
No thats one reason open source is out there.
In most licenses, yeah.
bdm is offline  
Reply With Quote
Old 12-05-2007, 07:59 PM   #8 (permalink)
The Contributor
Upcoming Programmer 
 
Matt83's Avatar
 
Join Date: Oct 2007
Location: Argentina
Posts: 72
Thanks: 18
Matt83 is on a distinguished road
Default

i tend to give this part of the process a lot of attention, so for a guy with many programs/windows/things going on in the pc i like to get away from the computer and sit quietly to plan my programs, usually grab a pen and a clean page and start thinking/taking notes going from global to more detailed stuff, making relation charts, thinking my tables etc, that works for me. I think Village Idiot put down the order nicely, i would only add to create a to-do list from all of that just to keep track of everything and be sure i dont leave nothing behind. On the other hand, I never reached as far as creating an UML diagram, but i do consider it as a great practice, i hope to have time soon to give a deeper look on that subject and hopefully incorporate it to my workflow.
__________________
http://www.mattvarone.com
Matt83 is offline  
Reply With Quote
Old 12-06-2007, 09:57 PM   #9 (permalink)
The Wanderer
 
vujsa's Avatar
 
Join Date: Dec 2007
Location: Indianapolis, Indiana, USA
Posts: 16
Thanks: 0
vujsa is on a distinguished road
Default

Well, I'm a truck driver so I get a lot of time to sit and think nearly every part of my project out before I begin. Of course, you have to either remember everything that popped into your head or keep notes. My memory works pretty well most of the time. When it doesn't, I usually remember again when I come to the issue I had given so much thought about so I'm okay. For example, on a current project, I had worked out how I wanted to salt and check passwords in my database for user authorization but that was before I got to that point in the project. When I was ready for that, I could remember exactly what I decided to do but once I started to work on it, I was able to code it quickly because I had already determined the logic I wanted to follow.

So that is how I brain storm and work through problems I encounter. For me, the planning and logic is the easy part. I have trouble finding the time to write the code. Usually, the code flows very quickly once I get going but it is hard to find time to get started!

When working on a simple script, I usually just start writing and work the logic out as I go. Since the script is so simple, coding it in the procedural style is generally okay. However when I tackle a complex script or system, I usually break the entire think into parts and work on the most important part first. My current project, I am working on a system that will provide employees with specific details about any job that they might be required to perform. So the most important part of the system is the database interface. That is the backbone of the rest of the system. This is true of most PHP based systems these days...

Once I have a good MySQL class ready to go, I can start on the organization of data. This isn't really a programming thing exactly but you have to know how you want to organize the data before you write a database dependent system. Will each task have all of its own data in it or will some data be shared between tasks. For example, every one has to clock in and out and take a break. The database would save room if that wasn't included in every task record. Instead, have detail records that the task record can reference...

I always try and consider places in my code that would allow for an add-on feature or code optimization at a later date. OOP usually offers the best opportunities for such future modifications since each object should be capable of being modified without the need to rewrite large sections of the rest of the system.

I don't do diagrams but and outline of features is handy. If you keep the list nearby while working on the system, you should be able to anticipate places in the code you are currently working on as potential problems with a feature you'll be working on later. For example, if you plan to use pagination in your system, then it would be a good idea to consider that when you are writing the database queries used to populate your display with content. Otherwise, you'll probably need to go back and rewrite a bunch of code to make the queries and code work with pagination.

I also always use place holders. As I said before, I work on the most important part of the system first then the next important part and so on a so forth so I always plan out my place holders. This is just sample or test code or data that holds the place for the actual code to come later. This way you don't have to plan and write all of the specific features first. For example, I don't start with content, I start with framework but I have to have something in there as content or there will be errors in the script up until I finish the whole thing...

Finally, think BIG! Plan your system to be more than what you need. If you plan it for a bunch of features that you later don't need, then you can probably add those features later without much need to modify the entire system because you planned for it ahead of time. Remember, you can plan of a very complex method for storing and check passwords but if you then decide on something less extreme, it should be easy to accomplish.

I think many programmers think small and as a result, they develop limited scripts. Later they have to abandon their work and start from scratch because it is easier than rewriting their previous work.

So I suggest using a lot of functions and classes and make the system modular for optimal usage. Basically, I think everyone should design and develop their own base system to build all of their project on. Kind of like a CMS.

vujsa
__________________
Need PHP Help? - Handy PHP
vujsa is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:24 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design