技术控

    今日:67| 主题:49270
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Smalltalk and protein programming

[复制链接]
梦中所念 发表于 4 天前
46 1

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Analogies to help understand Eve

   Welcome to Part IV of my VI-part series about Eve , an exciting and fascinating new programming language.
         
Smalltalk and protein programming-1 (foundation,understand,references,developed,released)
      
       
  •   I. How Eve unifies your entire programming stack   
  •   II. When logic programming meets CQRS   
  •   III. Throwing off our scope chains   
  • IV. Smalltalk and protein programming    
  • V. The rock-solid foundation for Eve’s big vision (Monday 12/5)   
  • VI. Why Eve will be perfect for realtime apps (Thursday 12/8)  
  Smalltalk with stateless APIs

   One of Eve’s influences is Smalltalk , an innovative programming language developed at Xerox PARC and released in 1980. In Smalltalk, a running program consists of objects, each with their own independently-programmed behavior, passing messages to one another.

Smalltalk and protein programming-2 (foundation,understand,references,developed,released)
       Wikipedia explains that a Smalltalk object can do exactly three things:
  1. Hold state (references to other objects).
  2. Receive a message from itself or another object.
  3. In the course of processing a message, send messages to itself or another object.
   From 30,000 feet, Eve looks like Smalltalk because both kinds of programs are made out of self-contained chunks of code that can be dropped into a program, even while the program is running, which is called live programming .
  But once you zoom in and look at what the specific blocks are doing, the similarity breaks down: Smalltalk objects persist state between messages in lexical scope chains, while Eve blocks can only persist state between timesteps by writing to global databases.
   Instead of comparing Eve blocks to Smalltalk objects, it’s more accurate to compare them to API handlers , those blocks of server-side application-layer code that handle client requests to API endpoints.
  More precisely, Eve is similar to so-called “stateless” API handlers (ones that don't persist in-memory state between requests). Stateless API handlers are only allowed to do the following:
  
       
  • Read from a request buffer   
  • Manipulate local variables   
  • Manipulate database data   
  • Write to a response buffer  
   #2 and #3 are Eve’s bread and butter, and #1 and #4 are equivalent to manipulating the @request database (a subset of #3). So Eve is like Smalltalk with stateless APIs instead of objects.
  Protein programming

   Recall from biology class that proteins are stateless API handlers running in your cells. They get called to do interesting jobs like catalyze chemical reactions and transport molecules. When they finish the job, they don’t persist any state; they reset back to their original configuration.
   Have you ever wondered how cells call their little API handlers? Check out Sean Johnson’s Biology Stack Exchange answer for “How does a protein reach its substrate within the cell?” :
  The protein doesn’t move towards anything. It just randomly diffuses (bounces around) in the cell until it sticks to something. The particular chemical structure (the shape) of the protein and whatever it hits will determine how tightly they stick together and whether or not a chemical reaction occurs.
  […]
   Here’s a cool video that shows how proteins with a very specific shape bouncing around randomly can assemble into a complex structure.
  Now that we know the basic rules of “protein programming”, we can get some insight about Eve by looking at places where it’s similar to protein programming but different from mainstream programming:
  1. Live programming

   We’ve seen that Smalltalk and Eve are “live programming”  systems whose blocks of code can change without restarting the program.  Similarly, a cell’s set of proteins can change at runtime without needing to restart the cell. This is a special case of live programming called “life”.
  2. No single point of failure

  Any individual protein can get messed up and fail to do its job. But when a cell is deployed in an organism, it can’t afford to go offline for any reason. Luckily, no single protein failure can corrupt the cell’s state that much, so the vast majority of other cellular processes don’t care when single proteins fail. Furthermore, error-checking and redundancy can be layered in, in the form of other proteins.
  3. Programming without order

   In Glycolysis , glucose is broken down in a series of reactions in order to eventually create ATP , the “energy currency” of a cell. The whole process happens in the cell’s cytoplasm, a.k.a. that liquid where all the proteins bounce around like crazy.
12下一页
友荐云推荐




上一篇:Using a SQL Server Case Statement for IF/Else Logic
下一篇:人人都是建站高手 微企点让傻瓜式建站流行起来
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

214531562 发表于 4 天前
顶起顶起顶起
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表