How to design business logic?

Source: Internet
Author: User

Software design is always unpredictable , Although the design does not necessarily determine the Software Life and Death , But it plays a very important role in the software development cycle. . So what kind of design can adapt to software changes? ? For me, only answers are unknown. ... This is because I only focus on existing problems during design. , However, what happens to software changes in the future is confusing. . Though difficult to design , But experienced designers always know when to do something. , And their starting point is often not very thorough consideration. , InsteadCodeThe simpler the structure, the better. . We cannot control the changes in business. , However, we still have the ability to easily maintain and modify code changes. .

I won't talk much about it. , Recently, it seems that many people have talked about three-tier design issues. ; Let me get busy. , But I'm not talking so widely. , From the perspective of business logic design ( Details determine success or failure ).

Let's take a look at the following code.:

Public VoidCreate (StringUsername,StringEmail ){

 

}

 

Public VoidCreate (UserUser ){

 

}

In fact, both methods provide the same functions. , But the two are indeed different. . In my personal opinion, the latter has a low risk of method change. , Because User Class provides information extension to provide some protection . Is this the case? , Obviously, the following does not make much sense. .

Public BoolLogin (StringUsername,StringPWD ){

 

}

 

Public BoolLogin (UserUser ){

 

}

So one thing we can remember,ProgramIt's dead, but people are living..

the above logic is external , what about the logic ? same method

Public VoidCreate (StringUsername,StringPWD ){

// Insert username, userpwd

// Dal. Call (username, userpwd)

}

 

Public VoidCreate (UserUser ){

// Dbcontext. Add (User)

}

Where is the difference between the above Code?,This is left for discussion with interested friends.

 

Another topic : How can we know that what we make Meets future needs? ? If we can achieve this, the only possibility is that the business changes are developed in the direction we assume. , But will we always be so lucky? ? What should we do if we are lucky? ? At this time, it is estimated that only simple and maintainable code can save us from the well. ...

 

ThisArticleI just mentioned an introduction and didn't want to say that this design is correct.,Because there is no better design method, only better..Let's keep improving in practice..

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.