Home > Common Problem > It wasn't until I did low-level development that I realized how cool it was not to write business code.

It wasn't until I did low-level development that I realized how cool it was not to write business code.

Release: 2023-07-31 15:13:39
forward
541 people have browsed it

When writing business code, you may spend most of the day adjusting other people's interfaces. The interface is not suitable for encapsulating a function, and the requirements are constantly changing.

After all, the most important thing is to implement the function, and the most important thing is the user experience. If others ask for it, you just have to implement it.

You are like a ruthless machine, writing repetitive business code to achieve similar functions, but you feel that you have not made any progress, and your horizons have not improved... ...

But driver development is completely different...

It wasn't until I did low-level development that I realized how cool it was not to write business code.

It’s up to you to decide whether it works or not

Business code, the most common thing is demand changes.

For example, if you add another function to this module and encapsulate the code, if you can’t write it this way, you should write it this way...

However, for a driver, if it can be used, it can be used, and if it cannot be used, it cannot be used. There are not many requirements at all.

For example, a network card driver can connect to the network normally and transfer files normally is its function. How to write the code is based on the chip manual. No one will tell you. What needs to mention.

So, there is no need to worry. As long as it can be used, your task is completed. There will be no requirements. At most, the bugs will be corrected.

It wasn't until I did low-level development that I realized how cool it was not to write business code.
Except for you, most people dare not touch your code

Why don’t you dare to move?

Driver code is not like the business logic written in the application layer. The business code may be more about some programming skills and code optimization, such as interface encapsulation, parameter judgment, Special situation handling and other things that focus on software design. If you see that a certain piece of business logic is not well written, it will be easier for someone with some experience to change your code.

#But one of the biggest features of writing driver code is to first understand the chip manual.

For example, the driver allocates a 64-byte aligned memory and sets the register again before scheduling. Why do you do this? You don't know.

If someone thinks there is something wrong with your driver and wants to change your code, they should first understand the chip manual.

Before he read the chip manual, he couldn't move this code. Only you know what this noun and this bit means, and why the code is written like this.

Even if there is a problem with the driver, you must change it yourself, because most people will not be idle to read documents that are not within their scope of work, and it will take several days to understand the document.

Even if it is a small error, you usually have to correct it yourself, because others do not know whether changing this place will affect other places. Only the person who wrote the driver knows .

So as long as the driver can be used normally, no one will touch it.

It wasn't until I did low-level development that I realized how cool it was not to write business code.
I tell you what functions I have,
not you Come tell me what functions you want

If it is business code, you are usually led by requirements, everything is for the user experience.

But the driver code is the opposite, I will only tell you what functions I have, instead of you telling me what functions you want.

A driver has only these functions. It can only be less but not more. I can tell you that this driver has these functions. What kind of interface do you want? An ioctl interface or other interface can be provided for you to call.

If you say you want to pass a parameter and return xxx to you, I may also tell you that it can't be done. If you say that you want to pass some parameters at the same time and return xxx at the same time, I will only tell you that you can't do it.

Why you ask? Because the hardware itself cannot achieve such an effect. If you don’t believe it, then go read the chip manual and ask me again after you understand it.

The above is the detailed content of It wasn't until I did low-level development that I realized how cool it was not to write business code.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:嵌入式Linux充电站
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template