- 3The edge is quite thin. And it is impossible to explain this in most cases, it needs to be understood. - Alex Kapustin
- I agree, without presenting the essence, the truth cannot be understood! - Palmervan
- Are you sure that the site is simple, since such a question arises at all? - avp
- I just when applying for a job asked to make a guest book. It was necessary to make only the ability to add, delete and edit records. I made it all compact in almost one file. When they looked at my work, they said that there was no separation of logic and representation, and the PLO was not used. Now I have a question, is it necessary to use the separation of logic in elementary things? By the way about the PLO, it also became interesting. I thought that in such work there is no point in using OOP. - dima-opr
- It is necessary, first of all, TZ. Where will be the requirements for the functionality and requirements for the appearance, and the requirements for the architecture, and, if they are, the requirements for the code. During the interview, of course, you can do everything not in writing, but orally, but the task should be clearly more detailed “make us a guest”. Perhaps, during the interview it was worth asking the question “what do you want to get, and what do you want to see?” And the PLO and others - this is already a secondary question. The customer has any requirements or wishes regarding the architecture - then it matters. No - then everything is determined only by, uh, the opinion of the developer. - drdaeman
3 answers
@ dima-opr . I read your comment and understood what it was about.
You are right, but for your part. The employer wanted to understand (evaluate) something else.
I do not remember who (F. Brooks?), Wrote that the programs are divided into 3 types. Toothpick (write, use, throw away). Hammer (write, use for a long time, do not change). Skyscraper (write, use, change, use, change ...).
You wanted a small skyscraper (this is important for the life cycle of OOP and fashionable design patterns), and you give them a hammer (or a toothpick).
- oneWell, here the employer is not right. It was necessary to clearly set the task, using OOP or not. The task was given, he did, it works, what's the problem then? And if he used OOP or frameworks, then they would say, why they say in simple things you are pulling a whole framework? In a word, the employer is strange here, I think, if he wanted to pervert, one had to say. - butteff
- Probably, in general, you first need to look into the eyes of the employer, and then (if no disgust for him arose) to discuss what and with what purpose to write. - avp
The answer is more likely not to the question but to the last comment of the TSA - it is necessary to separate the logic anyway, today you have 20 lines of elementary when, tomorrow 50, the day after tomorrow 100500 lines bydlokod =)
As for the PLO, I, nevertheless, believe that the PLO, of course, helps to make it more human-readable and extensible, helps to organize the logic, but here the key word helps , helps, but does not organize. Thus, a competent programmer will write a good, extensible code and using the functional approach, a bad code will never write such a code, not with the use of OOP, or without.
I mean, this is not a panacea, although, of course, it can be very important (or tritely necessary) at the work of the OOP, because, for example, PHP frameworks are built with the use of the OOP, and, if we are talking about a large project or it's just about teamwork, the PLO is, after all, a friend and companion in sharing the responsibilities of programmers. In any case, I repeat once again - an assistant, but not a magic wand =)
- And we also need tests (TDD is our everything), profiling, scaling options, documentation (both developer and user), packaging for ease of deployment and so on and so forth, see any long list of best practices. Do you understand the train of thought? And, as a result, such an easy movement of thought, the task of creating a guest book on “show-and-throw” (half an hour with a break for tea) goes into the work of creating a spherical system in vacuum, which can be done for a very long time. Only, nevertheless, the question - “is it necessary?” - should be raised in advance, before it is accepted for work. - drdaeman
- @drdaeman - why such extremes? Oh yes, without TDD to write a guest in any way, have you woken up in a bad mood? : DDD - Zowie
Read towards MVC: MVC for beginners .
- Someone told me that MVC is used only for engines and large sites. Or for the most simple, it is also suitable? - dima-opr
- oneYes, it is quite. MVC is just a programming approach. That is, in the case of the separation of the model and controller, to try to ensure that all the sql queries were in one place, and the database access went through certain methods (functions) of the model. - chernomyrdin
- oneMVC can, and even should, be used in most projects. Small 3-page sites are no exception. Look towards microframes. - Drakmail
- one@Drakmail and why look in or on ... if you do not write your own for long? - Palmervan
- onePavleman: I agree, write your own (maybe not even micro) framework - in my opinion, the best way to understand how to properly work with other frameworks. True, this method takes more time than just using a ready-made framework, and is suitable if in the future it will be really interesting to do all this. Ps. And how can Nicki allocate in response? - Drakmail