Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Write the code elegantly with the thinking of making the product.

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Recently did a training on how to make a product and cultivate product thinking, product Sense, first look at the definition of the product: can be released to the market, can meet the needs of the market or some people, certain scenarios, we can think of as a product, a product can be anything, a cup, a software system, a person can be a product, as long as it meets certain needs. Therefore, programmers develop a program, write a piece of code is actually a product, need to write elegant code, easy-to-use code, high maintainability, robust code, these are consistent with the requirements of the product.

Below we use the idea of building a product to understand how to develop code elegantly and recall the $Appeals method of user requirements for the product.

First, identify the user: the product should first identify the user or user of the product, a program developed by a programmer, whose user may be an external customer of our company, or another department of the company; an interface, a method provided to the outside, its user may be another related system, or another programmer sitting next to you. Then the user is different, the user's characteristics, characteristics, personality, habits are different, programmers should clearly know their own users and their characteristics.

Second, product positioning: products should have their own product positioning, we may develop an underlying basic platform, a CBB, a service, then their product positioning is simply to provide basic components and basic services for the application system, which can make the application system faster and easier to develop.

Third, enhance the competitiveness of products: we say that the characteristics of users are lazy, changeable, scary and unwilling to think, so the code developed by programmers and the services provided by programmers also have to solve these characteristics of users. in this way, someone in your program will be willing to use it, and it will also reflect your own competitiveness.

1. P Packaging: give a beautiful name to your programs, classes, directories, files, etc.

2. E is easy to use:

1) concise and easy to understand, such as class name and method name, should be as concise as possible, do not use dozens of characters to express (after all, the user is lazy), and make it easy for your users to understand his meaning and do not need to think about it. I don't need to ask what you mean.

2) No ambiguity: correct naming, through the name can fully and correctly express the service functions you provide, do not have ambiguity, such as HTTP protocol provides a simple Put, Get methods, the literal meaning is very clear

3) correct comments, the contents of which should be consistent with the services provided by the method or class, and should not be ambiguous or misunderstood, otherwise it would be better not to write

3. A security / quality: provide safe and stable code, and can accurately record the corresponding log, facilitate the location of problems, respond to user complaints and solve problems.

4. An availability: separate all services provided externally from those used internally, expose only the external service interface, and uniformly encapsulate the external interface in the API package, so that users can easily get the services they need

5, L life cycle cost: the robustness of the program, performance, forward-looking technology, etc. all determine how long your program can be used without being eliminated by new technologies and new components; in addition, the external platforms, components, and services need to be maintained by you later, so you need to consider and design how to facilitate you to maintain these codes, such as concise code, clear logic, complete log records and so on.

6. Social acceptance: can your code be accepted by other systems and other developers? Or is it said to be a mess? I believe many programmers have scolded their former programmers about how to leave a pile of junk code to you for maintenance.

Fourth, product planning: different stages, different reality environment, to achieve different needs, the needs need to be sorted. So the same is true for writing programs. In the initial stage, the overall framework should be built first, including the response module package, package path, package structure, class name, interface name, interface method name, etc., which can be directly developed by Eclipse tools, or designed by code design tools such as PowerDesign, UML, etc. This is equivalent to quickly prototyping the product, letting the user know your product and quickly feedback whether it meets the demand.

Fifth, product development: after the completion of the construction of the product framework, we will do specific interface implementation classes and specific methods, which is equivalent to the product development stage. Division of labor and cooperation between different modules, parallel development, improve the speed of development.

OK, is writing code still that boring? No, writing code can be elegant, design as art, and develop a great work like a product. How to improve the fun of writing code, how to improve the ability to write code depends on how you think. Treat your code as a product and as a project, just as being in a relationship is a project.

-this article comes from ice_fire2008 's CSDN blog. The full text address can be found at https://blog.csdn.net/ice_fire2008/article/details/82926029?utm_source=copy.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report