Home  >  Article  >  Backend Development  >  Thoughts and exploration on using .NET for efficient Internet agile development

Thoughts and exploration on using .NET for efficient Internet agile development

黄舟
黄舟Original
2017-02-22 10:18:131182browse

I don’t know since when, starting a business has become very cheap. Everything we talk about is the Internet, and it is easy to raise tens of millions of dollars. This gust of wind seems to have also hit programmers. There are a large number of developers who do not study data structures well and do not have a solid grasp of database principles. They publish several projects on github, use nodejs to create some services, and then use H5 to write APPs. , I think I have entered the ranks of senior programmers and can strategize Internet projects. Does learning new technologies and new concepts mean rapid growth? Obviously it is not entirely true. In this impetuous atmosphere, various shoddy Internet websites and APPs One after another, many seemingly beautiful APPs do not even have measures to deal with the security of simple http interfaces. Many beautiful responsive websites have directory structures stacked randomly. This is really an evil trend. I think programmers should still keep their feet on the ground. To be practical, learn more theories, write more codes, and practice repeatedly.

Then another question arises. Are new technologies and new concepts useless? Obviously not. New technologies and new concepts are what countless technical experts have repeatedly repeated in long-term practice. The fruits of victory of the construction, and as a .NET veteran, I am deeply gratified to see Microsoft embracing open source and embracing the changes and progress brought by the community over the years. So today, I want to share with you about me and my experience over the years. The company summarizes some experiences and technologies in using .NET for Web development and even Internet application development.

Let’s first look at a typical case that was recently launched, http://www.php.cn/, which uses tools such as HTML5, Bootstrap, EF6 For MySql, and Alibaba Cloud RDS. , Alibaba Cloud CDN and other new technologies and concepts, however, they have not departed from the basis of using .NET for development and the .NET ecological environment (IIS, Windows Server) for deployment. However, the entire development process has completely got rid of WebForm or even MVC, we have implemented a new .NET development model, which has greatly improved development efficiency and team collaboration, and greatly shortened development time. In this case, the front-end and back-end management of the entire website, from conception to design , development, debugging and deployment, one person can complete it in 3 days. The following is a detailed description of the development model. We will also listen to everyone’s opinions and continue to improve and improve.

Regarding the evaluation of ASP.NET WebForm, I think the following is objective: The innovation of ASP.NET WebForm drag and event-driven Web development model has facilitated the learning of a large number of .NET beginners. and understanding, but in the end it seriously hindered the popularization and commercial use of .NET. Moreover, for a long time, the excellent language features of .NET were not taken seriously. Instead, it has been regarded as low efficiency, difficult to expand, and unsuitable. As a business development hat, ASP.NET WebForm has an unshirkable responsibility in this.

Thinking back to 2006 and 2007, I was still marveling at the power and convenience of UpdatePanel. Looking back now, this development model has undoubtedly obscured developers’ understanding of the nature of HTTP and the Web. This layer of fog is a setback in the long run. Later, in the ASP.NET MVC era, the bad habits of Microsoft's high-level programmers have not improved. Although MVC is open source, it is still full of all kinds of self-righteous attempts to provide developers with advance information. Junior developers may find these well-thought-out features, bindings, shortcuts, etc. very convenient, but I think any technical manager who has been engaged in commercial project architecture and development will have a deep feeling that when they really need stable and solid In the project, these little tricks are not only useless, but also difficult to expand, and more likely to lead to bugs and loopholes that are difficult to control.

Fortunately, under the leadership of Nadella, and under the guidance of Bill Gates returning as technical advisor, .NET has continued to correct its direction, not only making great strides forward in language, but also in ecological construction. increasingly visible. I have been doubting whether the .NET agile development model created by the company is a manifestation of advancement. Until the emergence of vNext (MVC6.0), it suddenly dawned on me that different paths lead to the same goal, and Microsoft has finally taken the right path.

Before talking about the development model, I would like to talk about it first:

 1. Some new trends and characteristics of current Internet projects or traditional Web projects

 1. No longer use WebService, but heavily use HTTP as a method of data communication

 2. The data carrier no longer uses XML, but instead uses JSON

 3. Web front-end Will use third-party HTML5 frameworks such as Bootstrap, JQueryUI, EasyUI

 4. If there are APP needs, or even APP-first needs, the APP needs to connect to various third-party plug-ins

 5. In order to pursue APP Quick launch, sometimes using HTML5 APP development model, such as PhoneGap, AppCan, HBuilder, etc.

6. If there is a need for WeChat, it is required to connect the WeChat public account and carry out mobile Web development in the WeChat browser

7. Short development cycle and frequent iterations

8. The amount of data is growing rapidly, and there are more demands for report display and data analysis

9. Project team personnel needs are determined by Web Development engineers are subdivided into HTML5 front-end engineers, JAVA (.NET) engineers, database engineers, etc.

 10. Unit tests are decreasing, functional tests are increasing, and Internet tools (worktile, etc.) are even used to replace professional testing tools

Based on the above situation, we consider that if we still use .NET for system development, So in an agile project with users

 2. Some traditional .NET Web development models and methods should be abandoned

 1. ASP.NET WebForm and MVC models are no longer suitable. They both suffer from serious front-end and back-end coupling, complicating simple processes, and the front-end can never be separated from the .NET architecture.

 2. The SQL Server database is no longer suitable. Although the features of SQL Server 2014 are exciting, as the use of public clouds becomes more and more common, at the same time, compared with other databases, the size, price, availability In terms of scalability and even performance, SQL Server is at a disadvantage.

 3. The traditional three-tier architecture is no longer suitable. Many Internet projects are required to support multiple service nodes from the beginning of their design, and use different databases for different application scenarios. In addition, the three-tier architecture uses reflection extensively to increase code at the expense of performance, and is no longer suitable for agile development.

 4. The IT architecture of Server 2003 should be abandoned. Whether it is the HTTP request processing model of IIS6.0 that lags behind IIS7, or the stability and expansion of Server 2003 that lags behind Server 2008 and 2012, it should not be considered again. .NET deployment based on Server 2003 and IIS6.

Although some things have been abandoned, Microsoft is Microsoft after all:

3. Some .NET features should be strengthened

1. In-depth use Visual Studio 2015 development tool, VS2015 is a world-class development tool. Needless to say, it is even more proficient in front-end coding (CSS, JS, HTML). With custom settings and third-party plug-ins suitable for engineers, it will be even more powerful.

 2. The use of TFS source code management, whether installing the TFS Express version internally or applying for free space on tfs.visualstudio.com, can facilitate team collaboration. From our practice, do not be The Git model goes to your head. In fact, the TFS management model is the most suitable for .NET development

3. .NET high-level language features should be used more intensively. On the basis of understanding, if you can use Linq and Lamda proficiently High-quality language features and methods unique to .NET such as expressions, reflection, and task parallel programming will greatly improve development efficiency and shorten development time.

4. The advanced functions and dynamic management of IIS should be strengthened. After IIS7, the IIS server is synonymous with high-performance Web middleware. With the addition of the Core mode of Server 2008 and 2012, the dynamic management and dynamic management of IIS should be strengthened. Configuration can greatly improve Web processing efficiency.

5. The use of Server 2012 R2 operating system should be strengthened. Although cross-platform is the direction of .NET and is also practiced well on mono, today when PC servers and cloud servers are getting cheaper and cheaper, it is still Use the latest server operating system Windows.

 With the above understanding, after summary, our current .NET development model can be simply summarized as follows:

 1. High-level solution of front-end and back-end Coupling

The first thing to do is to completely abandon the ASP.NET WebForm and MVC models. The front and back ends are highly decoupled. All logic processing on the front end is processed using JS, including Dom element layout and drawing and data. requests, while the backend is pure business logic processing, including logic processing and data processing. At present, our project uses the Routing feature in ASP.NET and still hosts the ASP.NET model and IIS. In theory and in the near future, it will be replaced by Core IIS or Nginx under Linux to host pure HTML5 and HTMl5 cache. It will also be very easy.

 2. The front-end uses pure HTML5

The front-end abandons traditional HTML and uses HTML5 technology as much as possible. The sacrifices made include abandoning browsers below IE11, but In today's Internet thinking, such an idea is not a bad idea. When HTML5 technology is fully used on the front end, various processing of files, graphics, images, audio and video, geographical location, etc. will become very simple, flat, and data-based.

 3. The front-end makes full use of mature frameworks

After using the new development model, an obvious change is that the company’s artists no longer or rarely perform front-end cutting pictures, and the demand for technical artists (who can develop CSS and JS, and understand design) is increasing day by day. The root cause of this change is the emergence of advanced and excellent front-end frameworks. We are currently using JQuery , Zepto, JQueryUI, JQueryMobile, Bootstrap, Amaze UI, inoic, Framework7, SUI, MUI, etc., as well as third-party plug-ins accompanying these excellent frameworks. Objectively speaking, through the use of excellent frameworks, not only does the system risk of the front end not increase, but due to the open source, clear architecture, stability and other characteristics of the framework, a more stable and scalable front end is achieved. To give a simple example, Bootstrap has played an important role in solving the fully compatible layout and responsive layout issues that trouble many web engineers.

 4. Object-oriented front-end development

The front-end development is simply encapsulated through the object-oriented features of JS. The operation of Dom elements and the processing of business logic data requests are consistent with the back-end data type, entity structure and processing logic, which not only brings the front-end and the back-end closer The understanding of business needs among developers also greatly lowers the threshold for technical training and improves the efficiency of teamwork.

 5. Use CDN services

CDN services were exclusive to large enterprises and companies a few years ago. Now they have become completely popular and civilian, and the Web front-end is becoming more and more popular. It is an indisputable fact that the data is getting heavier and heavier, but the real business logic is often only tens of K or even several K. A page of several hundred K, 90% of which is third-party frameworks such as JQuery, therefore, reasonable use of CDN acceleration will not only improve user It directly improves the load capacity of web services based on HTTP architecture by more than 5-10 times.

 6. HTTP service-based business logic

This sentence may not be an appropriate description, but it is also the most important link in our new .NET development model. , after studying advanced Internet architectures such as Alibaba Open Platform, we finally formed a structured but loose business logic processing model, that is, each business logic behavior has a unique routing name, and the business logic is only responsible for the routing name. The routing name is responsible for upper-layer requirements such as flow direction, performance, permissions, and security. The advantage of this is that it can make full use of developers with about 3-5 years of experience (which is also the main development force of most companies), allowing them to focus on writing business logic, while things other than business logic need to be considered in the architecture. The level is solved by other controllers, and a large .NET project can also be flexibly split into sub-modules in different ways. For the implementation of HTTP services, we have tried ASP.NET ASHX processor, Windows Service HOST WCF service, and ASP.NET Web API. The current more stable version is Web API. Of course, in response to the demand for HTTP service, Wen API is also obvious. Seriously, we will continue to improve in the future. In short, this change process has improved development efficiency and testing efficiency by at least 3 times in practice. In a later chapter, this will be explained in detail.

 7. Distributed and hot-loading HTTP service construction

Internet applications require agile development and repeated iterations. Different requests under the same logical architecture will use different Servers and databases are commonplace. Therefore, in the early stage of project design, the construction of distributed HTTP services is crucial, and business updates require hot loading. In the .NET system, it is the dynamic loading of DLL managed code. Unfortunately, since the company's existing projects do not have large-scale distributed scenarios, a more stable DLL dynamic loading architecture has not yet been developed. This will be discussed in detail in the next chapter.

 8. Use Alibaba Cloud to solve big data problems

I think any IT architect who has used Alibaba Cloud and other cloud services can deeply feel that By the way, Alibaba Cloud is already more than one position ahead of other clouds. In fact, especially Alibaba Cloud's database-related functions, such as RDS, DRDS, KVStore, etc., have actually solved many complex and difficult points in traditional requirements in practice. The specific details will be discussed in detail later, but sincerely speaking In a word, hurry up and use Alibaba Cloud. At least at this stage, Alibaba Cloud is not kidnapping you, but helping you.

I wrote a lot today. In general, I want to tell you that the spring of .NET has come. .NET can not only carry out Internet-based agile development, but also handle large-scale projects, large-scale data and large-scale logic. This I have already tasted the benefits in practice. As a programmer who has been writing Pascal data structures for more than fifteen years now, I am also very interested in various new technologies. I have dabbled in them and even tried them. I am not afraid of being confused by others. I can even boldly say that other languages, from a comprehensive perspective (language, development environment, development efficiency, technical community, team collaboration, application capabilities), have lagged far behind .NET in the field of application-level development. There are many, but .NET programmers themselves have not noticed it yet, so from this point of view, everyone needs to work together and continue to study and explore.

The above is the thinking and exploration of using .NET for efficient Internet agile development. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
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