Spring founder uncle rod's real thoughts on yaml

Jiedao jdon 2021-05-04 14:01:32
spring founder uncle rod real

If you are in the Twitter Pay attention to me , You might think I hate YAML.

I'm not against YAML, Just against abuse  YAML. I want to help prevent people from abusing YAML In the process, he unintentionally inflicted cruelty on himself and his colleagues .

YAML The advantage of is structured data format . Yes , It has problems . Blank is a minefield . Its syntax is very complicated . It comes to the conclusion that :“  Any use YAML Most people are trying to abbreviate Norway It was eventually burned down in the middle of the fire .”  however YAML It's human readable and supports comments : These are the two main benefits that drive its popularity .

Where it can go wrong is that we use YAML To describe behavior .

consider CI Some examples in the domain . This is not YAML The only area that has been abused in this way , But it's one of the most serious criminals .

With GitLab To realize themselves by defining the pipeline of :1170 That's ok :

  <<: *dedicated-no-docs-pull-cache-job
  image: dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.5.3-git-2.18-chrome-71.0-node-8.x-yarn-1.12-graphicsmagick-1.3.29-docker-18.06.1
    - setup-test-env
    - docker:stable-dind
    NODE_ENV: "production"
    RAILS_ENV: "production"
    SETUP_DB: "false"
    WEBPACK_REPORT: "true"
    # we override the max_old_space_size to prevent OOM errors
    NODE_OPTIONS: --max_old_space_size=3584
    DOCKER_DRIVER: overlay2
    DOCKER_HOST: tcp://docker:2375
    - node --version
    - yarn install --frozen-lockfile --production --cache-folder .yarn-cache
    - free -m
    - bundle exec rake gitlab:assets:compile
    - time scripts/build_assets_image
    - scripts/clean-old-cached-assets
    name: webpack-report
    expire_in: 31d
      - webpack-report/
      - public/assets/

Please note that script contain shell Block of script list . Does this look like data ? Is this the right model to specify execution ?

There are many similar cases . Here are Tekton  Example A segment of , It's based on Kubernetes New delivery solutions for :

apiVersion: tekton.dev/v1alpha1
kind: Task
  name: build-push
    - name: workspace
      type: git
    - name: pathToDockerFile
      description: The path to the dockerfile to build
      default: /workspace/workspace/Dockerfile
    - name: pathToContext
      description: The build context used by Kaniko (https://github.com/GoogleContainerTools/kaniko#kaniko-build-contexts)
      default: /workspace/workspace
    - name: builtImage
      type: image
  - name: build-and-push
    image: gcr.io/kaniko-project/executor
    - /kaniko/executor
    - --dockerfile=${inputs.params.pathToDockerFile}
    - --destination=${outputs.resources.builtImage.url}
    - --context=${inputs.params.pathToContext}

Ouch , Variable , Qualified name ? Parameters ? This is not structured data , This is programming disguised as configuration .

Haven't we come across the concepts of variables and continuous instructions before ? Why reinvent imperative programming clumsily ? How about modularity and testability ? So what about the scalability that programming languages can get for free ? Why reinvent the strictly defined exception handling in Modern Languages ? How about logic operations , Not to mention more advanced and elegant FP or OOP Concept ?

Support this kind of based on YAML The best reason for grammar is that it's an external DSL, Enforce a beneficial structure . however , For the following reasons , That's not the case :

  • The prescriptive structure is largely an illusion . Most of the work is crammed into... Etc shell Script (GitLab Example ), In practice , It's the Wild West .
  • If in DSL There is a missing step in the design of , Then you'll hit the wall . for example ,CI Tools typically model the delivery phase as YAML section . If you need a unique stage , You may be out of luck .
  • For external DSL Come on ,YAML It's a bad format , It's like XML equally . Popular configuration formats are always misused in this way .

in any case , You probably don't need the outside DSL: We are Atomist I learned a lot .

external DSL ...... It's like a puppy , They all began to be lovely and happy , But as they grow up , Without exception, they become vicious beasts .

Modern programming languages are flexible enough , Can make the inside DSL More and more attention , Better tools and scalability .

It's wrong to try to use the data format as a programming language . Using it like this has nothing to do with the merits of the data format .

YAML As a data format, it's ok .YAML Not a programming language . If you're programming , Please use the programming language . You owe it to Turing,Hopper,Djikstra And countless other computer scientists and practitioners , They built our computer science . Use what you've learned !

本文为[Jiedao jdon]所创,转载请带上原文链接,感谢

  1. Microservice mode: business process saga mode of spring boot + Kafka - vinsguru
  2. Linux / MacOS 修改 ls 显示年月日的时间格式
  3. Linux / MacOS modify the time format of LS display date
  4. 7、Spring Boot检索
  5. 7. Spring boot search
  6. 7、Spring Boot检索
  7. 7. Spring boot search
  8. 10、Spring Boot分布式
  9. 10. Spring boot distributed
  10. Did you know that artifact can also manage SUSE Linux system dependencies
  11. 3、Spring Cloud Rest工程建立(通過IDEA建立)
  12. 3. Spring cloud rest project establishment (through idea)
  13. 4、Spring Cloud Eureka
  14. 4、Spring Cloud Eureka
  15. Did you know that artifact can also manage SUSE Linux system dependencies
  16. k8s搭建zk&pulsar集群——三节点
  17. 7、Spring Cloud Hystrix
  18. Dubbo series -- source code analysis of local service publishing
  19. Netty启动对HTTP/3的孵化器支持
  20. Netty launches incubator support for HTTP / 3
  21. Spring Webflux security configuration tutorial and source code - vinsguru
  22. WebClient: Spring的新的HTTP反应式客户端 - spring.io
  23. Webclient: spring's new HTTP reactive client- spring.io
  24. 使用Project Reactor进行反应式数据流 - spring.io
  25. Using project reactor for reactive data flow- spring.io
  26. Humor: k8s is not so hard to deploy on kubernetes personal blog
  27. UNIX domain socket tutorial for java16 - nipafx
  28. Using netty to realize the source code and tutorial of http2 server / client baeldung
  29. Using spring boot reactive r2dbc to realize crud operation source code of PostgreSQL Rajesh
  30. Spring Boot Liquibase基础教程 - josdem
  31. Vlad mihalcea: the best way to map query results to dto using JPA and Hibernate
  32. Using java enumeration in spring boot to automatically serialize parameters and save database - Dario
  33. In depth study of spring cloud load balancer - Piotr
  34. How to use completable future in springboot 2
  35. Basic course of spring boot liquibase - josdem
  36. Volatile side effect in Java: not using CPU cache
  37. Using redis PubSub and spring boot to realize microservice message model vinsguru
  38. Fault tolerant and reliable messaging of Apache Kafka and spring boot – Arnold galovics
  39. Java exception and tuning one stop solution
  40. Using playwright to implement automatic visual testing for Java API - applitools
  41. Oracle database official statement does not support VMWare
  42. [function] Oracle function series (1) -- character function
  43. [function] Oracle function series (1) -- character function
  44. Oracle character set simple diagram, Chinese garbled solution
  45. Oracle lock series
  46. No.2 process kthread of Linux kernel learning
  47. [password] Oracle user password series
  48. [Linux] migrate Oracle installation directory from root directory to logical volume
  49. Oracle 12cr1 RAC installation on VMware Workstation (middle) - graphical interface installation
  50. Driving of Oracle hint_ SITE
  51. Oracle 12cr1 RAC installation on VMware Workstation (middle) - graphical interface installation
  52. [knowledge point sorting] comparison of redo, undo and execution speed under nologing, append, archive and parallel in Oracle
  53. Introduction to Oracle parameters
  54. [method] how to limit IP access to Oracle database
  55. Oracle 12cr1 RAC installation on VMware Workstation (middle) - graphical interface installation
  56. Linux free - M command
  57. Oracle fast recovery area (FRA)
  58. Docker install MySQL 5.7
  59. Oracle 12C EM Express Series
  60. [DG] Oracle 19C uses DBCA to build physical DG