该模式和类似的技术有时称为“惰性初始化”,原因是在实际需要之前不执行初始化。
This pattern and similar techniques are sometimes called lazy initialization, since the initialization is not performed until actually required.
这个选项适用于短期运行的程序,特别是那些执行时间不集中在少量的“热点”方法中的程序。
This option is appropriate for shorter running applications, especially those where execution time is not concentrated into a small number of methods - "hot spots".
绿色圆圈中的数字显示在不启用异步的情况下的执行顺序。
The circled green Numbers show the sequence of execution that would take place if asynchrony were not enabled.
As an aside, if you ever just have one line of code that you want to execute, one puzzle piece in Scratch terminology, ; you actually don't need the curly braces; you only need the curly braces if you have two or more lines of code that you want to execute if that condition is true.
此外,如果你只有一行代码,需要执行,在Scratch,术语中叫做,一句代码,你就不需要使用花括号了;,如果那个条件成立,你有两行或更多行的代码时需要执行时,你就需要花括号。
应用推荐