当前位置:网站首页>The architect started to write a HelloWorld
The architect started to write a HelloWorld
2022-07-05 03:34:00 【Resourceful!】
Architects don't make tools , I made one today helloworld!
Today we don't talk about technology , Talk about transition design .
We use helloworld For example ! Ordinary programmers write a Java Output hello world Program ! Architects have a look , Look disdainful . Looking for nails everywhere , Your program is too low 了 , Multilingualism is not supported , Friendly extensions are not supported !
Then the architect started to write a hello world!
The architect's thinking is as follows :
main In the function print once ?
Too process oriented , too low 了 . You have to encapsulate a class . It's called Printer,Printer There is a member method , It's called print.
however ! Just one class is too low 了 , What if there are different implementations in the future ? So we have to add an interface .PrinterInterface.
however !interface There is no realization , Default or default . So we have to add an abstract class ,AbstractPrinter Realization PrinterInterface, then Printer Inherit AbstractPrinter.
however ! You have such a set , How to create an instance ? direct new Printer()? too low 了 , That's called implementation dependency . Definitely not , So we need to build a factory class ,PrinterFactory,PrinterFactory use PrinterInterface Return instance , This hides the implementation details .
however !PrinterFactory It is also an implementation class , too low 了 , So there must be PrinterFactoryInterface,AbstractPrinterFactory.
And in PrinterFactory How to write it in it ? direct new Printer() ? too low 了 . Or implementation dependency .
Last , You have to put this pile of things together in code , It's too ugly , Various new Implementation class . too low!
Fortunately, we have an advanced thing , It's called dependency injection ! Write the program object structure into the configuration file . Of course, you can't make your own wheels . To configure Spring Well . So much lib, On the command line or IDE Project management is definitely not enough , You have to have dependency management .Maven ah Gradle Ah, come on .
Last , want print How can I pass something to the program ? Hard encoding ? Command line arguments ? too low! Of course, it has to be written in XML Inside .
Light is a XML Of course, it's not enterprise class , Plus DTD Verify it .
Then it comes to XML The problem of analysis . Directly operate in the code parser Do you ? too low! Of course, write a parser The wrapper class ,interface,abstract class,implementation class,factory class Another set . After all , Can't rely on Implementation , If I change in the future parser What should I do? .
Architect version helloworld
IDE You have to install it 300 A plug-in , Open the project hard disk and eat it for a long time 2GB Memory , Then a bunch of plug-ins pop up and ask for an upgrade .
oh , Before this happens , I have to draw UML What about the picture? . Three years later, the project was completed , Deploy to the client's server for a run , Break down immediately , All over the place stack trace.
Originally, the client server used JDK 8 And new projects need JDK 11. Then ask the customer if you can't upgrade , The answer is no , Because the enterprise solution made by another enterprise development group only supports JDK 8. Then the customer scolded your architect , You've done so much design that you never thought you might change JDK Do you ?
Inside code review, The architect is still proud to say , Although I don't often write code , But my code is extensible !
Architects talk on paper
After the meeting, a group of people were talking , Architects seem to have written less unit tests ; There's no documentation ; Others say that the architect's single node hello world What to do if I hang up ?
You have to use microservices ,redis,nginx,docker,k8s wait devops ...
Everything has to be arranged , Doing the job of making artillery battles , With the heart of building a nuclear bomb !
边栏推荐
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- Kubernetes - identity and authority authentication
- What is the most effective way to convert int to string- What is the most efficient way to convert an int to a String?
- [Chongqing Guangdong education] 2777t green space planning reference questions of National Open University in autumn 2018
- 腾讯云,实现图片上传
- Smart pointer shared_ PTR and weak_ Difference of PTR
- Pytest (4) - test case execution sequence
- Redis6-01nosql database
- Cette ADB MySQL prend - elle en charge SQL Server?
- Flume configuration 4 - customize mysqlsource
猜你喜欢
Qrcode: generate QR code from text
SQL performance optimization skills
1. Five layer network model
How to learn to get the embedding matrix e # yyds dry goods inventory #
Mongodb common commands
Flume configuration 4 - customize mysqlsource
This + closure + scope interview question
v-if VS v-show 2.0
深度学习——LSTM基础
看 TDengine 社区英雄线上发布会,听 TD Hero 聊开发者传奇故事
随机推荐
LeetCode146. LRU cache
汇编-入门
51 independent key basic experiment
为什么腾讯阿里等互联网大厂诞生的好产品越来越少?
The latest blind box mall, which has been repaired very popular these days, has complete open source operation source code
Leetcode42. connect rainwater
Sqoop installation
Yyds dry goods inventory intelligent fan based on CC2530 design
el-select,el-option下拉选择框
SFTP cannot connect to the server # yyds dry goods inventory #
Basic authorization command for Curl
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
[positioning in JS]
【软件逆向-基础知识】分析方法、汇编指令体系结构
Apache build web host
Google Chrome CSS will not update unless the cache is cleared - Google Chrome CSS doesn't update unless clear cache
Ask, does this ADB MySQL support sqlserver?
Devtools的簡單使用
[Yu Yue education] National Open University autumn 2018 8109-22t (1) monetary and banking reference questions
Linux Installation redis