⬆️ ⬇️

Restoring order: how to organize work during the creation of the site. (Part 1)

A bit off topic



Having secured the consent of ilusha_sergeevich, we plan to post translations of some articles on Habré, links to which he cites in the publications “ Something interesting and useful for a web developer ” in the section “Western thoughts or what it would be worth translating to Habré”. At the very start of this initiative, we want to ask the community about the degree of its expediency (poll at the end of the article).



Actually, the text itself

')

Unfortunately, we used the word "organize" in the title. “Put out the light” is probably what many people thought. Organization is a bit boring, but extremely important. It may be worth considering this concept in context.



Let's imagine that we are making a website for the trendy art cafe "Beat". It is an atmospheric place with paintings of the 20s on the walls, live jazz and a rich patron, but they still do not have their own website. They hire you to fix the situation. As a talented designer, you are sure that you can create a fantastic website, but they have a lot of ideas about functionality and you are not quite sure how to organize all the files necessary for your website.



They want to be able to independently edit the content, upload photos, post weekly blog posts and upload new content. They also ask to connect to Twitter, so that their messages are automatically broadcast to the network. They need an application for the iPhone and Android, because their customers use smartphones, and they want to give them the ability to view the blog and menu directly from the phone. In addition, they need customer reviews with the ability to add images, links, etc.



“Facebook for restaurants” they tell you. Perhaps at this stage, you send them to hell, but you get the idea. Perhaps in the past you tried to create a more complex site and set to work with laudable enthusiasm, but in the end there was a nightmarish mess that is simply impossible to cope with. Your client has ceased to show interest, adding new features has become extremely problematic, you started working at night to find errors, but you could not even find the file you need. After such a project, it is not difficult to understand the relevance of a well-organized file creation process.



General principles



Everything should be simple and clear. Do not overdo it. Some sites and databases look as if their creators enjoy the attempt to create the perfect order. From a practical point of view, as a rule, it is impossible to work with such structures.



If you start creating dozens (or hundreds) of tiny files, each of which contains nothing more than a small class or function, you have overdone it. If your files and folders have too abstract or incomprehensible names, confusion arises. If the verification code of the site administrator login is stored in a file called auth.php with the location WebsiteData / Items / GenericUser / AdminUser / Code / then you made both errors. Why not just the check_login () function in the Code / users.php file?



Do not mix various aspects of your site. Separate the functional elements and different languages. I recently dealt with a project in which a developer used CSS, ASP VB Script, JavaScript, HTML, SQL, and all this in a terrible mess in one poorly structured file. I do not invent.



One size does not fit all



The depth of the folder hierarchy and the number of individual files should make sense for the size of the project. Consider it.

Here is a brief list of some typical site sizes and possible structure:



1 page



Create a folder for images, CSS, JavaScript files, for content and for code. Definitely not worth creating templates for content if you do not have specific requirements for this.



5 pages



Folder for images, one file for CSS, JS, code. Consider creating multiple files with content in a separate folder. Again, do not bother with the templates, enough blanks for the most frequently used elements of the site.



20 pages



A folder for images, another folder for downloads and other files related to the project (“Assets”), a folder for content (you may need to think about using CMS). Your JavaScript, CSS, and other code are likely to have grown to get a separate folder. Call them obviously: css /, javascript /, code /.



Make sure all files are in the appropriate folders. You should not have an extraneous .js file, say in the Content folder, simply because it’s convenient. If your templates or code do not allow you to organize your files as you need, then refactor the code to make it work.



Avoid placing CSS, templates, HTML, working images or JavaScript in “assets” / (“different”, “resources” or how else you call it). These files are part of the code that your client should not think about, and “assets” is the folder for the files associated with the project. Make it your rule and follow it unconditionally.



20 pages + web application



Almost the same as above. At this point, all of your code should be in a separate folder. Make sure that this is not a folder to which Apache may accidentally open access when some script-kiddie attempts to attack your computer.



100 pages



You must use a good CMS for your content. It does not matter whether it is a database-based system or a file-based CMS. When choosing the second option, you should make sure that the content files are fairly well organized, and that you can specify metadata for individual headers, descriptions, etc. Otherwise, you have to spend a lot of time and effort on SEO.



Most likely, your site already contains a number of different sections. You should think about how to place CSS, JS, images and templates in separate folders, the structure of which coincides with the structure of the site. Using Sass or LESS is also a good idea at this stage.



2,500+ pages



You should definitely think about hiring people, such as a content editor, designer, programmer and SEO expert. You should also manage content using a database-based CMS, if you have not already done so. You will become a manager, and will deal with work done by other people. Make sure you are able to check and edit the material before it goes into production.



100,000,000+ pages



You are Microsoft and you need to know what you are doing.



Most small sites grow very quickly to 20+ pages. Just add a FAQ, a few articles and a couple of products. Therefore, it makes sense to structure even small projects as if they were a site with 20 pages, if you are not sure that this is a one-time site. Plan for smooth growth with a gradual increase in pages.

Source: https://habr.com/ru/post/243607/



All Articles