You have been told to make a web application which stores records about persons, contacts, meetings etc. and you are absolutely clueless. And yes, it should be a web application with some database and you should use some framework and templating engine, OMG!
OK, you are not entirely clueless, you probably have seen a lot of web applications already:
Great, you have some preliminary knowledge about web applications, because you live in 21st century and you are reading an online book.
I expect you to have some small prior programming experience especially with console applications. You should know that you have to acquire some inputs and process them to make it all work. That database is probably there to store some data and can be used to retrieve them. I also presume that you know something about object oriented programming.
That is all you know and you have four months to submit the assignment. The equation of your situation can look like this:
Some basic knowledge Basic A lot of things Working
about internet + programming + you do not know = web
and web browser skills yet... application
You might have encountered PHP at your high school or a friend might have taught you few commands. That is good, you know what the PHP is good for. But please, try to be open-minded and do not stick to what you know. The quality of your knowledge might be poor. Many people know, that they can work with PHP like this:
echo '<body><h1>I think that I am a PHP expert!</h1></body>';
That is not a way to build more complex application and definitely not a way to build web applications nowadays.
You know that you need to study, because you yet do not know the stuff that you need, here are some entry points:
Each entry point is a topic, each topic has related topics and sooner or later, you will find a way which connects the entry points together via related topics. The important thing is to not lose your way, to keep your direction. This is why you read this book, it is a guide which helps you to build a web application – use the walkthrough.
I prepared a small map for you, it might help you to see the main interconnecting topics:
Always start by learning and understanding the technology and by making a prototype or proof of concept. Try to solve isolated problems and make a “library of examples”. You can obviously skip this step once you know your tools of trade. Once you can solve isolated problems, you should be able to decompose the assignment to partial problems and map it on your library of examples.
That paragraph you just read is super-important. Nobody ever wrote a full working application from scratch without playing with and learning needed technologies. Isolated problem can be e.g. “defining a route in a framework and responding to it with a simple template”, “passing data into templating engine and displaying a static text in visitor’s browser”, “storing a record into a database” and “submitting a form and retrieving data using POST method”. Those last two examples can be later joined into more complicated example of “storing submitted form data into a database”.
Plan some “custom” deadlines and try to keep them. By gaining experience, you will be more and more accurate in time estimates. When you miss the deadline, you know, that you have a problem (the best way is to plan work on day-to-day basis).
Take a look at following image, the bad scenario is a case of many students who do not self-study and do not test and practice what they are taught during lessons. Once you start programming without any idea of what you are doing and what tools you are using or how to use them, you will fail to deliver the assignment because you will get stuck many times and you won’t have time to fine-tune the result.
A more concrete description of how to start working on the project is in FAQ section.
Do not write code for everything. There are existing tools and practices that are used in each discipline (you would not start to build a house by planting a tree). I understand, that it can be overwhelming for beginners to learn about simple framework and templating engine, but these are tools that are used regularly and you can have them for free.
A lot of people only learn the basics and start programming (including myself). They ignore the ecosystem (e.g. Componser) and tools used in given field. After some time, they spot the patterns and recurring tasks and they start to build “frameworks”. The problem is, that usually others have already made better frameworks and they already have thousands of users. There are good reasons to use work of others and to learn how to use existing tools:
Most people need to use some kind of tools for their work. Better tools means higher productivity. Selecting a programming language is crucial. I choose PHP for you, but if you are skilled in another modern programming language suitable for web development, you can use it. Once you start developing in given programming language, you cannot change it!
The choice of programming language is linked with the choice of editor or IDE. There are free IDEs like NetBeans or Eclipse and there are paid ones like PHPStorm – it is free for students. You can use just about anything from Notepad to PHPStorm, but a good IDE boosts productivity.
Development tools are something, that you directly use almost everyday to produce the result.
You will need means to run the application. Each computer has internet browser installed nowadays. But PHP applications are not executed by “double-clicking the desktop icon”. They have to be stored inside configured web server, which uses PHP interpreter to execute PHP files. It is quite difficult to install everything on your own computer. The web server should also be public, so the web application is available for everybody. Therefore the university provided you with execution environment on university’s servers.
Database is a bit special here, it is not needed for every web application and you can definitely store application’s data somewhere else (e.g. filesystem), but it is convenient and safe to use it.
If you continue to study web application development, you will gather knowledge to install your own web-server. Read more in technical support section of this book.
See all the tools in their place playing their role. This is difficult and you will have to reshape the model of things in your head a few times. One example: many students believe, that database is installed inside Apache web server, that is not true. The database is standalone service used by PHP scripts via PHP extension.
You will have to draw a few models and diagrams to understand the whole thing. Go ahead and do it! Each application has different levels of functionality. There is the high level view and then there are particular use-cases and processes.
You should train yourself to see the flow of data through variables between modules and levels of your application. The variables in your source code are like pipes. They are under the ground most of the time, but they surface from time to time to make their value available or to change it. Variables are the connecting pieces, without them, your code would not be able to pass information around and it would be impossible to work with user provided data.
You can use UML diagrams described in FAQ section to make an overview of functions needed in your application.
Read this book, follow the walkthrough but also have always opened the PHP documentation on php.net site to consult new functions or search for specifications of those you are not so sure about. You should obviously search for help when you get stuck.
I think that there are two kinds of “getting stuck” that you might encounter during completing this course’s assignment:
And this is what you should do when you get stuck:
Take a look in the FAQ section of this book for useful tips.
Many things can be trained, you will gain experience and you will learn how to use PHP, some IDE, framework, templating engine etc. The more you use the same tools each day, the better you know them. A good idea is to adopt conventions for everything – do not invent your own, there are naming standards recommendations, coding style standards recommendations and many more.
The goal is to share most common ideas with other developers in your organisation to be able to produce consistent code (newcomer should not be able to recognize author of the code) and to be replaceable (you will eventually want to start doing something new and pass your code to somebody else).
I tried to describe the process of solving (or starting to solve) the problem of creating web application in this article. I think that there are two key points that lead to success:
I know that it is hard to start doing something new and that it is depressing to try again and again until the thing finally gets working (or fail and start from different end). Everybody who achieved something went through similar process. This course is about building a working application, it should teach you how to use database and other application software to deliver usable result. Web technologies are just a tool, but you know that web applications are popular and it can be useful to know how to create one. If you do not like building any applications, try to use this assignment as an exercise in problem solving. Because that is what you will do for most of your professional life.