充分利用 cpu_如何充分利用云

充分利用 cpu

Over the years, building and testing software that runs on physical servers has become the status quo. The database is the most important part of the application. Usually, it’s the only dependency an application has. Testing has become a no-brainer. Most of the tests are unit-tests and we run end-2-end tests manually or with Selenium to see if everything integrates properly.

多年来,构建和测试在物理服务器上运行的软件已成为现状。 数据库是应用程序中最重要的部分。 通常,它是应用程序唯一的依赖项。 测试变得轻而易举。 大多数测试是单元测试,我们手动或使用Selenium运行end-2-end测试,以查看是否一切集成正确。

Moving an application to the cloud is usually not too difficult. It will require some minor modifications. So why change anything to the way we build software?

将应用程序迁移到云通常并不难。 它将需要一些小的修改。 那么,为什么要改变我们构建软件的方式呢?

1.)本地和云之间的区别 (1.) The difference between on-prem and cloud)

In the end, every application runs on a computer. The cloud, and on-premise both depend on physical servers in a datacenter. The difference is who owns them, who’s responsible for maintenance, and who pays for them.

最后,每个应用程序都在计算机上运行。 云和内部部署均取决于数据中心中的物理服务器。 区别在于谁拥有它们,谁负责维护以及谁为它们付费。

In the cloud, servers are shared amongst customers. On-premise, the company owns its hardware. On the bottom line that makes a difference:

在云中,服务器在客户之间共享。 在内部,公司拥有其硬件。 最重要的是:

定价模式 (The pricing model)

Buying a server is a one-time investment. It’s a matter of buying the hardware, some operating system licenses, and probably a database license. That should be sufficient to run some applications for a couple of years.

购买服务器是一次性的投资。 这是购买硬件,一些操作系统许可证甚至是数据库许可证的问题。 这足以运行一些应用程序几年。

To get the most out of the investment, the server will probably run as many applications as possible. And it will probably always be “up”. Shutting it down is probably more expensive than shutting it down. The only thing it needs is electricity, and that’s not expensive.

为了充分利用投资,服务器可能会运行尽可能多的应用程序。 而且它可能永远都是“向上”。 关闭它可能比关闭它更昂贵。 它唯一需要的是电力,而且价格并不昂贵。

Cloud is different. The biggest difference is: You can pay as you go. Rent a server for a day, delete it when you’re done. You’ll be charged for a single day of usage, not for one physical machine.

云是不同的。 最大的区别是:您可以随用随付。 租用服务器一天,完成后将其删除。 您需要为一天的使用付费,而不是为一台物理计算机付费。

服务器维护 (Server maintenance)

To host a website on a server, for example. First, you’ll need a server with an operating system. Then, you’ll need to install and configure Apache or IIS. They require an operating system.

例如,将网站托管在服务器上。 首先,您需要一台带有操作系统的服务器。 然后,您需要安装和配置Apache或IIS。 他们需要一个操作系统。

In the Cloud, you don’t need a server to get a website up. Just purchase the application-runtime instead. You’ll get a place where your application runs without having to purchase and configure a server, nor do you have to patch, or secure the operating system. That’s done by the cloud-vendor. That saves a lot of time, resources, and money.

在云中,您不需要服务器即可建立网站。 只需购买应用程序运行时即可。 您将获得一个运行应用程序的地方,而无需购买和配置服务器,也不必修补或保护操作系统。 这是由云供应商完成的。 这样可以节省大量时间,资源和金钱。

Cloud doesn’t mean you can’t use Virtual Machines anymore. If you want, you can get one. But typically, they’re more expensive than using cloud-native components.

云并不意味着您不能再使用虚拟机。 如果需要,您可以选择一个。 但是通常,它们比使用云原生组件要贵。

Image for post

2.)充分利用云 (2.) Getting the best out of the cloud)

Moving to the cloud may be a matter of replacing the servers you have on-premise with virtual machines in the cloud. But a lift-and-shift approach has a down-side. It’s relatively expensive in the long run. Moving away from virtual machines to a more cloud-native approach creates opportunities and maybe cheaper.

迁移到云可能是用云中的虚拟机替换本地服务器的问题。 但是,升降换档方式有一个缺点。 从长远来看,它相对昂贵。 从虚拟机转向更具云原生的方法会带来机会,而且价格可能更低。

Cloud-native applications aren’t just cheaper to host, they’re cheaper to build too. Using off-the-shelve components vastly shortens the time it takes to build an application and thus gives a business a competitive advantage.

原生云应用程序不仅托管成本更低,而且构建成本也更低。 使用现成的组件可以极大地缩短构建应用程序所需的时间,从而为企业带来竞争优势。

使用云更快地构建软件 (Use the cloud to build software faster)

Nobody builds software from scratch anymore. Many generic parts of an application are available as an NPM- or a NuGet package. Cloud takes that to the next level:

没人再从头开始构建软件。 应用程序的许多通用部分都可以作为NPM-或NuGet包使用。 云将其提升到一个新的水平:

  • Software as a Service, the building blocks of a project

    软件即服务,项目的基础

    How many log-in screens have you built in your career? Finally, there’s no need to do so anymore. Such components are available as building blocks in the cloud. They provide user-management screens, MFA, and lots more. Auth0 and AD Connect offer this service for example. All you need to do is configure it, and wire it to your application.

    您的职业生涯中建立了多少个登录屏幕? 最后,不再需要这样做。 这些组件可作为云中的构建块使用。 他们提供用户管理屏幕,MFA等。 例如,Auth0和AD Connect提供此服务。 您所需要做的就是配置它,并将其连接到您的应用程序。

    Lots of functionality is available in the cloud. Functionality like logging in, sending e-mails and text messages, facial/object recognition APIs, Blockchain, billing, support-ticketing, you name it. Combining these components with open-source packages makes it possible to build an application with very few lines of code.

    云中提供了许多功能。 您可以命名为登录,发送电子邮件和文本消息,面部/对象识别API,区块链,计费,支持票证等功能。 将这些组件与开源软件包结合在一起,就可以用很少的代码行来构建应用程序。

  • Infrastructure- and Platform as a Service and containers, the building blocks of the infrastructureSetting up a SQL server or an Active Directory server is history. All of that is available as a service in the cloud or a Docker container.

    基础架构和平台即服务以及容器,基础架构的构建块设置SQL服务器或Active Directory服务器是历史。 所有这些都可以在云或Docker容器中作为服务使用。

    Infrastructure- and Platform as a Service and containers, the building blocks of the infrastructureSetting up a SQL server or an Active Directory server is history. All of that is available as a service in the cloud or a Docker container.

    基础架构和平台即服务以及容器,基础架构的构建块设置SQL服务器或Active Directory服务器是历史。 所有这些都可以在云或Docker容器中作为服务使用。

    A lot of products are available as a service or have been containerized. There are two ways of getting SQL Server up and running, for example. Either pull a Docker image and run it or get a managed instance on Azure. This applies to a lot of different services. As a result, often, there’s no need to configure, maintain, and pay for a virtual server anymore.

    许多产品都可以作​​为服务使用或已被包装。 例如,有两种启动和运行SQL Server的方法。 提取Docker映像并运行它或在Azure上获取托管实例。 这适用于许多不同的服务。 因此,通常不再需要配置,维护和购买虚拟服务器。

For a lot of applications, either the cloud or open-source provides the building-blocks of an application. That changes the way an application is built. It requires fewer lines of code to build a working application. And compared to on-premise code, a lot more code will invoke third-party APIs or store state somewhere.

对于许多应用程序,云或开源都提供了应用程序的构建块。 这改变了应用程序的构建方式。 只需很少的代码行即可构建可运行的应用程序。 与本地代码相比,更多代码将调用第三方API或将状态存储在某个地方。

Different services have different fees. In an early stage, it might be cheaper to store data in Azure Storage whereas when the amount of records increases, it might be more appealing to store (parts of) the data in a SQL Server instance. Applying patterns like Hexagonal/Ports-and-Adapters makes migrating easier.

不同的服务有不同的费用。 在早期阶段,将数据存储在Azure存储中可能会比较便宜,而当记录数量增加时,将数据(部分)存储在SQL Server实例中可能会更有吸引力。 应用六边形/端口和适配器之类的样式使迁移变得更加容易。

The down-sideThere’s a down-side, too. Your application has to be able to deal with services that are temporarily unavailable. Consuming SAAS products has an impact on the availability of the application. Most of the services have an uptime guarantee of 99.99%. But not every service will be down at the same moment. Imagine having an application that has a dependency on 3 services. The downtime is:

不利之处 也有不利之处。 您的应用程序必须能够处理暂时不可用的服务。 消费SAAS产品会对应用程序的可用性产生影响。 大多数服务的正常运行时间保证为99.99%。 但是,并非所有服务都会在同一时间关闭。 想象有一个依赖于3个服务的应用程序。 停机时间是:

99.99% * 99.99% * 99.99% = 99.97% uptime guarantee

99.99%* 99.99%* 99.99%= 99.97%的正常运行时间保证

The more services are used, the lower the uptime guarantee gets. That’s why circuit breakers and Event-Driven Architecture is applied in cloud-native software.

使用的服务越多,正常运行时间保证就越低。 这就是为什么将断路器和事件驱动架构应用于云原生软件中的原因。

通过不支付闲置资源节省资金 (Save money by not paying for idle resources)

Imagine running a web-store. Usually, it has a couple of thousand visitors a day. On Black Friday, millions of customers visit the site. Hosting an application in the cloud could pay off in this scenario.

想象一下经营一家网上商店。 通常,它每天有成千上万的访客。 在黑色星期五,数百万的客户访问该网站。 在这种情况下,将应用程序托管在云中可能会有所作为。

An on-premise configuration has a maximum capacity. The amount of hardware the business owns is probably an optimum between the cost of the hardware and the profit they will make with it. That might mean some potential customers are unable to visit the web-store on Black Friday because the server can’t handle the number of requests. It also means some of the servers the company owns have been purchased for the sole purpose of handling traffic on Black Friday. They’re idling for the rest of the year.

本地配置具有最大容量。 企业拥有的硬件数量可能是硬件成本与其将获得的利润之间的最佳选择。 这可能意味着某些潜在客户在黑色星期五无法访问网上商店,因为服务器无法处理请求数量。 这也意味着已购买了公司拥有的某些服务器,其唯一目的是在黑色星期五处理流量。 他们在今年剩下的时间里都闲着。

In the cloud, it’s possible to scale up and down, vertically and horizontally whenever you want. As a result, it’s possible to scale up to the capacity needed to serve the site to every potential customer on Black Friday, and scaling down the next day. That way, the company can serve the site to every customer without having to pay for that capacity for the rest of the year.

在云中,您可以随时随地在垂直和水平方向上进行缩放。 因此,可以在黑色星期五将规模扩大到为每个潜在客户提供站点服务所需的容量,并在第二天缩减规模。 这样,公司可以为每个客户提供站点服务,而无需在剩余的时间里为该容量付费。

Horizontal scalingJust like on-premise, there’s a maximum to the vertical scale of a resource in the cloud. Under the bonnet, there’s always a physical server that has a limited number of CPUs.

水平扩展与内部部署一样,云中资源的垂直扩展最大。 在引擎盖下,总是有一个物理服务器,其CPU数量有限。

The difference is in scaling horizontally. Cloud vendors have a vast amount of hardware available, allowing clients to scale horizontally, almost endlessly. An application doesn’t scale horizontally out of the box. It needs to be built in a certain way. How to, depends on the nature of an application, but commonly, APIs are made stateless, and read-, and write operations are separated with the CQ(R)S pattern. These patterns make it possible to use replica’s of the data sources for querying, decreasing the number of operations the main data source needs to process. To ensure every request can be processed, write-operations are queued.

区别在于水平缩放。 云供应商拥有大量可用的硬件,允许客户端几乎无限地水平扩展。 应用程序无法横向扩展。 它需要以某种方式构建。 如何使用取决于应用程序的性质,但通常使API成为无状态的,并且使用CQ(R)S模式将读写操作分开。 这些模式使得可以使用数据源的副本进行查询,从而减少了主数据源需要处理的操作数量。 为了确保可以处理每个请求,将写操作排队。

Relational databases don’t scale well. Consider using a NoSQL database instead.

关系数据库无法很好地扩展。 考虑改用NoSQL数据库。

通过最小化部署的影响来改善用户体验 (Improve user experience by minimizing the impact of deployments)

Imagine running an international webshop. Typically, when you’re deploying a new version, it’s a good practice to take the current version offline when the newer version is up and running. But how do you know it’s up? Is it up when a given endpoint returns a 200 OK? Or is it up if customers keep ordering products on the webshop?

想象一下,经营一家国际网上商店。 通常,在部署新版本时,最好的做法是在新版本启动并运行时使当前版本脱机。 但是你怎么知道它上升了呢? 给定的端点返回200 OK时是否正常? 还是客户继续在网上商店订购产品呢?

Being able to run multiple versions of the same software makes it possible to serve the newer version of the software to a small number of end-users. Undo the deployment automatically if the newer version causes issues that haven’t been identified during the testing process. Monitoring the conversion-points on the website makes will tell if the newer version of the software is still functioning correctly. In the example of the webshop, an indicator could be: Are people still ordering products? If they aren’t, roll back the deployment!

能够运行同一软件的多个版本使向少数最终用户提供该软件的较新版本成为可能。 如果较新版本导致测试过程中未发现问题,则自动撤消部署。 监视网站上的转换点将告知该软件的较新版本是否仍在正常运行。 在网上商店的示例中,指标可能是:人们是否还在订购产品? 如果不是,请回滚部署!

These concepts (blue-green, ring-based, and canary releasing) have been around for some time. They aren’t cloud-specific concepts, but they’re easy to apply in the cloud and they minimize the impact of deployments. As a result, potential issues have a much smaller impact on the business.

这些概念(蓝绿色,基于环的和金丝雀释放)已经存在了一段时间。 它们不是特定于云的概念,但是它们很容易在云中应用,并且可以最大程度地减少部署的影响。 因此,潜在问题对业务的影响要小得多。

Image for post

3.)它如何影响软件和测试 (3.) How it impacts the software and the tests)

To build an application faster, to deploy it smarter, and to scale it more efficiently, the software can’t be built the same way on-premise oriented applications are built. To get the most out of the cloud, it needs to have the following characteristics:

为了更快地构建应用程序,更智能地部署应用程序并更有效地进行扩展,不能以与构建面向内部的应用程序相同的方式来构建软件。 为了充分利用云,它需要具有以下特征:

  • It needs to be backward compatible, to support running different versions simultaneously.

    它需要向后兼容,以支持同时运行不同版本。
  • Read- and write operations need to be separated to support horizontal scaling.

    读写操作需要分开以支持水平缩放。
  • APIs need to be stateless to support horizontal scaling.

    API必须是无状态的,以支持水平缩放。
  • The application needs to cope with the fact that parts of the infrastructure may be temporarily unavailable.

    该应用程序需要处理部分基础架构可能暂时不可用的事实。
  • The tests need to be quick enough to support deploying multiple versions of the software a day

    测试必须足够快以支持每天部署多个版本的软件

常见模式 (Common patterns)

On-premise, when a server is down, every application on the server is down. With cloud-native applications, that’s not the case anymore. Probably, only a little part of the infrastructure will be down. When the application is built right, just a little part of it is impacted. And by having multiple small applications, instead of one giant application, the impact of an outage may even smaller.

在本地,当服务器关闭时,服务器上的每个应用程序都关闭。 对于云原生应用程序,情况已不再如此。 可能只有一小部分基础架构将崩溃。 正确构建应用程序后,只会影响一小部分。 而且通过拥有多个小型应用程序(而不是一个大型应用程序),中断的影响可能会更小。

Assume we’re still running a webshop and there’s a database outage. Normally, it would be impossible for a customer to complete his order in that case. It can’t be stored in the database. Event-Driven Architecture makes the application more robust. Event-Driven applications treat the event of a customer completing his order is an “event”, which is stored in a queue. If the database is down, the event can’t be processed and will be saved so it can be retried later.

假设我们仍在运行网上商店,并且数据库中断。 通常,在这种情况下,客户将无法完成其订单。 无法将其存储在数据库中。 事件驱动的体系结构使应用程序更强大。 事件驱动的应用程序将客户完成其订单的事件视为“事件”,存储在队列中。 如果数据库关闭,则无法处理该事件并将其保存,以便以后可以重试。

There are several ways to build an Event-Driven application. Commonly, Command Query Responsibility Segregation is applied, meaning one part of the application is responsible for processing all write operations, and another is responsible for handling all read operations. The read operations use a separate, dedicated read-model; a queryable representation of the main data source of the application.

有几种方法可以构建事件驱动的应用程序。 通常,应用命令查询责任隔离 ,这意味着应用程序的一部分负责处理所有写入操作,而另一部分负责处理所有读取操作。 读取操作使用单独的专用读取模型。 应用程序主数据源的可查询表示形式。

The write-part of CQRS works with events, event-handlers, commands, and command-handlers. By increasing the number of nodes that process these commands and events, by introducing replicas of the read-model, and by increasing the number of nodes that process the read operations, the application scales horizontally, endlessly.

CQRS的写部分可用于事件,事件处理程序,命令和命令处理程序。 通过增加处理这些命令和事件的节点的数量,通过引入读取模型的副本,以及通过增加处理读取操作的节点的数量,应用程序可以无限地水平扩展。

The tricky part is to model the commands and events correctly. Often, people use Domain-Driven Design to create the model.

棘手的部分是正确建模命令和事件。 人们经常使用域驱动设计来创建模型。

持续交付? 逐步交货! (Continuous Delivery? Progressive delivery!)

Backward compatibility doesn’t have that big an impact on the software itself. It impacts the software delivery process. The database is usually the dependency that needs to be backward compatible. Removing a column isn’t a matter of just dropping it anymore. When two different versions are used simultaneously, they write data to the same data source differently. The software needs to cope with that. As a result, it takes quite some releases to change a data-schema.

向后兼容性对软件本身没有太大影响。 它影响软件交付过程。 数据库通常是需要向后兼容的依赖项。 删除列不再只是删除它的问题。 当同时使用两个不同的版本时,它们以不同的方式将数据写入同一数据源。 该软件需要解决。 结果,要花费大量的时间来更改数据架构。

To change a database in a backward-compatible way, use a method called Expand and Contract or Parallel Change and approach releasing the software differently.

要以向后兼容的方式更改数据库,请使用称为扩展和收缩或并行更改的方法 并以不同方式发布软件。

Typically, a release contains one or more features. With Expand and Contract, it takes five releases to change a database-schema. As a result, it takes at least five releases to create a new feature. In other words:

通常,发行版包含一个或多个功能。 使用Expand and Contract,需要五个发行版来更改数据库架构。 结果,至少需要五个版本才能创建新功能。 换一种说法:

Release != feature

发布!=功能

Having backward-compatible versions of the software makes it possible to do:

具有该软件的向后兼容版本可以实现以下目的:

  • Canary releasing

    金丝雀释放

    Bring a new version to production and introduce it to a small group before deploying it to all of the end-users. Get real user feedback and be sure the new release doesn’t cause trouble.

    将新版本投入生产并将其介绍给一个小组,然后再将其部署到所有最终用户。 获得真实的用户反馈,并确保新版本不会造成麻烦。

  • Blue-green deployments

    蓝绿色部署

    Deploy new versions of the software anytime a day without causing downtime.

    每天随时部署新版本的软件,而不会造成停机。

  • Dark-launching

    暗发射

    Ship new functionality to a small group of end-user and get real user feedback.

    向少数最终用户提供新功能,并获得真实的用户反馈。

测试中 (Testing)

In many cases, an end-2-end-test requires a system to be in a given state. To get it in that state, usually, database scripts populate the database with test data.

在许多情况下,最终2项最终测试要求系统处于给定状态。 为了使它处于这种状态,通常,数据库脚本会用测试数据填充数据库。

Having multiple, smaller applications, which all have their own (type of) data-source, makes end-2-end testing very complicated. Every individual microservice needs to be set-up differently.

拥有多个较小的应用程序,每个应用程序都有自己的(数据类型)数据源,这使得端到端的测试非常复杂。 每个单独的微服务都需要进行不同的设置。

And cutting big application into small ones, and deploying it frequently introduces a problem: Versions… Every environment will have different versions of the software all the time. And if it has the correct version today, it’s will be replaced with a newer one tomorrow.

将大型应用程序分解为较小的应用程序并进行部署经常会带来一个问题:版本…每个环境始终会具有不同的软件版本。 如果今天的版本正确,则明天将替换为较新的版本。

To cope with that, the test suite needs to have the following characteristics:

为了解决这个问题,测试套件需要具有以下特征:

  • Daily releases are impossible if the testing process takes longer than a day. The faster the test-suite, the better. The test-suite needs to be able to run in less than half a day.

    如果测试过程需要一天以上的时间,则不可能每天发布。 测试套件越快越好。 测试套件需要能够在不到半天的时间内运行。
  • Maintenance of the test cannot take longer than half a day.

    测试的维持时间不能超过半天。
  • They can guarantee working software, end to end, in every environment (even in production)

    他们可以保证在每个环境(甚至在生产环境)中都能端到端运行软件

Maintenance to an end-2-end test makes changing the software fast, and frequently they’re too complex. There’s a new alternative: Contract testing. As a result, every individual application gets its testing pyramid which looks like this:

维护端到端2个测试可以快速更改软件,而且它们过于复杂。 有一个新的替代方法: 合同测试 。 结果,每个单独的应用程序都会获得其测试金字塔,如下所示:

Image for post

Being able to run different versions of the software opens another door. Testing changes into a process you do in production, too. By being able to run different versions of the same software it’s now possible to:

能够运行不同版本的软件打开了另一扇门。 也测试变更到您在生产中所做的过程。 通过能够运行同一软件的不同版本,现在可以:

  • Do dark launches

    做暗发射
  • Do A/B testing

    做A / B测试
  • Ring based deployments

    基于环的部署
  • Canary releasing

    金丝雀释放
  • And so forth…

    依此类推...

摘要 (Summary)

Cloud is more than server virtualization. In fact, for many applications, there’s no need to have a server at all. Cloud vendors offer infrastructure as a service. All you need to do is select the components the application needs, and the cloud vendor supplies it. It’s a lot cheaper, too.

云不仅仅是服务器虚拟化。 实际上,对于许多应用程序,根本不需要服务器。 云供应商提供基础架构即服务。 您需要做的就是选择应用程序所需的组件,然后由云供应商提供。 也便宜很多。

Because you’re not owning any hardware, when you’re in the cloud, it’s possible to scale up, and down, whenever need be. That way, you can always get the capacity you need at a particular moment.

由于您没有任何硬件,因此当您在云中时,可以在需要时进行向上和向下扩展。 这样,您始终可以在特定时刻获得所需的容量。

The cloud offers software as a service, too. Building your own log-in screen may be a thing of the past. Selecting the components you need to build your application, makes building the software a lot simpler.

云也提供软件即服务。 建立自己的登录屏幕可能已成为过去。 选择构建应用程序所需的组件,使软件的构建变得更加简单。

Build applications differently to exploit the possibilities of the cloud.

以不同的方式构建应用程序以利用云的可能性。

  • Use Event-Driven Architecture and CQRS to be able to scale horizontally

    使用事件驱动架构和CQRS可以水平缩放
  • Apply Domain-Driven Design to cut your monolith into little pieces

    应用域驱动设计将整块切割成小块
  • Stop releasing when a feature is done, release all the time

    完成功能后停止发布,一直发布
  • Do not use E2E testing, use Contract Testing instead

    不要使用E2E测试,而是使用合同测试

接下来做什么 (What to do next)

Applying Domain-Driven Design, CQRS and the testing pyarmid is complex. Read how to, and find example code in the following articles:

应用域驱动设计,CQRS和测试pyarmid非常复杂。 阅读方法,并在以下文章中找到示例代码:

翻译自: https://medium.com/vx-company/how-to-get-the-most-out-of-the-cloud-eb1b8b2826fe

充分利用 cpu

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
WTL9.1-ReadMe-中英文对照版 Windows Template Library - WTL Version 9.1 (build 5270) 2015-09-27 Windows模板库 - WTL Version 9.1 (build 5270) 2015-09-27 (水平有限,不足之处,欢迎指正交流:[email protected]) ________________________________________ Copyright © 2015 Microsoft Corporation, WTL Team. All rights reserved. 微软公司WTL小组2015注册版权所有,Copyright © 2015。 This file is a part of the Windows Template Library. 该文档是WTL的一部分。 The use and distribution terms for this software are covered by the Microsoft Public License (http://opensource.org/licenses/MS-PL) which can be found in the file MS-PL.txt at the root folder. WTL的使用和分发受微软公共授权协议约束 (http://opensource.org/licenses/MS-PL),具体内容可以查看本发布根目录下的MS-PL.txt文件。 ________________________________________ Welcome to the Windows Template Library, version 9.1. This document contains the following topics: 欢迎使用Windows模板库WTL 9.1。该文档包含以下项目: • Introduction • WTL介绍 • Features and Installation • 功能和安装 • Packing List • 压缩包中的文件列表 • Class Overview • 类简介 • ATL/WTL AppWizard • ATL/WTL应用程序向导 • Support for Windows CE • Windows CE支持 • Support for Visual C++ Express • Visual C++ Express支持 • Notes • 说明 • Changes Between WTL 9.1 and 9.0 • WTL 9.1对9.0 的改变 • Changes Between WTL 9.0 and 8.0 • WTL 9.0对8.0的改变 • Changes Between WTL 8.0 and 7.5 • WTL 8.0对7.5的改变 • Changes Between WTL 7.5 and 7.1 • WTL 7.5对7.1的改变 • Changes Between WTL 7.1 and 7.0 • WTL 7.1对7.0的改变 • Changes Between WTL 7.0 and 3.1 • WTL 7.0对3.1的改变 • Changes Between WTL 3.1 and 3.0 • WTL 3.1对3.0的改变 Introduction WTL介绍 Windows Template Library, or WTL, is a set of classes that extend ATL to support more complex user interfaces for either applications or various UI components, while maintaining the big advantage of ATL - small and fast code. WTL classes were designed to be the best and the easiest way to implement rich Win32 based UI for ATL based applications, servers, components, and controls. WTL(Windows Template Library)是一种ATL扩展类库,它能为应用程序及各种控件提供更复杂的用户界面支持,同时保持ATL简洁快速的优点。WTL类库被设计为ATL实现广泛Win32用户界面的最简最优方式,支持各种应用程序、服务程序、组件和控件。 WTL provides support for implementing many user interface elements, from frame and popup windows, to MDI, standard and common controls, common dialogs, property sheets and pages, GDI objects, UI updating, scrollable windows, splitter windows, command bars, etc. The WTL classes are mostly templated and use minimal instance data and inline functions. They were not designed as a framework, so they do not force a particular application model, and can accommodate any. The classes do not use hooks or thread local storage, so they have no restrictions that those techniques impose. They also have no inter-dependencies and can be freely mixed with straight SDK code. In summary, WTL delivers very small and efficient code, very close in size and speed to SDK programs, while presenting a more logical, object oriented model to a programmer. WTL为众多用户界面元素提供支持,包括框架窗口和弹出窗口、MDI、标准和通用控件、通用对话框、属性表单和属性页、GDI对象、用户界面更新、可滚动窗口、分割窗口、命令条等等。WTL类尽量模板化,使用较少实例数据和较多内联函数。它们并非设计为一个框架,所以并不强制使用特殊应用模式,可以适应各种场合。这些类并未使用hooks(钩子程序)或线程本地存储技术,所以没有植入技术改进的限制。它们也不存在内部依赖性,可以自由地和SDK代码一起混合使用。总之,WTL提供最小最高效的代码,非常接近SDK的体积和速度,同时为程序员提供更强逻辑性和面向对象的特性。 Features and Installation 功能和安装 This is the eigth public release of WTL, after WTL 3.0, 3.1, 7.0, 7.1, 7.5, 8.0, and 9.0. This version is released under the Microsoft Public License, enabling developers from the WTL community to contribute to the library. WTL9.1是在3.0、3.1、7.0、7.1、7.5、8.0和9.0之后的第8个公开发布版本。这个版本基于微软公共授权协议,可以从WTL社区获取公共发布的WTL库进行授权开发。 WTL classes can be used with either VC++ 6.0, VC++ .NET 2002 or 2003, VC++ 2005 or 2008 or 2010 or 2012 or 2013 or 2015, or EVC++ 4.0 or 3.0. AppWizard for Visual Studio is included. WTL类库可以在下列开发环境中使用,VC++ 6.0,VC++ .NET 2002、2003,VC++ 2005、2008、2010、2012、2013、2015,以及EVC++ 3.0、4.0。WTL类库为Visual Studio提供应用程序向导组件。 The WTL classes are provided in header files located in the include directory. The only header files that must be included is atlapp.h, while others can be used when needed. The name of the file doesn't mean that you have to create an application, just that atlapp.h contains base definitions required for WTL projects. WTL类库以存放于include目录中的头文件的方式提供。只有atlapp.h是必须包含的头文件,其余头文件可按需包含引用。该文件的名称并非意味着你必须创建一个应用程序,atlapp.h只是包含了WTL所需的基本定义项目。 To install WTL, just copy the whole directory structure, or unpack the archive file, to the location of your choice. Please be sure to add the WTL\include directory to the list of include directories in VC++, so that the compiler can find them when you include them in your projects. 安装WTL,只需拷贝整个目录内容或解压所需文件到你所选定的路径。请务必在VC++环境中添加WTL的include包含目录,好让编译器能够找到你工程中的包含文件。 Setup programs for the AppWizard are provided. After executing the setup script, ATL/WTL AppWizard will appear in the list of AppWizards when you select File.New.Project in VC++ IDE. The file AppWiz\setup.js is the setup script for all supported versions of Visual Studio, while AppWizards for Windows CE have separate scripts for VS2005 and VS2008 SmartDevice projects. WTL安装包中提供了应用程序向导的安装程序。通过运行安装脚本,在VC++集成开发环境中从“文件|新建|工程”菜单新建项目时,在应用程序向导列表中将会出现ATL或WTL选项。AppWiz\setup.js文件是支持所有版本的Visual Studio的安装脚本。另外,WTL为支持Windows CE下VS2005、VS2008智能设备工程的应用程序向导,提供了单独的安装脚本。 To manually install AppWizard for VC++ .NET 2002/2003, copy all WTLAppWiz.* files from AppWiz\Files to VC++ .NET projects directory, %VC7DIR%\Vc7\vcprojects, where %VC7DIR% is the directory where VC++ .NET 2002/2003 is installed. After that, open WTLAppWiz.vsz and modify the like that contains ABSOLUTE_PATH to contain %WTLDIR%\AppWiz\Files, where %WTLDIR% is the directory where WTL files are. 要为VC++ .NET 2002/2003手工安装应用程序向导,可从AppWiz\Files目录拷贝所有WTLAppWiz.*文件到VC++ .NET工程目录%VC7DIR%\Vc7\vcprojects,%VC7DIR%是VC++ .NET 2002/2003的安装目录。然后,打开WTLAppWiz.vsz文件修改ABSOLUTE_PATH指向%WTLDIR%\AppWiz\Files,%WTLDIR%是WTL文件的存放目录。 Platform support and requirements: 支持和请求的平台: Compiler/IDE/ATL: 编译器、集成开发环境、ATL: Visual C++ 6.0 (ATL 3.0) Visual C++.NET 2002 (ATL 7.0) Visual C++.NET 2003 (ATL 7.1) Visual C++ 2005 (ATL 8.0) Visual C++ 2008 (ATL 9.0) Visual C++ 2010 (ATL 10.0) Visual C++ 2012 (ATL 11.0) Visual C++ 2013 (ATL 12.0) Visual C++ 2015 (ATL 14.0) SDK (optional): SDK(可选): Any Platform SDK from January 2000 release up to the latest Windows SDK 支持2000年1月及之后发布的所有平台下的Windows SDK。 Windows CE development: Windows CE开发: eMbedded Visual C++ 3.0 - Pocket PC, Pocket PC 2002 eMbedded Visual C++ 4.0 - STANDARDSDK_410, Pocket PC 2003, Smartphone 2003, STANDARDSDK_500, Pocket PC 2003 SE, Smartphone 2003 SE Visual C++ 2005 - Pocket PC 2003 SE, Smartphone 2003 SE, STANDARDSDK_500, Windows Mobile 5.0 (Pocket PC and Smartphone), Windows Mobile 6.0 (Standard and Professional) Visual C++ 2008 - Pocket PC 2003 SE, Smartphone 2003 SE, STANDARDSDK_500, Windows Mobile 5.0 (Pocket PC and Smartphone), Windows Mobile 6.0 (Standard and Professional)

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值