I'm not sure if you can call a "Constructor" a design pattern, it is more a language specific thing. So maybe it is an Idiom.
The first version using "function" and "new" is totally language specific, the second is more common in OO languages, but still a language feature.
But the problem it tries to solve is not limited to JavaScript, so calling the solution a JS design pattern is also not really suitable, because then it does not solve the problem its name implies.
But I'm curious, is there any reference to an actual PLoP conference publication that really qualifies it as a design pattern?
I am a Software Engineer with robust problem-solving skills. Working actively in the tech industry, planning, creating, and designing beautiful business software
Thank you for your reply. I do agree that the constructor is a language-specific thing. These JS series are designed to tackle the concept of design patterns using a specific programming language, JavaScript, thus, JS Design Patterns. The same paradigm is transferable to many other languages, and could also be written in pseudo-language. Would you like me to include pseudo-code in the next chapter? 😊
There are no official PLoP conference references regarding constructor pattern that I could find, there are a couple of references in the books you can find on Amazon or in a nearby bookstore. But I would like to mention that it is a common practice in the University I went to, to represent constructor in such a manner because of the coding newbies, that are not familiar with how an instance of an object is being created. I really try to combine the Uni knowledge with official publications, primarily to get the coding newbies into the world of software engineering, but also, to be concise, simple, and effective. The next chapter is all about a unique little fellow, The Singleton Pattern! 🚀
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm not sure if you can call a "Constructor" a design pattern, it is more a language specific thing. So maybe it is an Idiom.
The first version using "function" and "new" is totally language specific, the second is more common in OO languages, but still a language feature.
But the problem it tries to solve is not limited to JavaScript, so calling the solution a JS design pattern is also not really suitable, because then it does not solve the problem its name implies.
But I'm curious, is there any reference to an actual PLoP conference publication that really qualifies it as a design pattern?
Thank you for your reply. I do agree that the constructor is a language-specific thing. These JS series are designed to tackle the concept of design patterns using a specific programming language, JavaScript, thus, JS Design Patterns. The same paradigm is transferable to many other languages, and could also be written in pseudo-language. Would you like me to include pseudo-code in the next chapter? 😊
There are no official PLoP conference references regarding constructor pattern that I could find, there are a couple of references in the books you can find on Amazon or in a nearby bookstore. But I would like to mention that it is a common practice in the University I went to, to represent constructor in such a manner because of the coding newbies, that are not familiar with how an instance of an object is being created. I really try to combine the Uni knowledge with official publications, primarily to get the coding newbies into the world of software engineering, but also, to be concise, simple, and effective. The next chapter is all about a unique little fellow, The Singleton Pattern! 🚀