Link to home
Start Free TrialLog in
Avatar of tonelm54
tonelm54

asked on

Time to create a simple web app

Im getting pretty depressed at how long its taking me to write PHP applications. Most that come across my desk are completly different, so i usually start from scratch, and by the time ive setup the host space, setup the database, written the login page, forgotten passwords page, new users page and started to create the site Ive already spent a few hours on it, and very little to show for it. The site works, but very little to show of the original request.

For instance Ive just been asked to create a new helpdesk, and spent 4 hours creating login pages, structure of the site, login pages, 3 different home pages dependent in the user login rights and put security around everything i can think of to make it more secure, but havnt even started on the tickets pages or APIs etc.

So my question is - is a few hours right to do all this, or am i just slow?
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

is a few hours right to do all this, or am i just slow? 
To build from scratch, you can't finish all within few hours. That's something not realistic to me. One single module by itself could have taking few man days. So, you probably could list down all the features to be included and build a development timeline accordingly.
Avatar of Daniel Pineault
Daniel Pineault

Proper development takes time.  With security being so important, I'd say hours is unlikely, should be measured in days, weeks, ... especially if you are starting from scratch.

I highly suggest you invest in using a framework Zend, Laravel, CodeIgniter, Symfony, Yii, ... these can quickly get you up and running and save you tremendous time.  They can also, deal with security, and other tasks so you can just concentrate on the custom stuff.
If you've got that done in a few hours, then I'd say ... fair play. These things don't just take a few minutes - they take hours, days, weeks.

Now, having said that, you can speed up your process quite dramatically with the help of a few tools. As has already been suggested, consider using a framework. Laravel is a great choice and pretty much comes with your whole login / auth / password / new user system out of the box. You can set up a Laravel app in a matter of minutes. Not too mention Routing / Model Relationships / Database Migrations / API access / Templating etc. Adding functionality is pretty rapid too, once you've got your head around it.

With regards to setting up hosting / webspace / database etc - you can speed this up by using some of the tools already out there. If you're hosting with something like AWS / Google etc, then you can spin up new instances of operating systems. hosting packages. databases in a matter of seconds.

Also, don't forget that developers are fundamentally lazy - so there are plenty of tools to help make you life easier / quicker. Make sure you've got a good IDE, setup correctly (VS Code is really great, free and plugable). Make use of pre-built packages (Composer for PHP / NPM for Javascript) - no need to re-invent the wheel. Getting your development environment setup well, will save you countless hours of development / debug time.

Something else to consider - planning. Before you even start to code, have a plan. It can be hand-written notes if that's your thing, or it could develop into a proper sprint log. It helps to identify any potential problems, keeps you focussed and on track, and allows you to take a more modular approach to your app - this alone will also save you hours.

Lots more things I could suggest to help, but the bottom line is that development takes time - secure, robust and scaleable development takes even longer.
Per all the above comments, developing rock solid code generally requires more than a few hours of work.

To speed up your process, consider building on WordPress so all your session management is done for you + is updated for you as PHP updates.

For example PHP-8.0 just released which makes considerable changes to session management + many other parts of PHP.

Building on WordPress means 1000s of developers design new code + fix old code to handle PHP changes.

If you hand roll your own PHP or use other PHP technologies with poor update management, then you'll also add to your development project maintenance time required to fix new version PHP code breakage which will occur each major PHP update + many times minor PHP updates.

I generally dislike WordPress.

And... WordPress... is still the lesser of evils when it comes to rapid development of session based sites.
You must also to think to reuse your existing logics to reduce spending the same logic developing again features like Login, My Account, Forgot Password, Dashboard, etc.,
I can really relate to this question. Just as factoring out functions and/or classes enables one to write a program faster and more maintainably, factoring out the standard tasks that you list (like login) would enable easy reuse of common features from one application to another.

One way to do this is to create your own general PHP program structure, with plugin pieces for login and other features. I have done this enough in the past 20 years to see that versioning can become a problem, so it is important to distinguish bug fixing from adding or removing subfeatures.

Another way is to see what frameworks already exist, by doing Web searches. Perhaps you can find a framework for applications that appeals to you. Even WordPress can be appropriate, if you don't mind virus attacks and if you are mostly interested in implementing a blog.

I got so frustrated over the details of creating multiple modern websites with HTML, PHP, CSS, and JavaScript that I decided to create my own solution. I am currently working on a macro expansion website builder that takes care of organizing "features", each of which is written in these languages using macros and include files, with simple interconnection interfaces. While I am finishing this project I am starting to create a library of macros for common features (like JSON-specified forms in general). I have chosen Bootstrap as my HTML/CSS technology, because it makes it easy to generate a modern website in an organized way, but the macro processor itself is general purpose. I'm surprised that no one else has done website construction before the way I am designing it. 10 lines of Bootstrap HTML can reduce to 3 macro calls with arguments, improving readability enormously.

Note: I'm just mentioning this project to show my response to a similar problem, not to offer a practical solution, because I don't expect to be able to release a product for quite a while.
Ditto to what has been said about using frameworks or the amount of time.  It can be frustrating when something looks like it should take an hour and ends up taking 3.  Every time I think I figured out the perfect formula of incorporating a front end admin theme to help speed things up, to my database tables that can be similar from project to project to which framework to use...by the time I am on the next project, I found another better way and so something changes.

My friends will say progress not perfection. I don't like to subscribe to that because I feel that it is too hard to change something at the end. Sometimes I will find that new thing and put some time aside to create tests to see if it is worth pursuing. If you have a deadline, it is not easy, but you have to subscribe to forcing progress. There are going to be multiple ways to get the same outcome and doing what you know may not be perfect, but if it works, that is what is important.

What you did to get things set up in a few hours is actually pretty good.  

From my own experience, I do suggest taking time out to learn Laravel, do it when you can make time. Take a project you already have completed and work on converting it to use the framework as a learning experience. For me, that is the best way to learn. https://laracasts.com/ are very helpful as is asking here. Just expect a little learning curve but I do feel it is worth it.

Consistency pays off too especially if you are a single developer. If I have to go back to something I worked on 5 or 10 years ago, It really helps to spot things quickly when you stick to certain methods that may be unique to you. I think many of us do this without thinking about it.



This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.