当前位置:网站首页>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 !
边栏推荐
- Zero foundation uses paddlepaddle to build lenet-5 network
- 【web源码-代码审计方法】审计技巧及审计工具
- SQL performance optimization skills
- [groovy] string (string injection function | asBoolean | execute | minus)
- Linux Installation redis
- Huawei MPLS experiment
- Yuancosmic ecological panorama [2022 latest]
- Simple use of devtools
- Talk about the SQL server version of DTM sub transaction barrier function
- El tree whether leaf node or not, the drop-down button is permanent
猜你喜欢
随机推荐
There is a question about whether the parallelism can be set for Flink SQL CDC. If the parallelism is greater than 1, will there be a sequence problem?
Share the newly released web application development framework based on blazor Technology
程序员的视力怎么样? | 每日趣闻
Tiny series rendering tutorial
[system security] ten thousand words summary system virtualization container bottom layer principle experiment
Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
040. (2.9) relieved
el-select,el-option下拉选择框
1.五层网络模型
Basic knowledge of tuples
Leetcode92. reverse linked list II
Why are there fewer and fewer good products produced by big Internet companies such as Tencent and Alibaba?
Apache build web host
Azkaban实战
Kubernetes - identity and authority authentication
Anti debugging (basic principles of debugger Design & NT NP and other anti debugging principles)
Anchor free series network yolox source code line by line explanation Part 2 (a total of 10, ensure to explain line by line, after reading, you can change the network at will, not just as a participan
Flume configuration 4 - customize mysqlsource
Sqoop command
Share the newly released web application development framework based on blazor Technology