Tag:Single case

  • Angular2 actual combat of the front end: detailed explanation and application of dependency injection


    Dependency injection dependency-injection-in-angular-2 Dependency injection is the biggest feature and selling point of angular. It allows different components in an application to call each other without explicitly establishing an association. However, there are still some problems with dependency injection in angular 1, which is why angular 2 completely reconstructs a dependency injection system. The main […]

  • Design mode – 18) singleton mode


    class STWindow { static Window win; private STWindow() { } public static Window GetInstance() { if (win == null || !win.IsVisible) { win = new Window(); win.Height = 200; win.Width = 200; } return win; } } class Singleton { static Singleton _singleton; private Singleton() { } public static Singleton GetInstance() { if (_singleton == […]

  • Design pattern — multi case pattern


    In the last article, we talked about the single case mode. Some children’s shoes will ask: there are single cases, are there multiple cases? Answer: Yes, in this article, let’s talk about multi instance mode. Multi instance mode means that a class has multiple instances, and the instances are the class itself. Such a class […]

  • Advantages of using laravel service container


    This article reprints my personal blogOriginal addressSampsonBlog If the core of the laravel framework is anything, it is undoubtedly a service container。 Understanding the concept of service container is very important for us to use laravel. It should be said that whether we understand the concept of service container is an important condition to distinguish […]

  • [design mode] overview


    Seeing the 30 days of the Nuggets posting more challenges, I want to try my best to stick to it for a few consecutive days. The prize is not important. Does it focus on participation?In the next 30 days, I will lead you to learn design patterns. In the past, I always felt that design […]

  • Singleton mode


    Singleton mode Singleton pattern is one of the simplest design patterns in Java. This type of design pattern is a creation pattern, which provides the best way to create objects. This pattern involves a single class that is responsible for creating its own objects while ensuring that only a single object is created. This class […]

  • C# practice notes 1. Language_ Use of grammar


    1、 Using static1. The new syntax of c#6 using static can simplify the prefix:Example: 1 using static System.Console; // 1. Using static 2 3 namespace test 4 { 5 internal class Program 6 { 7 private static void Main(string[] args) 8 { 9 WriteLine(“test”); // 2. Omit console. It’s just a syntax sugar. Console.WriteLine(“test”); 10 […]

  • Guide to angular programming style (II)


    A good programming style is conducive to the collaborative development of the team, so we also have some agreements when developing angular. This article is mainly aimed at the teams using angular and coffee script( This is a rough translation. The link of the original text is under the article. Interested students can see it.) […]

  • Project reconfiguration modular encapsulation summary (applet project as an example)


    The project reconstruction task, which lasted more than two months, will go online next week, Use the weekend to write a summary of this refactoring. This paper takes the applet project as an example, However, its ideas can be used for reference by other front-end projects. Some design patterns and algorithms such as singleton pattern […]

  • Scope and lifecycle


    Different scopes and lifecycle categories are crucial because incorrect use can lead to very serious concurrency problems.SqlSessionFactoryBuilder: This class can be instantiated, used, and discarded. Once sqlsessionfactory is created, it is no longer needed. local variable SqlSessionFactory: To put it bluntly, it can be imagined as: database connection pool Once sqlsessionfactory is created, it should […]

  • How to analyze spring source code?


    target Track the flow of the following code: AnnotationConfigApplicationContextDemo /** * description * date 2021-06-30 11:21 **/public class AnnotationConfigApplicationContextDemo { public static void main(String[] args) { final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(SimpleConfig.class); User user = applicationContext.getBean(User.class); System.out.println(“user:” + user); } }Configurationpublic class SimpleConfig { Bean public User user(){ return new User(“xgimi”, 10); } }public class User { private String name; private Integer age;         … technological […]

  • Notes and extensions of unity3d action game development practice 2.1


    2.1.1. Use coprocessing to decompose complex logicProcessing asynchronous tasks with a coroutine: when you encounter some program requirements that need asynchronous processing, you can use a coroutine to implement themAdvantages of using CO process: simple and easy to implementExample: using coprocessor instead of finite state machine (some modifications and comments are added based on the […]