zoukankan      html  css  js  c++  java
  • 由 container 一词所想到的

    年轻时,喜欢时事类的资讯,现在也依然。

    今天看一篇文章,提到当年美国对苏联实行“遏制”,用的 container 一词。心中忽然一动。

    这不是 js 中的 容器么一词么?

    都出现在哪些相关的 js 中呢?

    1, css 框架:bootstrap

    .container在bootstrap中几乎是无处不在的

    2, 在 js 中,对象即是容器,里面装了0 至 N 个属性

    对象是属性的容器,其中每个属性都拥有名字和值。属性的名字可以是包括空字符串在内的任意字符串。属性的值可以是除 undefined 值之外的任何值。

    (摘自js精粹中文版 p34)

    Note:再次读到这句话,理解更深入一层!

    3. 上面是js中对对象的描述。

    回想自己,初次接触到对象一词,是在 powershell实战一书中,立马又找了出来,看看里面是怎么描述的:

    An object is a unit that contains both data (properties)and the information on how to use that data (methods).

    (对象,是这样一种单位,它同时包含了数据(属性)以及如何使用数据的信息(即方法))

    Let’s look at a simple example. In this example, you’re going to model a lightbulb as an object. This object would contain data describing its state—whether it’s off or on.

    (来看个简单的例子,在这个例子中,你将把一个灯光来模拟成一个对象。这个对象将 拥有(contain)描述它状态的数据-灯泡是亮着的还是关着的。)

    It would also contain the mechanisms or methods needed to change the on/off state. Non-object-oriented approaches to programming typically put the data in one place,

    (它还应该 包含(contain)一种机制或者说方法来改变开/关状态。非面向对象的编程方法通常会把数据放在单独的一个地方)

    perhaps a table of numbers where 0 is off and 1 is on, and then provide a separate library of routines to change this state. To change its state, the programmer would have

    (可能是一个数字表格,0表示关,1表示开,再提供一个单独的库方法来改变这状态。要改变灯光的状态,程序员需要)

    to tell these routines where the value representing a particular light bulb was. This process could be complicated and is certainly error prone. With objects, because both the

    (告诉方法特定的灯光状态值保存在什么地方。这个处理过程应该会很复杂而且容易出错。有了对象,因为)

    data and the methods are packaged as a whole, the user can work with objects in a more direct and therefore simpler manner, allowing many errors to be avoided.

    (数据和方法都被打包成一个整体了,用户可以用一种更直接和简单的方式来用对象处理,同时能避免大多数错误)

    (摘自 windows powershell实战(第2版) p11)

    Note:几年前,看这段文字的时候,我的英文阅读能力和编程水平一样低下,现在再来看,一切是那么的豁然开朗。

  • 相关阅读:
    如何查找YUM安装的JAVA_HOME环境变量详解
    Linux下设置和查看环境变量
    jar包部署脚本
    CentOS7开启防火墙及特定端口
    nohup 命令(设置后台进程): appending output to ‘nohup.out’ 问题
    重点|183道Java面试题可以说很详细了
    JVM性能调优
    【Notepad++】notepad++主题和字体设置(非常好看舒服的)
    spring-boot-maven-plugin 安装本地jar 包
    UserAgentUtils 获取浏览器信息
  • 原文地址:https://www.cnblogs.com/sx00xs/p/6422112.html
Copyright © 2011-2022 走看看