You should take care to throw exceptions in these situations, so the user will know that the action could not be performed exactly as they requested.
在这些情况下,您应该负责抛出异常,让用户知道他们请求的操作无法按照期望执行。
Another benefit is that memory consumption is optimized, as objects are only loaded into memory when they are requested.
另一个好处就是对内存消耗的优化,对象只有在被请求时才会被加载到内存中。
This behavior known as Lazy Loading ensures that dependents are only loaded as they are specifically requested and hence makes it possible to avoid unnecessary creation of objects.
延迟加载行为保证了依赖的数据只有在真正请求时才会被加载进来,这样就可以避免创建无谓的对象。
应用推荐