W
W
warcevil2017-03-08 07:34:10
Programming
warcevil, 2017-03-08 07:34:10

How to determine the responsibility of functions?

The simplest - let's say there is an elevator that can go down, up and stop. Is it his job to make sure he doesn't descend into hell or fly off into space? Or should the controller who has access to it do it? Or does it depend on how flexible the lift needs to be?

Also with the usual functions, sometimes it's a bit of a hitch. I don't understand where their duties end. Specifically, it is not clear whether the helper function can change something if it is not given something? Or in a good way, it should only give the finished result?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-03-08
@warcevil

From my own experience I can say:
All this is useless trash, all these descriptions are right, right, how gurus do it, how NASA does it, solids, gangs of four, ten, three hundred Spartans, etc. But, exactly until that time, until you get there on your own . And this can only be achieved with experience . When you write something relatively small, all these things can be omitted. And when you come to a huge project, everything goes by itself, because otherwise you simply cannot interact with it, or if the system is already well enough designed, you have to write correctly, because it either won’t work out otherwise, or they will give you on the cap of the reviewer.
If you start building an ideal mega-architecture in any project even before the project, where it is not needed, then this is already to some extent premature optimization , which has already been discussed a million times. Not a single software corporation in the world can design everything in advance, and in most cases everything is designed and written through the ass, I can say this for sure, because many large products had to be reversed. You would know what kind of shit it is, even within the framework of the correct use of development tools and languages ​​...
The recipe is simple: try, make, build, break, rebuild, fail, rebuild again. It’s stupid to take and read how someone did it there and it turned out, it won’t work. His stars converged, but you, me, or hers will not converge in exactly the same sequence. Use different programming languages, different paradigms, frameworks. This gives an excellent understanding of the existence of various architectural solutions that no theoretical pattern will give.
I do not want to say that all these gofs and solids do not make sense, they are created in order to start with just getting to know them, putting them in the subconscious and ... safely forgetting them! But then, when I was suddenly writing something, it suddenly dawned on me: Yes, this is a mediator/observer/repository/anyPattern pattern! This is where the very book of three tankers and a dog comes in handy, which simply directs you in the right direction, explains the rest that you didn’t have time to understand yourself, etc.
All this is my understanding, it works for me, it may not work for someone else who, for example, remembers 95% of the book they read and can immediately adequately assess where which approach to use, where it will be necessary to scale, etc.
But I haven't seen such people yet...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question