客户端渲染 服务端渲染_这就是赢得客户端渲染的原因
客户端渲染 服务端渲染
A decade ago, nearly everyone was rendering their web applications on the server using technologies like ASP.NET, Ruby on Rails, Java, and PHP.
十年前,几乎每个人都使用ASP.NET,Ruby on Rails,Java和PHP等技术在服务器上呈现其Web应用程序。
Then handy libraries like jQuery showed up, and suddenly server-side rendering everything didn’t necessarily make sense anymore. jQuery was followed by a long list of client-side libraries like Backbone, Knockout, Angular, Ember, and React. With each iteration, client-side rendering grew easier and more powerful.
然后出现了像jQuery这样的方便的库,突然在服务器端呈现所有内容已不再有意义。 jQuery之后是一排客户端库,例如Backbone,Knockout,Angular,Ember和React。 在每次迭代中,客户端渲染变得更加轻松和强大。
This style goes by many names: Single page apps, SPAs, JAM stack…call it what you will. The point is, today, client-side rendering has become the de-facto way to build rich web applications…But why?
这种样式有很多名称:单页应用程序,SPA, JAM堆栈 …随便叫什么。 关键是,今天,客户端渲染已成为构建富Web应用程序的实际方法……但是为什么呢?
大家好,让我们一起努力吧 (Hey Everyone, Let’s Do It The Hard Way)
There’s no denying that client-side rendering is harder to do well. You have to think about bundling, transpiling, linting, cache busting, and so much more. Doing client-side right is so hard that I walk through over 40 decisions you need to make to get all this right in my new Pluralsight course.
无可否认的是客户端呈现是很难做的很好 。 您必须考虑捆绑,转码,整理,缓存破坏等等 。 正确地执行客户端方面的工作非常困难,以至于我要逐步完成40项决策,才能在我的新Pluralsight课程中做到所有这些。
So why are we subjecting ourselves to such pain? Because client-side rendering offers a long list of benefits that server-side rendering just can’t touch.
那么,为什么我们要承受这种痛苦呢? 由于客户端渲染提供了很多好处,因此服务器端渲染是无法触及的。
Here’s why client-side rendering won.
这就是赢得客户端渲染的原因。
无需重新加载整页 (No Full Page Reload Required)
With traditional server-side rendering, the server responds by generating and returning a completely new page for every interaction. This often slows load time, uses more bandwidth, and creates a less responsive user experience.
使用传统的服务器端渲染,服务器通过为每次交互生成并返回一个全新的页面来做出响应。 这通常会减慢加载时间,使用更多带宽,并导致响应速度较慢的用户体验。
Client-side rendering avoids making unnecessary requests for a full page when only a portion of the page has changed. This is especially helpful in a world that’s increasingly browsing via mobile networks with high latency.
客户端渲染避免了仅更改页面的一部分时对整个页面进行不必要的请求。 在当今世界越来越多地通过具有高延迟的移动网络进行浏览的情况下,这尤其有用。
延迟加载 (Lazy Loading)
Client-side rendering supports lazy loading sections of your application to save bandwidth & speed initial load. For example, you can load additional records, images, and ads as the user scrolls down, or as the user changes their search parameters, all without performing a full postback.
客户端渲染支持应用程序的延迟加载部分,以节省带宽并加快初始加载。 例如,您可以在用户向下滚动或用户更改搜索参数时加载其他记录,图像和广告,而无需执行完整的回发。
丰富的互动 (Rich Interactions)
Client-side rendering supports rich, animated interactions, transformations, and transitions. Fade a row out on delete, or fade a dialog into view. Sure, you can sprinkle such goodness into a server-rendered application, but this often leads to maintaining the same template on both the client and the server, or managing the complexity of weaving JavaScript interactions in with a server-side framework.
客户端渲染支持丰富,生动的交互,转换和过渡。 在删除时淡出一行,或将对话框淡入视图。 当然,您可以将这种优点撒到服务器呈现的应用程序中,但这通常导致在客户端和服务器上都维护相同的模板,或者管理将JavaScript交互与服务器端框架结合在一起的复杂性。
廉价托管 (Cheap Hosting)
Hosting static files is typically cheaper than hosting traditional server-side technologies like ASP.NET, PHP, or Ruby. You don’t need much horsepower to serve a static file. Serving static files is so cheap in fact, that a variety of solid free options exist including Surge, Firebase, and Netlify.
托管静态文件通常比托管传统的服务器端技术(例如ASP.NET,PHP或Ruby)便宜。 您不需要太多的精力来提供静态文件。 实际上,提供静态文件非常便宜,以至于存在各种固态免费选项,包括Surge , Firebase和Netlify 。
使用CDN (Use a CDN)
A static front-end can be hosted via a content delivery network (CDN). CDNs deliver improved performance by globally distributing assets as well as improved scalability by removing load from your webserver. The aforementioned static hosts utilize a CDN.
静态前端可以通过内容分发网络(CDN)托管。 CDN通过在全球范围内分配资产来提高性能,并通过减轻Web服务器的负载来提高可伸缩性。 前述静态主机利用CDN。
轻松部署 (Easy Deployments)
Static files are easy to deploy. You don’t necessarily need to perform a monolithic build to generate new binaries when a small change occurs. And with some of the aforementioned services like Surge and Netlify, you can easily create automated deployments via their provided CLIs. When you do so, you don’t risk breaking any of your back-end - it’s handled completely separately.
静态文件易于部署。 当发生微小变化时,您不必执行整体构建即可生成新的二进制文件。 借助上述某些服务,例如Surge和Netlify,您可以通过其提供的CLI轻松创建自动化部署。 这样做时,您不必冒任何后端折断的风险-完全分开处理。
强制分离问题 (Enforced Separation of Concerns)
Many teams struggle with keeping data access and business logic out of the user interface. With client-side rendering, separation of concerns is programatically enforced. There’s no way to directly hit the database. You have to make a call to a separate service. This helps foster a service-oriented mindset on development teams since there’s no way to make a short-cut and call the database directly from the UI.
许多团队努力将数据访问和业务逻辑限制在用户界面之外。 通过客户端渲染,以编程方式实现关注点分离。 无法直接访问数据库。 您必须致电一个单独的服务。 由于无法捷径直接从UI调用数据库,因此这有助于在开发团队上树立面向服务的思维方式。
学习一次,随处书写 (Learn Once, Write Everywhere)
Imagine you’re a new graduate. What is the only language that will allow you to build web applications, APIs, mobile applications, and desktop apps? JavaScript. Increasingly, that’s precisely what new grads are reaching for. Why should a new grad learn a dedicated server-side technology when JavaScript runs everywhere?
想象你是一个新毕业生。 什么是允许您构建Web应用程序,API,移动应用程序和桌面应用程序的唯一语言? JavaScript。 越来越多地,这正是新毕业生所要达到的目标。 当JavaScript随处可见时,为什么新毕业生应该学习专用的服务器端技术?
This is why it will continue to swallow the world.
这就是为什么它将继续吞没世界的原因。
JavaScript is like Visa. It’s everywhere you want to be.
JavaScript就像Visa。 它无处不在。
适用于Web,本机移动和桌面的相同UI技术 (Same UI Technology for Web, Native Mobile, and Desktop)
Imagine you want to build a SPA-style web application, a native mobile app, and a desktop app. Today’s modern JavaScript frameworks allow you to use the same UI technology for all three scenarios.
假设您要构建SPA风格的Web应用程序,本机移动应用程序和桌面应用程序。 当今的现代JavaScript框架允许您针对所有三种情况使用相同的UI技术。
For instance, you can use Angular, Ionic, and Electron, to work in Angular for all three targets. Or, you can use React, React Native, and Electron to work in React for all three targets. And the resulting applications will run on iOS, Android, Windows, and macOS. Sure beats learning Objective-C, Swift, Java, C#, WPF and more to support all these platforms!
例如,您可以使用Angular,Ionic和Electron在所有三个目标的Angular中工作。 或者,您可以使用React,React Native和Electron在所有三个目标的React中工作。 最终的应用程序将在iOS,Android,Windows和macOS上运行。 当然,要学习支持所有这些平台的Objective-C,Swift,Java,C#,WPF和更多内容,不胜枚举!
Edit — I had a point here about Progressive Web App support but was incorrect. You don’t need to do client-side rendering to build a PWA.
编辑 -这里我对渐进式Web应用程序的支持有一点,但不正确。 您无需进行客户端渲染即可构建PWA。
所以。 许多。 自由。 (So. Much. Free.)
JavaScript moves so fast that the hardest part of client-side rendering is choosing how you’re going to get it done. The number of free options is simply overwhelming and growing fast.
JavaScript动作如此之快,以至于客户端渲染中最困难的部分就是选择如何完成它。 免费选项的数量简直是压倒性的并且正在Swift增长。
Yeah, it’s a great problem. And there’s no need to pay for the libraries, frameworks and editors your team needs. I walk through and set up dozens of useful free tools in “Building a JavaScript Development Environment”. (free trial)
是的,这是一个很大的问题。 无需为团队所需的库,框架和编辑器付费。 在“ 构建JavaScript开发环境 ”中,我逐步学习并建立了数十个有用的免费工具。 ( 免费试用 )
服务器端渲染是否有意义? (Does Server-Side Rendering Make Sense Anymore?)
Sure. But in far fewer situations than before.
当然。 但情况比以前少得多。
If you need interactivity and can’t rely on JavaScript, then obviously client-side rendering is out.
如果您需要交互性且不能依赖JavaScript,则显然客户端渲染已不可用。
If you’re building a mostly static site, server-side rendering might be easier. Though awesome tools like Jekyll, Gitbook, Gatsby, and countless alternatives are encroaching on this area too. And since tools like these just generate static HTML, you don’t have to worry about SEO impacts either.
如果您要构建一个主要是静态站点,则服务器端渲染可能会更容易。 尽管诸如Jekyll , Gitbook , Gatsby之类的强大工具以及无数替代品也正在蚕食这一领域。 而且由于此类工具仅生成静态HTML,因此您也不必担心SEO的影响。
SEO is a common selling point for server-side rendering, but the advent of isomorphic/universal rendering in libraries like React has addressed this concern as well. Universal rendering used to be hard, but modern tools like Zeit’s next.js finally make this trivial as well!
SEO是服务器端渲染的常见卖点,但是在类似React的库中,同构/通用渲染的问世也解决了这一问题。 通用渲染曾经很难,但是像Zeit的next.js这样的现代工具最终也使它变得微不足道!
Given all the advantages above, I struggle to find good reasons to do traditional server-side rendering anymore.
鉴于以上所有优点,我很难找到充分的理由再进行传统的服务器端渲染。
Sure it’s still hard to do well. But for all the reasons above, client-side rendering won.
当然,仍然很难做好。 但是由于上述所有原因,客户端呈现才成功。
Cory House is the author of multiple courses on JavaScript, React, clean code, .NET, and more on Pluralsight. He is principal consultant at reactjsconsulting.com, a Software Architect at VinSolutions, a Microsoft MVP, and trains software developers internationally on software practices like front-end development and clean coding. Cory tweets about JavaScript and front-end development on Twitter as @housecor.
Cory House是JavaScript,React,干净代码,.NET等课程的多本课程的作者,并且还提供了有关Pluralsight的更多课程 。 他是reactjsconsulting.com的首席顾问, VinSolutions的软件架构师,Microsoft MVP,并且在软件开发方面对国际软件开发人员进行了培训,例如前端开发和简洁编码。 Cory在Twitter上以@housecor表示关于JavaScript和前端开发的推文 。
翻译自: https://www.freecodecamp.org/news/heres-why-client-side-rendering-won-46a349fadb52/
客户端渲染 服务端渲染
相关文章:

java多线程三之线程协作与通信实例
多线程的难点主要就是多线程通信协作这一块了,前面笔记二中提到了常见的同步方法,这里主要是进行实例学习了,今天总结了一下3个实例: 1、银行存款与提款多线程实现,使用Lock锁和条件Condition。 附加 :…

Java8中Lambda表达式的10个例子
Java8中Lambda表达式的10个例子 例1 用Lambda表达式实现Runnable接口 Java代码 //Before Java 8: new Thread(new Runnable() { Override public void run() { System.out.println("Before Java8, too much code for too little to do"); } }).start(); …
OC的对象的分类
OC的对象分类 一 oc的对象分类主要分为3种 1 instance 对象: 实例对象就是通过alloc 出来的对象,一个类每一次的alloc都会产生一个新的实例对象 StudentA *a [[StudentA alloc]init];StudentA *b [[StudentA alloc]init];// 打印结果如下 地址是明显…

如何在国内上medium_在Medium上写作的风格指南
如何在国内上mediumAfter spending more than 1,000 hours writing and editing stories for our Medium publication, I’ve decided to create this living style guide for contributors. Feel free to use it for your publication as well.在花了1000多个小时为我们的《中…

C# webform上传图片并生成缩略图
其实里面写的很乱,包括修改文件名什么的都没有仔细去写,主要是想记录下缩略图生成的几种方式 ,大家明白就好! 1 void UpImgs()2 {3 if (FileUpload1.HasFile)4 {5 string fileContentType FileUpload1.Pos…

ios中的自动释放池
自动释放池中是否有虑重功能 1 autoreleasepool { 2 UIView *view [UIView alloc] init] autorelease]; 3 [view autorelease]; 4 } 这样写在自动释放池的队列中是两个对象还是一个对象,就是说把view加到自动释放池的队列时,队列本身是…

arch linux安装_如何从头开始安装Arch Linux
arch linux安装by Andrea Giammarchi由Andrea Giammarchi In this article, youll learn how to install Arch Linux from scratch… and in about 5 minutes. So lets get to it.在本文中,您将学习如何从头开始安装Arch Linux,大约需要5分钟。 因此&am…

CoreCRM 开发实录 —— Profile
再简单的功能,也需要一坨代码的支持。Profile 的编辑功能主要就是修改个人的信息。比如用户名、头像、性别、电话……虽然只是一个编辑界面,但添加下来,涉及了6个文件的修改和7个新创建的文件。各种生成的和手写的代码,共有934行之…

iOS KVO 的实现原理
KVO 的实现原理 一 原理 1.KVO是基于runtime机制实现的 2.当某个类的属性对象第一次被观察时,系统就会在运行期动态地创建该类的一个派生类,在这个派生类中重写基类中任何被观察属性的setter 方法。派生类在被重写的setter方法内实现真正的通知机制 …
利用UltimateAndroid框架进行快速开发
UltimateAndroid是一套集成了许多现有优秀的Android开源类库并将之组合成一个整体的Android快速开发框架。框架目前主要包含的功能有View Injection,ORM,异步网络请求和图片加载,自动化脚本测试,磁盘LRU等功能.同时提供了类似于TripleDes、Webview快速设置、Md5处理…

溢出内容菜单_停止过度使用溢出菜单
溢出内容菜单by Daniel Burka丹尼尔伯卡(Daniel Burka) 停止过度使用溢出菜单 (Stop the overuse of overflow menus) You know those obscure menu buttons on apps and websites that reveal even more menu options? They usually have an ellipsis “…” or an arrow ▼…

KVC 和 KVO
KVC 键值编码 全称是Key-value coding,翻译成键值编码。它提供了一种使用字符串而不是访问器方法去访问一个对象实例变量的机制。 1.通过key(成员变量的名称)设置value(成员变量的值) - (void)setValue:(…

datasnap的客户端回传机制
最近,学习XE6下的DataSnap回叫技术编译代码,体会如下:第一篇 服务器与客户端回叫 从Delphi2010开始,DataSnap支持回叫(Call Back)机制。这样,在调用耗时较长的方法时,通过回叫机制…

Block 底层1
Block 本质来讲是OC 对象,其内部有一个isa指针。 1 Block 的声明 一言以蔽之: returnType ( ^blockName)(parameterTypes) ^returnType (parameters) {}; returnType 返回的类型 可以为Void,为Void的时候可以省略^blockName …

从零学web前端_从零到前端英雄(第2部分)
从零学web前端This article is part two of the “From Zero to Front-end Hero” series. In part one, you learned how to create layouts with HTML and CSS as well as some best practices. In part two, we will focus on learning JavaScript as a standalone language…

jdk8飞行记录器配置
jdk8提供了jmc工具,应该比visualvm厉害吧 下面贴一份tomcat的配置,自己留个备份,把下面的内容粘贴到tomcat setenv.sh就可以了 nowdaydate %Y%m%d_%H%M%S test -d ../gclogs || mkdir ../gclogsif [ -r "$CATALINA_BASE/bin/setenv_custom.sh" ]; then. "$CATAL…

petaPar培训文档
自己写的实验室程序文档,方便后来者。 转载于:https://www.cnblogs.com/daijkstra/p/3972167.html

Block 底层值__Block修饰符
__Block 修饰符 Block 想要改变外部的变量,必须要用__Block 来修饰自动变量。 根据内存地址可以看出来,__block 所修饰的变量,将外部的变量在栈中的内存地址放到了堆中。 // auto 自动变量的内存分配在栈区域 stack__block int meters 100…

体检系统前端源码_给您的前端进行健康检查
体检系统前端源码by Ewa Mitulska-Wjcik伊娃米图尔斯卡(EwaMitulska-Wjcik) 给您的前端进行健康检查 (Give your Front End a Health Check) You’ve built out all your user stories and your app is working. Now’s it’s ready to submit as done, so you can move on wi…

1-runtime的Method,IMP,Property,ivar
基础定义 objc-750 的tar包 objc-private.h 定义 typedef struct objc_class *Class; typedef struct objc_object *id;#if __OBJC2__ typedef struct method_t *Method; typedef struct ivar_t *Ivar; typedef struct category_t *Category; typedef struct property_t *ob…

【编程题目】左旋转字符串 ☆
26.左旋转字符串(字符串)题目:定义字符串的左旋转操作:把字符串前面的若干个字符移动到字符串的尾部。如把字符串 abcdef 左旋转 2 位得到字符串 cdefab。请实现字符串左旋转的函数。要求时间对长度为 n 的字符串操作的复杂度为 O…

10、同步机制遵循的原则_我要遵循的10条原则
10、同步机制遵循的原则by Haseeb Qureshi由Haseeb Qureshi 我要遵循的10条原则 (10 Principles I Want to Live By) I just came home from a vow of silence at a meditation center in northern California. It’s a strange feeling coming back to city life after five …

2-Runtime objc_object objc_class
一 NSObject NSObject是OC 中的基类,除了NSProxy其他都继承自NSObject interface NSObject <NSObject> { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wobjc-interface-ivars"Class isa OBJC_ISA_AVAILABILITY; #pragma …

Spring3.0 AOP 具体解释
一、什么是 AOP。 AOP(Aspect Orient Programming),也就是面向切面编程。能够这样理解,面向对象编程(OOP)是从静态角度考虑程序结构,面向切面编程(AOP)是从动态角度考虑程…

通过Appium获取Android app中webview
因为要测试Android app中嵌入的web页面,所以需要从native切换到webview。网上查了好多帖子,都用到类似下面代码: //判断是否有 WEBVIEWSet<String> contextNames driver.getContextHandles();for (String contextName : contextNames)…

javascript原理_JavaScript程序包管理器工作原理简介
javascript原理by Shubheksha通过Shubheksha JavaScript程序包管理器工作原理简介 (An introduction to how JavaScript package managers work) A few days ago, ashley williams, one of the leaders of the Node.js community, tweeted this:几天前,Node.js社区…

iOS base64 MD5
网络APP 只要涉及用户隐私的数据,均不能以明文传输。 一 base64 编码 将任意的二进制数据转为编码为 65个字符的组成。 0-9 a-z A-Z / 一共 65 个 字符 例如: 1 mac 自带 base64命令 可以将base64 编码的文件可以转换 –》将桌面上1.png 图片经过…

【面试虐菜】—— Oracle知识整理《收获,不止Oracle》
普通堆表不足之处: 表更新有日志开销表删除有瑕疵表记录太大检索较慢索引回表读开销很大有序插入难有序读出DELETE产生的undo最多,redo也最多,因为undo也需要redo保护全局临时表:1 高效删除记录基于事务的全局临时表commit或者ses…

每日成长17年1月
2017年1月 1月9号 一、学习了ice ice是一个跨平台调用程序,与语言无关的一个中间件,比如,可以通过java的代码调用 c应用程序的接口。 1月11号 一.学习了 struts2 spring mybatis 的配置。 1.首先是web.xml的配置,主要配置两…

网络安全从事工作分类_那么,您想从事安全工作吗?
网络安全从事工作分类by Parisa Tabriz由Parisa Tabriz 那么,您想从事安全工作吗? (So, you want to work in security?) Every once in a while, I’ll get an email from an eager stranger asking for advice on how to have a career in security …