use of programming principles in life

use of programming principles in life

It’s no secret that robots and smart machines are just the implementation of some concepts of living nature in the form of man-made mechanisms. Life over millions of years has created a variety of forms, and people only copy them to one degree or another in their engineering creations. But is it possible that the concepts that people use to design robots and the programs that control them, are used in the real life of her revolution? Yes, there is such a trend. Lifehacking is a movement that originated as an approach to building one’s own life as to writing a program. At the same time, the same approaches and techniques used by programmers are used.

Programming paradigms when solving common life tasks

  1. Procedural programming. It involves writing a series of subroutines, about procedures, which are then called into the main program and executed there. This allows you to use a bottom-up approach when writing programs, when the main module is written first, and when writing procedures, “stubs” are substituted, and then proceed to writing each individual procedure. This approach allows you to avoid some errors during testing.

    In life, this approach corresponds to the division of some complex task into somewhat simpler subtasks. For example, when it is planned to wash the floor, first remove all the things that may interfere with washing, then the floor is swept with a broom, after that the floor is washed directly, and then when it is dry, the things are put back in place. Each such task separately is much simpler and more specific, easier to perform than doing everything at once.

  2. Functional programming. envisages a program as a special computational process, sometimes recursive, sometimes cyclic. The data here is often integrated with the executable code.

    In life, this approach corresponds to regular work on a task in a purposeful way. For example, in order to make money, you need to run a job function, enter it, and execute it until some result is returned. At the same time, we do not have any goal to alternate certain states of the program, to emphasize the results, only the fact of performing a certain process or function is important. This allows you not to be distracted by extraneous stimuli and, as a result, to achieve greater results than if you were constantly checking with what state of affairs you want to have now.

  3. Modular programming. The modular approach involves bringing various procedures and functions, which are often needed in the same form and may be needed several times, outside the main code, and combining them into separate modules. There is no need to rewrite the same code ten times, the modules are in the library and can be accessed many times by connecting them to the program from the library.

    This approach can also be used in life. For example, you can plug in the “robot” module and sequentially call familiar functions and procedures found in that module. At the same time, the person himself does not burn out at work, since he can subconsciously instill the state of calling the function from the module and perform it virtually automatically, concentrating his main attention on planning other things, writing “main code”.

    Object-oriented approach. p align=”justify”> Is an extension of structured programming. In life, this approach can be used when modifying individual procedures and functions. For example, you can create a class based on the “road to the store” function, put in it the main methods that will allow you to modify it, and concentrate the main procedures and functions of the class in it. In the future, other objects can be created based on this class: “road to school”, “road to work”, “road to parents”. All of them will be executed taking into account the ready-made “code” with only the interface part changed.

    There are many other approaches to programming, and all of them can be applied to planning real-life tasks.

General techniques of a programmer’s work that will help solve life problems

Testing – An integral part of writing any program. It will allow you to release reliable code that will work without errors. Testing is usually divided into three blocks: Unit testingtesting of individual procedures and functions, objects that must work under different conditions and exclude errors with all possible input data, then – interaction testingwhen the interaction of program elements with each other is tested, and after – general testing of the entire program.

There is an opinion that one should adhere to the “testing pyramid” principle, in which most of the time is allocated to writing unit tests, the base of the “pyramid”, less time is spent on writing interaction tests, the middle of the “pyramid”, and for general testing of the entire program, the tops, even less time.

In life, this approach can be implemented, for example, in evaluating the prospect of marriage with a certain person. For example, certain parts of his “program”, “units”, the fact that he likes to get up late, snores in bed, is interesting in conversations and has a nice car are known. First, unit tests are carried out to see how each of its shortcomings will have to be put up in the future, for example, whether it is possible to sleep separately if the sleeping habits do not match. If this stage cannot be completed, there is no point in proceeding to further testing. Then you can conduct interaction tests, for example, imagine how interesting he will be in conversations if you have not slept. Or overslept. And then conduct some general analysis, it will take a minimum of time.

Google hack. If someone thinks that a programmer mainly writes code during his work, then tries to run it, then fixes it if something goes wrong, then he is wrong. According to estimates of the work of various large companies, a programmer spends about 80% of his time in an Internet search engine, looking for a ready-made solution to a problem that is already working. All functions and routines have long been written, collected in modules that can be compiled, modules can be found in libraries. And you just need to find them using Google. This is called a Google-hack, programming using the Google search engine. Not necessarily limited to him, for example, available StackOverflow-hack, chat-GPT-hack, YouTube-hack.

If something doesn’t work, ask in the search engine! Modern search systems allow you to combine the knowledge of people around the world in a huge network and exchange them, apply them in practice in various conditions. But in life, you don’t always need to spend as much time in the search engine as programmers, sometimes you just need to focus on performing certain functions.

What is the best programming language to learn first? Most programmers will say that the best option is to learn English first. This is a direct consequence of the previous point. If you are looking for a solution in a search in another language, then perhaps there will be no options found. And all technical product documentation is usually written in English. English is an international language. And people who know many other languages ​​write down their decisions on it. In a word, the whole world is open to someone who knows English. Likewise, the whole world will be open to a person who knows programming well. Because programming is 11010000 10111011 11010001 10001110 11010000 10110001 11010000 10111110 11010000 10110100

Related posts