Home >Backend Development >C#.Net Tutorial >Thoughts on high-efficiency Internet agile development using .net
I don’t know since when, starting a business has become very cheap. Everything we talk about is the Internet, and it’s 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 ideas useless? Obviously not. New technologies and new ideas are the fruits of victory that countless technical experts have repeatedly reconstructed in long-term practice. As a As a .NET veteran, I am deeply pleased to see Microsoft embrace open source and embrace the changes and progress brought by the community over the years. So today, I want to share with you how I and my company have used .NET for Web development over the years. Some experience and technical summary of development and even Internet application development.
The latest typical case, which uses new technologies and concepts such as HTML5, Bootstrap, EF6 For MySql, Alibaba Cloud RDS, Alibaba Cloud CDN, etc. However, it does not break away from the use of .NET for development and adoption. NET ecological environment (IIS, Windows Server) for deployment, but the entire development process has completely got rid of WebForm or even MVC. We have implemented a new set of .NET development models, which has greatly improved development efficiency and team collaboration. The development time is also greatly shortened. In this case, the front-end and back-end management of the entire website, from conception to design, development, debugging, and deployment, were completed by one person in three 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 words are objective: The innovation of ASP.NET WebForm drag and event-driven Web development model has facilitated the learning and understanding of a large number of .NET beginners, but In the end, it seriously hindered the popularization and commercial use of .NET. For a long time, the excellent language features of .NET were not taken seriously. Instead, it was labeled as inefficient, difficult to expand, and unsuitable for commercial development. , 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 cast a layer of fog on developers’ understanding of the nature of HTTP and the Web. In the long run, it is a setback. Later, in the ASP.NET MVC era, the bad habits of Microsoft's senior programmers have not improved. Although MVC is open source, it is still full of various self-righteous features that were thought of in advance for developers. , binding, shortcut methods, etc., these things may be very convenient for junior developers, but I think any technical manager who has been engaged in commercial project architecture and development will have a deep feeling that in solid projects that really need stability, these Small cleverness is not only useless, but also difficult to expand, and can easily lead to bugs and vulnerabilities that are difficult to control.
Fortunately, under the leadership of Nadella and the guidance of Bill Gates returning as technical advisor, .NET has continued to correct its direction. In addition to making great strides forward in language, it has become increasingly clear in ecological construction. 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:
1. Some new trends and characteristics of current Internet projects or traditional Web projects
1. WebService is no longer used, but HTTP is used extensively as data Method of communication
2. The data carrier no longer uses XML, but instead uses JSON
3. The Web front-end will use third-party HTML5 frameworks such as Bootstrap, JQueryUI, EasyUI
4. There are APP needs, and even APP priority needs , the APP needs to connect with various third-party plug-ins
5. In order to pursue the rapid launch of the APP, sometimes the HTML5 APP development model is adopted, such as PhoneGap, AppCan, HBuilder, etc.
6. If there is a need for WeChat, it is required to connect with the WeChat public account , 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 reduced, 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 .NET is still used for system development, then in an agile project with a user volume of
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 have serious front-end and back-end coupling, complicated simple processes, and the front-end can never be separated from the .NET architecture.
2. SQL Server database is no longer suitable. Although the features of SQL Server 2014 are exciting, as the use of public cloud becomes more and more common, compared with other databases, the size, price, scalability and even performance In terms of 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 the 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, the IT architecture based on Server 2003 and 2012 should no longer be considered. .NET deployment for IIS6.
Although some things have been abandoned, Microsoft is Microsoft after all:
3. Some .NET features should be strengthened
1. Make in-depth use of Visual Studio 2015 development tools. VS2015 is a universe-level development tool. Needless to say, even in Front-end coding (CSS, JS, HTML) is also becoming more and more proficient. 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 in Applying for free space on tfs.visualstudio.com can facilitate team collaboration. From our practice, don’t be carried away by the Git mode. In fact, the TFS management mode is the most suitable for .NET development
3 , .NET high-order language features should be used more intensively. On the basis of understanding, if you can skillfully use .NET-specific high-quality language features and methods such as Linq, Lamda expressions, reflection, and Task parallel programming, your development efficiency will be greatly improved. , shorten development time.
4. The advanced functions and dynamic management of IIS should be strengthened. After IIS7, IIS server is synonymous with high-performance Web middleware. With the Core mode of Server 2008 and 2012, strengthening the dynamic management and configuration of IIS 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, but today when PC servers and cloud servers are getting cheaper and cheaper, it is better to use the latest version of Windows. server operating system.
With the above understanding, after summary, our current .NET development model can be briefly summarized as follows:
1. Highly decoupled front-end and back-end
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 back end 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. Among the sacrifices made are abandoning browsers below IE11, but in today's Internet thinking, such an idea is not a bad idea. After all the front-end uses HTML5 technology, 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, one obvious change is that the company’s artists no longer or rarely perform front-end drawings, and the demand for technical artists (knowledge of CSS development and JS Development and design) are increasing day by day. The root cause of this change is the continuous 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 front-end system risk 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.
IV. Object-oriented front-end development
The front-end development is simply encapsulated through the object-oriented features of JS, and the operation of Dom elements and the processing of business logic data requests are consistent with the back-end data types, entity structures and processing logic. Unanimity not only brings closer the understanding of business needs between front-end and back-end developers, but also greatly lowers the threshold for technical training and improves the efficiency of teamwork.
5. Use CDN service
A few years ago, CDN services were exclusive to large enterprises and companies. Now they have been completely popularized and civilianized. It is an indisputable fact that the Web front-end is becoming more and more important, but the real business logic is often only tens of K or even a few K. 90% of a page of several hundred K is made of third-party frameworks such as JQuery. Therefore, reasonable use of CDN acceleration not only improves the user experience, but also directly increases 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 a very 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, in the end, We have formed a structured but loose business logic processing model, that is, each business logic behavior has a unique routing name. The business logic is only responsible for the routing name, and the routing name has upper-level requirements such as flow direction, performance, permissions, and security. Responsible. 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. It is common for different requests under the same logical architecture to use different servers and databases, so in the early stage of project design , the construction of distributed HTTP services is crucial, and business updates need to be able to perform hot loading. In the .NET system, it is the dynamic loading and use of DLL managed code. Unfortunately, because the company's existing projects have not seen any major Large-scale distributed scenarios, therefore a more stable DLL dynamic loading architecture has not yet been developed, which 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 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 projects, large data and large logic. I am practicing this. I have already tasted the benefits of it. 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 criticized by other languages. We can even boldly say that other languages, from a comprehensive perspective (language, development environment, development efficiency, technical community, team collaboration, application capabilities), have fallen far behind .NET in the field of application-level development. 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.