当前位置:网站首页>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.
边栏推荐
猜你喜欢

HDRP shader gets pixel depth value and normal information

Primavera Unifier 自定义报表制作及打印分享

Adobe LiveCycle Designer report designer

Validate the execution flow of the interceptor

深度神经网络与人脑神经网络哪些区域有一定联系?

代码签名证书可以解决软件被杀毒软件报毒提醒吗?

【中央任务调度系统—通信开发】

数字钱包红海角逐,小程序生态快速引入可助力占领智慧设备入口

How to determine the neural network parameters, the number of neural network parameters calculation

期货开户最低的是交易所手续费不加佣金
随机推荐
VideoScribe stuck solution
清除微信小程序button的默认样式
数据库事务
MySQL表sql语句增删查改_修改_删除
Adobe LiveCycle Designer report designer
【中央任务调度系统—通信开发】
腾讯电子签开发说明
突破次元壁垒,让身边的玩偶手办在屏幕上动起来!
使用树莓派和OAK相机部署机器人视觉模型
Segmentation Learning (loss and Evaluation)
【无标题】超时超时超时超时超时
力扣打卡----打家劫舍
mysql中查询多个表中的数据量
分割学习(loss and Evaluation)
Deploying Robot Vision Models Using Raspberry Pi and OAK Camera
Quickly submit a PR (Web) for OpenHarmony in 5 minutes
深度神经网络与人脑神经网络哪些区域有一定联系?
MySQL表sql语句增删查改_增加
爬虫封装成api
WordpressCMS主题开发01-首页制作