当前位置:网站首页>How to build programming ideas and improve programming ideas
How to build programming ideas and improve programming ideas
2022-08-11 10:03:00 【Xiao He Online】
One. First of all, what is programming thought?
Programming thinking is a guiding ideology, and this guiding ideology will induce the behavior of how you write code.
If you understand what this means?For example, the Chinese civilization has formed a thought of "unifying the world" in the minds of the people for thousands of years. This kind of thought will induce princes or warlords in various chaotic periods to aim at unifying China, rather than dividing China like Europe.Each is independent, and each is called the emperor as the goal.
So what kinds of programming ideas are there?
1)Procedural Oriented Programming.This is the thinking of most programmers in our country.This kind of thinking induces the phenomenon when they write code: a method is written with a lot of business logic, or the path from the ui layer (point) business logic layer (point) database access layer is written.
2)Functional programming.Typical functions are functions in javascript written by many people.Various businesses are written with various functions.
3)Object-Oriented Programming.This is a relatively advanced and abstract idea. It has three characteristics and five principles.That is, encapsulation, inheritance, polymorphism, singleness, opening and closing, Liskov substitution, dependency inversion, and interface isolation.
Digression: Some people will tell you data structures and algorithms. What I want to tell you is that it is not a programming idea, but a programming ability. It tests your logical operation ability. The better you are, the more complex technology you will deal with.The field can go deeper, and eventually you can reach the category of a scientist.
Second, the pros and cons and choices of programming ideas.
Procedural and functional programming are the original ideas of every recent graduate.That is, as long as he learns programming, the code he wrote at the beginning is this kind of thinking, and he does not need to teach it.
The object-oriented programming is advanced abstraction.In essence, the evolution of a programmer is actually the process of cultivating, forming, developing and maturing the idea of object-oriented programming.
So, you should now know what the best thinking is, yes: Object Orientation.
Third, how to establish programming ideas
First of all, you must always keep in mind the three major characteristics and five principles of object-oriented. You are very familiar with those words, but you absolutely do not know the terrifying power contained in them.That is: it is one thing for you to recognize the word, it is another to understand and use it.
Then, you have to think about whether you are using its features and principles in your practice.
Finally, keep trying to fix and change your code, and slowly, your object-oriented programming ideas will start to build.
Fourth, how to practice, train and improve programming ideas
1. By learning design patterns.
At the beginning, you are unlikely to have object thinking yourself, because you have not yet formed object thinking. At this time, you need to use previous models to summarize, practice continuously, and write patterns for patterns.raise it.
2. By constantly refactoring the written business logic code, it requires a lot of practice, so that it can make you feel that it conforms to the three major characteristics and five principles.
3. To judge whether a code is well written or not, whether it conforms to the idea of object programming, there is a very simple and crude standard:
Your method body, remove the comments. If you can make the logic of each method in your method body, the number of lines of code in his method body is no more than 30 lines, then you are estimated to have written effectively.If you can find many of your method bodies, when the number of lines of code is only within 10 lines of single-digit code, your object-oriented programming thinking has matured.
4. Keep the code thinking constant.
It takes a long process to change your original procedural programming thinking through continuous practice and practice. From my practical experience, it takes at least 3 years of practical training, so in this sense, 599% of Chinese programmers under the age of 20 are not object-oriented.When you no longer write patterns for patterns, and the code you handwrite is so concise and beautiful, you are already better than 95% of Chinese programmers.
边栏推荐
猜你喜欢
随机推荐
【应用SLAM技术建立二维栅格化地图】
数据库 SQL 优化大总结之:百万级数据库优化方案
期货开户最低的是交易所手续费不加佣金
突破次元壁垒,让身边的玩偶手办在屏幕上动起来!
HDRP shader 获取阴影(Custom Pass)
如何开手续费低靠谱正规的期货账户呢?
SQL statement
Quickly submit a PR (Web) for OpenHarmony in 5 minutes
Primavera P6 Professional 21.12 登录异常案例分享
力扣题解8/10
WordpressCMS主题开发02-制作顶部header.php和footer.php
前几天,小灰去贵州了
浮点型在内存中的存储
工业检测深度学习方法综述
canvas文字绘制(大小、粗体、倾斜、对齐、基线)
Primavera Unifier - AEM Form Designer Essentials
mySQL事务及其特性分析
数字钱包红海角逐,小程序生态快速引入可助力占领智慧设备入口
计算数组某个元素的和
数组、字符串、日期笔记【蓝桥杯】