Thoughts and exploration on using .NET for Internet development

Y2J
Release: 2017-04-17 14:38:41
Original
1804 people have browsed it

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 have no measures to deal with even the simplehttpinterfacesecurity, and many beautiful responsive websites, The directory structure is stacked randomly. This is really an evil trend. I think programmers should 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 victories of countless technical experts who have repeatedly reconstructed them in long-term practice. As a .NET veteran, I am deeply gratified to see Microsoft embrace open source and embrace the changes and progress brought about by the community over the years. So today, I want to share with you how I and my company have used it over the years. Some experience and technical summary of .NET Web development and even Internet application development.

Let’s first look at a typical case recently launched, muban.printhelloworld.com, which uses tools such as HTML5, Bootstrap, EF6 For MySql, Alibaba Cloud RDS, Alibaba Cloud CDN and other new technologies and concepts, however, they are not separated from the use of .NET for development and the .NET ecological environment (IIS, Windows Server) for deployment, but the entire development process has completely got rid of WebForm or even MVC. We have practiced a new .NET development model, which has greatly improved development efficiency and team collaboration. The development time has also been 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 is objective: ASP.NET WebForm drag and eventdriver Although the innovation of the Web development model facilitated the learning and understanding of a large number of .NET beginners, it ultimately seriously hindered the popularization and commercial use of .NET. Moreover, for a long time, .NET's excellent language features Without attention, it has been 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 allows developers to understand the nature of HTTP and the Web. The understanding of MVC is undoubtedly covered with a layer of fog, which is a setback in the long run. 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 problems. There are various self-righteous features, bindings, shortcuts, etc. that have been thought out in advance for developers. Junior developers may find these things very convenient, but I think that anyone who has been engaged in commercial projectarchitectureand development Technical managers will have a deep feeling that in solid projects that really need stability, 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 want to talk about it first:

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

 1. Instead of using WebService, HTTP is widely used as a method of data communication

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

3. The Web front-end will use third parties such as Bootstrap, JQueryUI, EasyUI, etc. HTML5 Framework

4. There are APP needs, or even APP priority needs. APP needs to connect to various third-party plug-ins

5. In order to pursue the rapid launch of APP, there are Sometimes the HTML5 APP development model will be adopted, 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. The development cycle is short and iteration is frequent

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

9. The project team personnel requirements are determined by the Web development engineer and detailed Divided into HTML5 front-end engineers, JAVA (.NET) engineers, database engineers, etc.

10. Unit tests are reduced, and there are more and more functional tests, and they are even replaced by Internet tools (worktile, etc.) Professional testing tools

Based on the above situation, we consider that if we still use .NET 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 and complicated 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 , you should no longer consider .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 it is internal

installationTFS Express version or applying for free space on tfs.visualstudio.com, can facilitate team collaboration. Based on our practice From this point of view, don’t be carried away by the Git mode. In fact, the TFS management mode is the most suitable for .NET development

3. The use of .NET high-level language features should be strengthened. On the basis of understanding, if Being able to skillfully use high-quality language features and methods unique to .NET such as Linq, Lamda

expression, reflection, and Task parallelprogramming 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, coupled with the Core mode of Server 2008 and 2012, strengthen 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, 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 back end is purely Business logic processing, including logic processing and data processing. At present, because our project uses the Routing feature in ASP.NET, it is still hosted in the ASP.NET model and IIS. In theory and in the near future, it will be replaced by Core IIS or Nginx under Linux Hosting pure HTML5 and HTMl5caching 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 such as files, graphics, images, audiovideo, and geographical location will become It is 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 problems of fully compatible layout and responsive layout that trouble many web engineers.

 4. Front-end developmentObject-oriented

The front-end development is simply encapsulated through the JS object-oriented features, and the Dom element operation and business The processing of logical data requests is consistent with the back-end data type, entity structure and processing logic. This not only brings closer the understanding of business needs between front-end and back-end developers, but also greatly reduces the technical cost. The threshold of training has improved 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 logicbehavior has a uniqueroutingName, the business logic is only responsible for the routing name, and 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 the remaining 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, which of course meets the demand for HTTP service. , Wen API is also a bit heavy and will continue to be improved 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. Therefore, in the early stage of project design, the construction of distributed HTTP services is crucial. The business Update needs to be able to perform hot loading. In the .NET system, it is the dynamic loading and use of DLL managed code. Unfortunately, since the company's existing projects do not have 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 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 detailed content of Thoughts and exploration on using .NET for Internet development. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!