View Single Post
Old 12-06-2007, 09:57 PM   #9 (permalink)
vujsa
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