如何解释依赖注射到5岁? [英] How to explain dependency injection to a 5-year-old?

查看:98
本文介绍了如何解释依赖注射到5岁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是解释依赖注入的好方法?

我在Google上发现了几个教程,但没有人会认为读者只是一个Java初学者。你如何向新手解释这个问题?

I found several tutorials on Google, but none of them that would assume the reader is just a Java beginner. How would you explain this to a novice?

推荐答案

我给你五年级的依赖注入。

I give you dependency injection for five-year-olds.


当你自己从冰箱里拿出东西时,你可能会导致问题。你可以离开门,你可能会得到妈妈或爸爸不想要的东西。你甚至可能正在寻找我们甚至没有或已经过期的东西。

When you go and get things out of the refrigerator for yourself, you can cause problems. You might leave the door open, you might get something Mommy or Daddy doesn't want you to have. You might even be looking for something we don't even have or which has expired.

你应该做的是说明需要,我需要喝点东西午餐,然后我们会确保你坐下来吃东西。

What you should be doing is stating a need, "I need something to drink with lunch," and then we will make sure you have something when you sit down to eat.

这篇关于如何解释依赖注射到5岁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆