📜 ⬆️ ⬇️

About frameworks

Roman Ivliev


In today's article we will talk about the integral component of a large number of modern web projects - about frameworks.


Roman Ivliev on the example of the set of projects of the portal banki.ru, as well as customized development in the studio of large projects Ontiko. Consider the following topics and look for answers to questions:


  1. What is a framework, and why they are written.
  2. Why dozens for some languages, and for some - units.
  3. What are the pros and cons of the application.
  4. The most common myths.
  5. Use or not - examples from life.
  6. How to choose from a variety of available options that you should pay attention to.

About frameworks


Roman Ivliev (Banks.ru)




I have been tinkering with IT for a long time and have gone from an engineer to a director in over 10 years.




What did I want to talk about with you today?




Why, in fact, write these wonderful frameworks? Why are there such a rabid number (who does this, he probably knows that they are in almost any language)? What are the pros and cons of their use? About the most common myths and about what you can and should pay attention to when choosing them.


I will warn you - the recipe will not be, because it is a topic for eternal holivar - which programming language is better. First, we fight, we choose a programming language, then we fight, we choose a framework in which we program.


Important Disclaimer:




Before you try something that I’m going to tell you about now, it’s better to try first with your neighbor, because, naturally, it’s better to let him have something after that than you.




However, why write frameworks? Why dozens, and for some languages, even many dozens.




Here is a picture. Who recognized yourself? Someone else uses something homemade - there are offices that have done something cool themselves. And I confess - in each of the offices in which I worked, there was a framework. Moreover, in Banki.ru we have a framework, which is built on the basis of Beatrix. Therefore, I can talk about pain for a long time. We have a Bitrix sample of 2008, which perfectly fulfills its tasks, there is very little left of Bitrix in it, except for names, classes and a heap of bulshit, which they crammed over the years. But nonetheless.


Probably everyone has heard about frameworks, that this is such a framework that will somehow restrict your application, does some structure, i.e. solves some problems. Why do they write at all, what is Tsimus?




By and large, there is a programming language, take it and write - go ahead and with a song.


This is probably the top 4, why they are written:




In fact, there are more reasons. First of all, people try to facilitate their development, i.e. to improve, because with time you begin to accumulate some of your own developments there, and when you have a large number of functions, it makes sense to combine them into libraries. Then it turns out that the libraries can be merged into even thicker libraries, impose on them some additional stuff-dryuki, mulch-mulechki, so that all this was cool.




There are a couple of moments why they do it. For example, because "that which is, it is bad." This is in my practice such a decisive argument. You say: “Why did you take the framework A, not B?” - “B is bad.” "Why because". We'll talk about this later too.


There is one more thing - and who didn't start writing yours? In my memory, every developer ... Is there anyone else who did not start writing his own framework? There is. This is not really embarrassing, and I have great respect for those people, because if you already know how to program, then writing your own framework is simply a waste of time. Because take the one that someone has already written for you, complete it, and it will be much faster, more efficient, and you will solve the same tasks.


I do not know, maybe this is due a little to the difference in generations. But at a time when I was just beginning to engage in all this disgrace, write my CMS and my framework - it was considered, in general, a matter of honor. Those. if you do not have your own CMS, you are a sucker. If you do not have your own framework, after you wrote your CMS, you are generally a sucker in the square. Moreover, some time later, people who grew up with me from that generation are now doing about the same thing - they still write their frameworks. Because the stranger is bad, because the one that is, he is bad.




Advantages and disadvantages. It would seem making a wagon. Let's search.


Firstly, not all solutions are useful, because it is proven - the amount of usefulness on the Internet compared to the amount of useless, you know what - about one in a million, i.e. On one useful piece there is a million some kind of garbage. Maybe not a million, but nonetheless.


Let's see what advantages, based on what they are written for.




Naturally, typical problems have already been solved there. You do not need to think about how to write something to the file, you need to click, call the method, write the method to the file, send the http request itself, send the method itself, configure the database itself, use the method will do, in general, a bunch of everything else else. And the same thing that you, in principle, could sit down and program yourself, other people have already programmed for you. Good? Why not, good.


You can speed up development on this background. Because you do not program your own, for example, 10 methods, you take ready-made ones. If there is documentation, respectively. Let's talk about the documentation too.


There are chances that you can do something the same. If you have, for example, a company with 10 projects, then there is a non-zero probability that by solving the problem in one project, using the framework that asked you the same skeleton, you can then calmly (relatively calmly) drag these developments into a neighboring project. At the same time you save time, effort, but do not save nerves. Why? Not because it is bad, but because people are actually different, and the framework is a tool. If we consider the hammer as an alternative, then someone with a hammer can hammer in nails, someone with a hammer can beat fingers - it would seem the same tool, but the effect is just the opposite. This thing is the same. A person, an experienced person, who knows how to use it, calmly solves the problem. Most often, without thinking about the fact that all other people who will use it later, may differ slightly in qualifications, in relation to life, religion, and for all other reasons.


And, in principle, you can quickly find people, because instead of looking for when you have a large number of tasks solved by third-party solutions, you can find a specialist in this decision, and your life will be faster. The person will enter the project faster.




The implication is probably that the people who put the frameworks (not anyhow, but the ones that were in the picture at the beginning of the presentation) are professionals. In the picture were collected some of the most popular frameworks for PHP, Python, Java and JavaScript. Things that are developed almost industrially imply that they are developed by professionals, therefore, when you take this decision in your hands, you can be sure in general that with a probability of almost 100% of what is written there, it works.




Minuses. What is a framework? This is a pile of someone else's code, which is sometimes documented, sometimes not very documented, sometimes documented is not entirely correct. And most importantly, it is not always clear how this works. Those. if you take a big fat framework, it’s quite difficult to figure out how something really happens in it. Therefore, in a situation where you stand against the brakes (as they like to say “something is slowing down”), in order to understand what is hindering inside this box, you need to put some effort. Even if you understand what is wrong in this box, rewriting this box is also an effort. Because each framework imposes on the developer a certain programming style. You can take a very cool framework, and program on it so foolishly that the results of your work will destroy everything that was laid by these wonderful professional people, all their ideas.


Another minus - you need to relearn. Even if you take frameworks within the same programming language, they are in fact very different from each other. If you take some symfony on PHP, how they are arranged inside, how to use them - these are completely different dialogues. When, for example, in a job ad they write that “we need a programmer on such and such a framework” - this is specially written. Because if you write on another framework, then you already have a deformed consciousness, most likely. In humans, in principle, consciousness is deformed when they work with the same for a long time. If you, for example, have programmed in Assembler for a long time and know how to turn the calculus from the threefold into the 25th head in your head, then it is unlikely that you can do something simple after that. You are already doomed to do the difficult. The same with the framework - there are very simple, very light frame solutions that are programmed like that, once or twice, but there are really things that even specialists are very hard to get to work normally.




Thus, you get on a hook related to all previous minuses. Those. if you are developing a huge amount of something in your company using one of the frameworks, then you practically have no chance to switch to another. Either you have a very good business, or you are a startup who is willing to sacrifice at night, the 25th hour, etc. Because everything is different. In many languages, even in the same Java, there is a different ideology - there are different ways of processing data, it all fits differently. In the end, you become a hostage. In fact, the same as with the language - if you started writing in PHP, then you will continue to write in PHP. Or you have a service-oriented architecture, and the essence is the same - you can take in chunks and rewrite. Please, she will save you. All the rest will not save.




There are myths. Associated with the fact that in the first place, it is human nature to believe in the good and eternal. Few will begin to argue that “All is ashes, PHP is ashes, Perl is ashes, Go is ashes, all ashes. Common Lisp is our everything! We will write our language on Common Lisp, we will write our own framework in our language, and we will be able to cut it funfully and defiantly, but everything will be like “I want”, and everyone else will just admire. ” However, there are frequent myths and this is from life, in fact. These are the things that really had to deal with foreheads. Those. it would seem that professionals are developing ...




Myth 1 - security. Even despite the fact that the frameworks are developed by professionals, despite the fact that some of them are used by millions of people, however, this is open source. Security is a scourge of open software, because you officially announce security patches, otherwise how will the people find out about them? You take and write on the site: "Here, we have found a hole here ... Please, who did not have time to defend himself, who did not have time to upgrade, he got". A third-party developer is a wagon, you can grab someone else's solution, from some bad GitHub, which has bad code (surely there is such somewhere). In principle, because of this abundance, you can safely get into a situation where you, with your own hands, quite purposefully, cram someone's exploit into your own code ... Security is an important thing. Many of you are testing the security of your applications?




Here, in fact, you and the answer, why is it a joint. Because, it would seem, the solution is ready, the solution is cool, the solution works, everything is great, I will program it. Then, b-bang, and your data leaked somewhere, for some reason, your online store started selling at 1 ruble, or you recently published databases with phone numbers, such as "we found their numbers in social networks." Yeah, found in social networks. Found in the social network admin, who bought a beer, which updated some software for sure.




Cool myth about engineers. Everyone thinks that if everything is standardized in our country (they still write a standard, regulation), then we can easily replace the engineer. The same is cool - a full market for Haskell engineers, for example. Fully engineers. Open HeadHunter - just a crowd of engineers at Haskell dream to work in your company. It works great provided you are just getting started. I have 35 engineers, and we have standards for development, we also have a popular framework, and the project I have long been started, he is 11 years old, and I want to say that the time of entry of a person into a team without a mentor, a senior, who just sits and says what to do, well, a month. With a mentor - 2 weeks. And plus you are still looking for devils how much, because I have what is commonly called a zoo. We write in PHP, I have Bitrix, Symfony, two versions of each of what I called before, and I also have the same list at the front - seven pieces, I don’t even remember everything now. However, even if this all works well, you will quickly find an engineer in FIG. Because each tool can be used as you want - Engineer A, who programs on some Java framework on Spring, writes like this, Engineer B writes like this. And when these two guys meet, the first thing that the second guy starts saying is: “No, well, you can't do that, come on, I'll rewrite everything right now,” he kicked out the third guy who, in general, just came, he is young . He looks, looks at these two people, and says: "Damn, did it still work?".




From this conclusion: without dexterity - the shepherd, and with him, in principle, by and large nothing can be done.




Everyone talks about the speed of development: “Now we will quickly take the framework, the framework is cool, the framework works fast, we will quickly fasten, wrap, and we all will quickly go.” In fact, all this works well, provided that you need a typical solution. If you need a non-standard solution, figs you will find a suitable framework. For example, if you need to stupidly send files and do something there, this is good, and if you have a device in your way that stops responding adequately to http, and you need to write down not one place, but 121 places, you still have to write everything yourself. And then you get into a famous story, when you have something that works, you say that it works badly, because the previous framework is bad, gradually, based on this framework, you start to build your own.




In fact, I exaggerate a little everywhere, naturally, because everything is not so bad, the frameworks are used and written, but there is definitely pain. And in fact, all this is cool when you have specialists. A group of people gathered in one place, working on the same task, who took the tool, but do not know how to use it, will still not be able to do anything quickly. Even if they all write very cool in PHP, for example, or on Phyton, or Java, or in any wonderful language. If they are not very versed in this framework, they will not succeed quickly. Moreover, it is possible to understand what you develop well on the instrument that you use only after some time. Or if you already have an expert on these issues, I went to visit him. Therefore, there is a community (we will talk about them a little further), and it really saves.




There is also a myth that many customers require a specific framework, they firmly believe that what is written with the framework will be standardized, it will all work cool, quickly, it will easily find people, everything is cool there. Moreover, for specific frameworks right teams are assembled. Oleg Bunin, who organizes these conferences, has a studio for the development of high-loaded projects, and a long time ago he had a Perl framework. Have any of you programmed in Perl? I programmed in Perl myself. And they also had their own framework, which was programmed in Perl. So, then to support this piece, which he gave to people, those people were forced to look for Perl developers, because Perl is known to be the language for writing, but not for reading. Those. it is quite difficult for a person to read what another Perl developer wrote. In Kaspersky, there was a whole healthy activation system written on it, I worked there for four years, but I did not learn to read the previous author until the end, and in some cases I went to him and said: “What is this?”.


There is still fashion. Fashion is a scary thing that concerns not only frameworks, but also IT as a whole. A man comes to a familiar IT'shniku ​​and says: "Do you hear what is there on the market now, in general, cool?" - "The market is cool - this is it." He says: “Oh! I want this. ” A curtain. Tears, crying, sadness, etc.




By and large, the dude needs it all to work, he doesn't need anything else. He needs it to be a simple solution.


There are also a bunch of unrelated things that I highlighted:




The framework is naturally bad because it cannot out of the box. Well, because you can hardly find a combine. Has anyone read a chic article on Habré about a factory of factories for the manufacture of universal hammers? Here is about the same. Naturally, humanity wants to do something universal, then it understands that nobody needs something universal. It starts making a mechanism for building something universal, then a mechanism for building a building, etc. It's a vicious circle.


If another framework already knows how, then this is also bad. Therefore, for example, everything that is born now, in such more or less serious languages
programming, practically, never survives, because “everything has already been done before us, why use it, you need to get used to it,” etc.


Naturally, something does not work. That's it that “so” cannot be done. This is an eternal holivar, when they say: “And here you need an active directory, but it’s not like this through activ, but through direct SQL queries, everything’s so cool, memory is saved, everything’s great ...”. Yes, all this garbage. Everybody does the same thing. Plus or minus. There are specialized solutions, there are vendor solutions that are tailored for some specific solutions.


And the last point, this is really pain.




I tell you as a manager. This is the biggest problem when you have a strong engineer who has been sitting for a long time, he already knows how to program very strongly on this all and ultimately: “Everything you offer me is all garbage”. And to explain to him why, for example, his framework, not his framework, etc. - this is quite difficult, because there are a lot of real selection criteria, now we’ll go over them.




How to choose it all? There are no specific recipes, because, naturally, there are a lot of tasks. However, it makes sense to pay attention.




This is, first of all, on the community, and what do you have, in general, the strength. The community is all open source. I’m not talking about proprietary solutions, which also exist. There are commercial frameworks, they cost gozillion of money, their support costs gozilion of money, you will find engineers for them. But, nevertheless, they are in fact. As well as commercial CMS. I do not take into account Bitrix 24, I’m fatter about something - some Dutch ... There is a part that Kaspersky implemented for a while, just a million worth of money. C #, which in itself is one big fat framework. .Net and all that. However, how popular is this solution in the market? If you don’t find anything in Google by the name you chose for yourself, it’s certainly a great, decisive step, but it’s most likely that it won’t work for you because you cannot find documentation on it, you cannot find people . In general, this will be a big problem.


How long on the market is an important thing. Did you hear what is HYIP? About aggressive advertising. Those. if Google suddenly comes up with some kind of solution in the first lines that has not yet been let out in the market for a year, in which the site is made in the form of these selling sites, which you scroll-scroll-scroll - download. These are long. Most likely, this is also some kind of garbage. Either this is one of the Javascript dudes who was blinded by some kind of new super-duper fashionable framework that solves all the problems of the previous super-duper fashionable frameworks that he wrote in the previous office when he worked. Either this is some kind of garbage.


Your experience is very important. If you have not programmed anything complicated before, then if you take on this drin, which you can dig and nail, and that’s all, then most likely you are doomed to failure.


And time. How much are you ready to dig out all this. Because, I will not speak for other languages, but in PHP, for example, there is a clear gradation of frameworks (plus or minus) in the speed of human input into the essence of the process. And there is such a Makarov, Sasha, one of the developers of Yii, who claims that Yii has a direct input almost times faster, for example, than to log in to Symfony. This thing is also important, because you need to cut in, or you need to now take and run-dig.
There is a really cool thing about “running and digging,” for example, if you need an online store very, very quickly, quickly, then you can buy it very, very quickly, quickly. And do not, in general, write it. And in the time while you unwind it, you will write your own. However, if you do not have time to study, why bother to do this, why?




Development process. How many years, in general, is it planned to support this thing? In each framework, in general, in any open source software is as in the DNS time to live, as they say, i.e. the time that this thing is potentially ready to support. Someone announces it, someone does not announce, someone shows, someone does not show. Somewhere there is a clear, as in adults, time line, when "on December 30, 2016, we release this, then this and this." This is a sign that the product is of high quality. If the guys just sawing and do not say anything, then, most likely, this product is not very high quality. But if we take the top 5-10, they are all plus or minus equally announced, another question is that no one follows these deadlines.


Automation, documentation, style libraries, i.e. for example, support for Bootstrap out of the box is screwed somewhere, somewhere, support for Bootstrap out of the box is not screwed out. If you need to do something quickly and “on the knee”, then, of course, it will be more fun to take what you have with the support of Bootstrap, because it already has one, it will not be necessary to relax.


Any other integrations. There are frameworks that have already written a lot of libraries, libraries of ready-made components.




By and large, they are in bulk, and there are even entire repositories of these piles, where you can see, there are even ratings - you can count asterisks in GitHub. This is something that must be considered in the selection process. If you can, for example, take a framework, take some three of its additions, fasten a simple little face and solve all your problems at once - this is what the doctor prescribed (from my point of view). If you are forced to search at night, google so that Google already simply bans you, says that you are a bot, and shows you the captcha for the word "framework", for example, then most likely something is not right.




Testing is also a very important point. Not all frameworks are equally subject to the same unit testing. There are frameworks that support it easily and wonderfully, there are those with which you will ape and it is easier, in general, to write everything separately. There are with all sorts of units - JUnit, PHPUnit, etc. - all this is already tied. You don't have to do anything. This is all already there. Testing the code you wrote is difficult, i.e. if you, for example, in order to test some code, you need to apply more force than to write it, why do you need such nonsense? What will you do with it? If you are, of course, not some kind of mail.ru, for example, a company in which there is a hefty testing department that can afford to test a lot. Most likely, in your testing department only you. Even though you are not a testing engineer. Now with all the pseudo-crises, etc. Still, people are saving for testing as much as they can.




Performance and debugging. All these questions, before you choose something, you should look. There are benchmarks in almost all languages, in all frameworks, which show that, for example, the Python pyramid works much faster than the pyramid Pyramid. If this is important to you, then please see, choose.


Is there backward compatibility? For example, what was done with the same Yii in PHP. 1 2. , , 1 2, 2, . , , - Symfony , , , .


, , , . Python — «» «» - . , API . , , xml, json. Those. , xml, — json.


How to deal with it? — , , , . .


, , , . , , .
, . , , , , , . . . , , - , , , json , , .


— - ? - , - - world of tanks, - , - .. , , ?


, : «, , , ?». , , .


, , «» , - , Yii 1-, Yii 2-, , Yii Symfony. , , , Symfony ( PHP-), , , . . , — . . out source , «», «», , «» , «». , . .




, , . Those. — . , . , , .




, . , . , , , , , - «react», , , - — - .




, .


. , -, , , .., , , .




— , , . n, n .
, n 20, . , 20 , , , , , .


. - , - , , , . ?

, . , , «» . , Windows XP. , , , .. , Internet Explorer 8. IE 8 2. , - , . XP, , NT -. , , - , . — . Those. XP, , - . , .




. :




, , .


, . , — -- , .


, Symfony. , Symfony. , , . , , , , , 15. , . , , — , , , . , .


, , — , , . - AB Apache — , , , , , .


— . , , profit , . , , , 24 - .


, . , , , . , . , , — , , , .


profit — , , .. .


— , — - . , , , , , , , . Probably. , , , . , , …


. — , , 500 , — , , . … — , , . , — , . Those. , , . PHP 7. , Badoo , . , , . 5.3 5.6 , .. 30% . , 60% .







, . ? ? , ?


6 . -, , , .


')

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


All Articles