Size matters

And the devil pulled me to write the material "Framework - more minuses than pluses." More precisely, to call the material that way. He was dusting himself, dusting himself in the sandbox, but last month he was removed from there and ... I did not expect so many comments.



It immediately became clear that it would not work out for everyone. I honestly tried to do it, but quickly realized that it was easier to write another material. What I’m doing now. So.



The answers



The answer to the first question.



No, I'm not trying to teach anyone. At least they don’t pay me for it. And I don’t intend to do such hard and often thankless work for free. So here I just express my opinion, with which everyone can either agree or not.



The answer to the second question.



Our projects. Not sure if such links can be posted here. Therefore, if interested, write to me in PM, throw them there.



And the third question is the most interesting.



Our tools. The answer to this question, as it seems to me, will give answers to all the others. Because here is more detailed.



As Dinver correctly said, 90% of microframes are suitable for the requirements that I tried to put forward tools for WEB development. Yes exactly! I am not against all the frameworks at all. And not against tools that facilitate development and reduce its time. Actually, I wrote about this in the first article, but for some reason only the headline caught my eye. And what's more, we ourselves use such a tool.



Where do the legs grow from



I will not delve into comparing existing microframes. This is a topic for a separate large material. I just want to say that it was not us who wrote something that existed in us to write our own, but that at the time when there was a need for them, and this was already more than 10 years ago, we could not find those standing. Now things have changed, but this is already like a dead poultice. Now, what we have, we believe is not nearly worse, but in many ways even better, analogues. Of course this is a matter of taste, but the fact that our tool is more convenient for us is our opinion to which we also have the right. But why he suits us, I will try to demonstrate.



Essence



Firstly, everything is based on the gem we wrote for Ruby. And it is written in pure C.

Yes exactly. When the number of completed projects was already quite substantial and it came to understand that 50% of the code simply wanders from project to project, we decided not just to systematize our achievements, but to make them better and faster. What works faster than C code? And, what could be more friendly to the programmer than the Ruby language, created by Matz to precisely facilitate our work?



As a result, now on the one hand, productivity has grown significantly. And on the other hand, the response time of any page of the projects we wrote fits into 300-500 mc at any load. In this case, of course, we must mention that we use our application server, also written in C.



For example, I give a screen shot of one of our projects. This is crn for printing houses, which allows you to manage both the process of receiving orders and the entire production cycle. On the screen is the page of the list of orders. The whole list is not visible, but believe me it is quite impressive. Moreover, for each record, not only the name and date are issued, but also brief statistics. Namely: the amount of payments, the list of products, the cost of materials for each, customer data. In a word, to form this page, you have to perform more than fifty requests. At the same time, the response time is 395 mc, and the gem-a size is less than a meter



image



Details



If you are not interested in all of the above, then you can no longer read. Next will be just a short description. Quite a short one. If someone is interested in it, I am ready to provide full documentation. This is hardly appropriate here.



So. The gem-e that I mentioned is about classes and functions that we use most often.

The main class is called Vdcgi. When it is initialized, it occurs:



  1. parsing HTML headers. All parameters passed no matter what method, as well as coocki, become available through the param array of the class instance. If files were delivered, then links to them can be obtained from the hash_img array. The files themselves are stored in / tmp until the script is finished and then deleted. When parsing parameters, the user access level and the level variable set in the configuration file are taken into account. If the access level is less than level, then strict rules are applied, under which potentially dangerous characters' <and so on are "knocked out of all transmitted requests. If level is greater, then in the future such symbols are simply escaped by the standard mysqlclient library function
  2. connection to the database. If the connection is successful, then all database queries can be performed through an instance of the class.
  3. User authorization occurs. If the authorized user “logged in”, then his access level and all user data are obtained.
  4. It turns out the name of the main template used to form pages
  5. Sets a global variable that defines the language of the page interface
  6. It turns out SEO information for the requested title, leywords and so on pages


The second most important class is VdMainapp. Here are some functions of this class.



  1. menu - forms an array to display the menu on the page
  2. writelink - creates a link
  3. get_class - returns an array of classes that should be initialized
  4. fotos - returns a link to a photo, etc.


To list all the functions and classes does not make sense here. I will mention only the main functionality



VdUser - work with user data

VdKassa - everything related to payments and finances.

VdVideo - for loading video by links

VdNet - Network Features

VdAdmin - Administration Functions

VdImg - captcha and photo

VDArcticle - all you need to add text materials to the site

VDMessages - everything for chats, tickets, etc.



All of the above is a very, very modest not even a description of what is. However, I think that even from him you understood that the matter is not limited to the gem.



Indeed, besides the gem itself, there is also:





And there is also an instal.rb script that deploys all this upon your request.



When you start the latter, you will need to specify the project directory and parameters for connecting to the database. After that, in the specified directory you get all the necessary files, and on your local machine a configured nginx server and actually a working site with a minimal set of pages and an admin panel. The last one can be reached with the admin admin username / password. Inside you can add the rest of the pages, determine their nesting and specify information for each seo. Well, then - complete free creativity.



A few spoons of tar.



Once again I want to emphasize. Contrary to the opinion of some who commented on the first article, I am not trying to teach anyone. I’m not even trying to impose anything, but even offer to work with our tool. Although it is publicly available on our website, it has always been considered only for “domestic consumption”. The scheme was simple - if some functionality was present in more than 3 projects, we rewrite it in C and add it to gem. At the same time, no one is trying to bring a special "beauty". As a result, if we consider it as something that I could offer everyone, then we must admit that the project is quite crude. There are a lot of things missing. For example, there is no support for PostgreSQL (which, by the way, is already written) and a number of useful “goodies”. Therefore, if someone has a desire to get to know each other better, we ask for mercy, but only, as they say, “under your responsibility”.



All Articles