Hi, I'll try to make this quick. I'm used to programming PHP in context of building websites, to add random bits of dynamic functionality, but every once in a while I need to build something like a complete application. My problem is this, as a single developer, there comes a point in time where my project starts to get too big for me to manage in my head. There is too much logic flow, too many data points to track, too many twists and turns in the flowchart. I start to get lost in how many branches of logic the program has taken. For example think something like "ok the user did this, they have that permission, they can go here, but only if they've done that, they can't see this thing yet until they click here, but they need to enter this data first, but check if this date expired and they are still valid..........." Just making that up, but you get the point, I go so far down the rabbit hole of logic flow that I can't remember where I'm at sometimes! Then I have to go backward and figure what to do if they made some other choice and go down a different path.

The point is, I don't know how to manage all this logic, to keep track of every possible action and reaction of the app and all the hundreds of conditions that might be going on. Worse still, if I leave a project for a few weeks and come back, I haven't the foggiest idea where I left off or what I was working on or where in the code to start programming again.

My question is, is this just normal? Or am I missing some more advanced programming tools to track and record my progress? To know where I am programming in the app logic, to know where I leave off and where to start, to test all the hundreds of conditionals that the app logic has to sort through. I typically program just using one tool like Sublime or Netbeans, that's it. Are there 3rd party tools to help get through larger projects and keep track of everything? To know exactly what's done, what needs done, and track how a person might use the app among hundreds of possible conditionals?

I'm just looking for some programming theory, some tools, some thoughts on organizing projects. Thanks!

Recommended Answers

All 7 Replies

Member Avatar for iamthwee

sublime? May I ask how does that help... it's just an IDE right?

I don't know about the others but since I started using MVC understanding the mechanics and business logic is so much more easier.

As with all frameworks there is a learning curve. I'm learning codeigniter and I have to say I'd glad I have. Although others may say it is a dead project so go for laravel or something.

It forces you to apply very strict business logic. For example, you're saying your application might contain a tier of logic where if user clicks here they obtain access to something else. MVC will definitely help with this aspect.

Member Avatar for iamthwee

I also wanted to add, have you ever considered using a php rule engine... To be honest this is the first I've heard of it however, it looks very interesting and simpler to follow.

eg might be https://github.com/bobthecow/Ruler

I worked on maintaining very large mainframe systems written by others and I have developed some pretty large (PHP) systems myself. I have also dabbled in adapting and changing quite a few open source (PHP) systems. Generally, there was very little program-level documentation so what you have is the code and the comments in the code as your primary source of information.

If you are building a system or if you are deeply involved in making changes to a system built by someone else, you become very aware of the structure of the system, the utility functions that it has and the coding style that was used. In the individual programs, as you work with them, you become very aware of the program structure and it's relationship to the rest of the system. There is a learning process that you go through with someone else's system (and a construction process for your own system) and that requires some startup time. I often end up using some debugging facilities to trap some of the data to give me a better picture of what is going on. Obviously, it is going to be easier if you can work fairly intensely on a system until the job is done rather than leaving it for a while and coming back to it.

In my own systems, I try to structure things logically, keep the code as simple as I can and use lots of comments. All of the code that I work with is procedural (it doesn't use an MVC framework). If there is a part of the system that is particularly complex, I may create a document to explain it. If I need to do some work on a system (of mine!) that I haven't looked at in a while (which I have to do this coming week), there is some startup time to re-familarize myself with it. I don't think that there is any way to avoid that. You can only keep so much detail in your brain at one time (and who has the time or patience to document it all?). I've done it so many times that it's second nature to me. As I am going through the re-familarization process, if I find that it's more difficult than it should be, I'll probably add some documentation to make it easier the next time. I also leave all of my debug calls in my programs (but deactivated) so I can turn debugging on and look at the details of the data as another way to get a quick picture of what the program is doing.

With respect to your statement "...I don't know how to manage all this logic, to keep track of every possible action and reaction of the app and all the hundreds of conditions that might be going on"; I don't think that you can and you probably shouldn't lose sleep over it. You do the best job you can when you build it and if it breaks, you debug it and fix whatever isn't working. If you have the competence to build the system and make it work well, then you'll (re)figure out the logic and the conditions that apply to the specific situation that you need to fix / change when the time comes.

That may sound like a "seat-of-the-pants' approach but you can only spend so much time documenting. There are a number of software documentation methodologies available and tools that can help with setting up test cases but it does take a bit of time to learn them and set them up (which is probably why I haven't used them). As an alternative, you can document some of the key conditions in a program and you could even set up a matrix to check off when they have been tested. You can keep that for the future in case you need to make some significant changes so you can go through it again.

I don't know if this helps at all. It works for me but you may not be comfortable without more structure and documentation. Software development companies/departments often do use a very structured approach. They create very detailed documentation for systems and for their testing and even have people dedicated to some of those functions.

As an individual developer, I don't really have the time to do too much of that. I try to make the code somewhat self-documenting and rely on my skills and experience to get it right the first time; and, to be able to fix it if it breaks. I only document when it is going to give me some significant payback. In areas of a system where there is high complexity, some documentation may be critical, especially if you have a user who needs to confirm that you understand the requirement correctly. In any case where there is a user involved, I don't hesitate to document.

Overall, my record has been pretty good using this approach.

I do tend to use OOP principles and write DRY code, I just wonder what the super pro people do who work on large projects, how they track every little nuance to know what to work on and where to come back to and track every branch of logic the program creates.

It's really a general question that applies to building applications in ANY language, not just PHP. Cause surely nobody tries to track all this in their head. Even simple documentation and commenting in the source doesn't seem like it would be enough.

Hello guyinpv,

Use "brackets" for the same. It is lightweight and easy to use.

Member Avatar for diafol

Necroposting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.