T
T
totudub2015-12-10 15:19:27
Yii
totudub, 2015-12-10 15:19:27

Speed ​​or best practices?

I recently started programming. Having studied the basics of php, I took up the yii2 framework, while simultaneously reading better programming practices.
Faced such a problem that if you follow all the best practices (SOLID, TDD, DDD, etc.), then the application will be developed much more slowly, and less productive than if you do everything in a simple way.
Actually the question is: How to be a beginner? Follow the best practices in the hope that someone will appreciate the long and hard work, or do it quickly but with shitty code?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Anton, 2015-12-10
@SPAHI4

If the application is small, then the govnocode is justified. If the application grows, then the shit code will eventually be slower and certainly more difficult to maintain and scale.

A
Andrey Pavlenko, 2015-12-10
@Akdmeh

Find a balance between this. Sometimes you can make code that is not very portable and then refactor it, rather than making a site for 10 servers, replication and the like for six months, but in the end it will never be launched.
Yii2 already has a lot of ideas for good architecture. Adhere to the rule of class inheritance, do not put logic in the View, but View in the model. Make a clearer distinction between Controller and Model, and then everything will be fine for a start. And with experience, you can already improve the quality of the code.

O
Oleg Tsilyurik, 2015-12-10
@Olej

Follow the best practices in the hope that someone will appreciate the long and hard work, or do it quickly but with shitty code?

Code should be written well, in all cases... small application, big project...
And not in the hope that "someone will appreciate" - don't give a damn.
Well (disciplined) written code always contains fewer hidden bugs. You will then grumble about them ...
But, on the other hand, always keep in mind that 90% of what you are sold as "best practices" is "noodles on your ears", all these Spolskys, McConnels and your immediate superiors and tutors ;-) ... For the most part, these people watch their own interest and their own gesheft.
Make up your own set of rules and follow them.

G
Grigory Vasilkov, 2016-01-29
@gzhegow

And I did understand what he meant. The problem is much more global. Any rules are created by those who have a gesheft from this. And not all of them serve the idea of ​​universal grace. For example, the first rule "do not kill" from the book of life - it is, as it were, beneficial to the state, for example, fewer resources should be invested in law enforcement agencies. on the other hand - if you fill up someone - you can replenish your wallet - so it's not profitable for you. in general, for the survival of the species - it may be necessary, on the other hand - the tigers there are different to each other from time immemorial and have not died out.
Well, that is, the problem of "rules" is much deeper than the "correct code". Another question is that it is easier to change the correct code later, you will spend less time. but eat first.
from the point of view of business and money - it is more profitable to write govnokod. then you can take money for its refactoring. from the point of view - to help your customer - it is beneficial to write the correct code in order to solve the problem as quickly as possible and, again, get a bonus of trust from the customer - quickly, they say.
in short, just forget it - you write according to your mood and that's it. if you don’t want to convince and blush later, for making a shithole, write beautifully. but when you write beautifully, you can be fired and hire another without loss. when only you understand - it's not so easy to hire another, you have knowledge.
Companies are usually looking for those who write beautifully. And your task is to write on the edge - so as not to be scolded (they will scold anyway, they have such a task), but not to be fired without problems, well, that is, in fact, to play a parasite.
Which again is more global than just at work. So it is in life - who does what whom, that one and so on. It’s just that at one fine moment you want a safe nick, but it won’t be there. And then, in order not to hurt so much, we will call it karma and leave to read philosophy.

S
Slava Vitrenko, 2016-06-18
@bagiroff777

As long as your developments are non-commercial, write as best you can, so that later it will be easier to bring (often not even your own) code to mind.
With commercial development, it will turn out as always - after the requirements are formed, a working prototype is made (go..nocode, that is), and then it is finished up to the deadline itself, i.e. until they take it away. It is this period that is a chance to bring the code to mind.
P.S.
I am also writing in Yii2 now, I try to write in the style of this framework and, you know, it turns out nicer)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question