Design patterns Magento 2 - magento

Magento is a pretty complex application. And knowing as a large open source ecommerce platform. Throughout Magento 1 architecture, it commonly used 12 design patterns which allows developers to view and use them in real.
As you know, Magento 2 is coming soon. I want to know what patterns are approved? And give us some examples?

Composite Pattern
Strategy Pattern
Factory Method Pattern
Observer Pattern
Object Manager (which consist of 11+ Design Patterns)
Decorator Pattern
Proxy Pattern

I think that the best solution for you is take a look into Magento 2 documentation and source code.

Related

How to set priority in Microsoft Luis Patterns?

I am using pattern recognition to catch entities with a variable size. Here are situation that i am trying to catch
1- {entity1} (has| had| have) [the] {entity2}
2.1- {entity1} (has| had| have) the {entity2}
2.2- {entity1} (has| had| have) {entity2}
i tried the 1 pattern or the 2.1 and 2.2 at the same time.
The problem is that when i enter: "Person have the properties"
the entity2 is marked as "the properties" instead of just "properties"
Is there a way to mark priority or work around this problem?
Sorry for english mistakes i hope that the question is clear enough.
There is no way you can set priority in LUIS patterns. However, given your situation above, where the entity is getting extracted incorrectly, you might want to make use of explicit lists. You can create an explicit list via the authoring API to allow the exceptions when:
Your pattern contains a Pattern.any
When that pattern syntax allows for the possibility of an incorrect entity extraction based on the utterance.
Also, make sure to refer to the best practices(https://learn.microsoft.com/en-us/azure/cognitive-services/luis/luis-concept-best-practices#do-and-dont) for LUIS apps to make sure your app behaves with improved accuracy.
Hope this helps.

Which CodeIgniter Template Library fits requirements?

I would like to use tags like {{headline}} in the CodeIgniter views instead of PHP and I'm looking for a template parser. CodeIgniter has a built-in template parser: http://www.ellislab.com/codeigniter/user-guide/libraries/parser.html
The question is if it's better to use the built-in parser or another parser? Are there any limitations with the CI template parser like not supporting loops, if statements, etc.?
If so, there are a number of other parsers but it seems that a developer works on them for some time and then it falls into a numb state when it's not supported any more. I'm looking for a parser which will also be supported in a year:
Bucket
http://backstack.ca/projects/bucket/
Comper Template Parser
http://parser.comper.sk/en/
Ocular-Template-Library
http://github.com/lonnieezell/Ocular-Template-Library
Phil Sturgeon Template library
http://philsturgeon.co.uk/code/codeigniter-template
PyroCMS Lex Parser
http://github.com/pyrocms/lex
Template Library for CodeIgniter
http://www.williamsconcepts.com/ci/codeigniter/libraries/template/
The most active seem to be Comper and Lex Parser. What is the difference between Phil Sturgeon Template library and PyroCMS Lex Parser because it's the same developer?
What I am looking for is:
- Separation of PHP and HTML/CSS in views
- Solidly supported so that it's not stalled within a year
- Use of simple tags but also loops, if statements and other functions
Can anyone give me a tip? The existing information on the CI forum or elsewhere have not been really useful.
Many thanks!
Philip
How to Choose a Template Engine
I went through a similar exercise for choosing a PHP/CMS system, and here are some points that may carry over to your decision making process.
I first look at the documentation to get a sense of how much support there is for the system, evaluate range of features and so on. I also see if there is an online forum with enough activity to get some help if needed.
I then try out the installation to see if it goes smoothly. If I have trouble at this stage, I may simply quit and try another system unless there is an online forum or help desk with a ready answer.
I then set up a sample website (2-3 pages) and try out the features that I need. In the case of CodeIgniter, I may have content stored in multiple database tables and I evaluate how much effort it takes to get the data from my SQL queries into the array structure that can be used by the template system. This is usually the step that takes the most effort when developing the website.
I also check to see how easy I could integrate a PHP function into the mix. For example, I once had to build a specialized function to determine a range of dates and these dates had to be passed to the template engine. I was able to do it but it took a lot of effort. The template system had almost no support for parsing dates and I had to resort to a PHP function to do the work.
Summary
Ultimately, you will need to try a few of these systems out to get a feel for them. Once that is done, pick one that makes sense for your coding style, ease of use, and your data structure.
PS
I have not used the systems that you listed above but I have spent quite a bit of time using the template engine in Expression Engine (CMS from the same group that created CodeIgniter). My comments are based on my experience implementing database driven websites using Expression Engine and dealing with the limitations and quirks of that particular platform.

What is a good approach for extracting keywords from user-submitted text?

I'm building a site that allows users to make sense of a debate by graphically representing arguments for and against a particular issue. (Wrangl)
I'd like to categorise these debates so they are more easily found and connected. I don't want to irritate the person creating the debate by asking them to add tags and categories before they see any benefit, so I'm looking at a way of automatically extracting keywords.
What's a good approach for taking the debate's title and description (and possibly the content of the arguments themselves once there are some) to pull out, say, ten strong keywords that could be used as metadata to connect similar debates together, or even as the content of the "meta" keywords tag in the head of the HTML page where the debate is viewable. Eg. Datamapper vs ActiveRecord
The site is coded in Ruby with Sinatra, using DataMapper for data storage. I'm ideally looking for something which will work on Heroku (I don't have a way of writing files to disk dynamically), and I'd consider a web service, an API or ideally a Ruby gem.
Maybe you can use TextAnalyzer.
I understand that you're wanting to find an easy way of achieving this, I've recently dived into the world of NLP (Natural Language Processing) and Text-mining and its a daunting process of which most went far above my head.
Although i managed to code some functionality that resembles what you're looking for, though I did it in PHP. What i would suggest, that if you want it tailored to your project (Wrangl) then do it yourself.
Using the Porter stemming algorithm which I'm sure there will be Ruby code for.
Ruby Porter stemmer
You can try the salsaAPI to automatically extract keywords and categorize the debates!

Artificial Intelligence and Chat Filters

Are there any chat filters that works depending on the context? I'm talking about the use of new technologies like Artificial Intelligence and Natural Language Processing to determine for example if a word was rude or not, depending on the context.
The simplest way is to just use a regex for the handful of most offensive words.
There are services offered online that will allow you to query with a word to see if it's profane. Those are good options if you want to be really sure.
Unfortunately, there's no sure bet for any of these. One man's profanity is another's common talk (see santorum. very very vulgar, but most aren't offended.) And each group has their own fowl language. ballox isn't so bad in America, but it's fairly bad in Britain.
You could make a clbuttic mistake. Even if you eliminate everything, I can still write a horribly offensive story using the kindest language.
A short black list or one of the services is the way to go depending on the level of filtering you want.
This looks interesting http://pottymouthfilter.com, It is unfortunately commercial product but at least someone is working on something along those lines.

What are the url parameters naming convention or standards to follow

Are there any naming conventions or standards for Url parameters to be followed. I generally use camel casing like userId or itemNumber. As I am about to start off a new project, I was searching whether there is anything for this, and could not find anything. I am not looking at this from a perspective of language or framework but more as a general web standard.
I recommend reading Cool URI's Don't Change by Tim Berners-Lee for an insight into this question. If you're using parameters in your URI, it might be better to rewrite them to reflect what the data actually means.
So instead of having the following:
/index.jsp?isbn=1234567890
/author-details.jsp?isbn=1234567890
/related.jsp?isbn=1234567890
You'd have
/isbn/1234567890/index
/isbn/1234567890/author-details
/isbn/1234567890/related
It creates a more obvious data structure, and means that if you change the platform architecture, your URI's don't change. Without the above structure,
/index.jsp?isbn=1234567890
becomes
/index.aspx?isbn=1234567890
which means all the links on your site are now broken.
In general, you should only use query strings when the user could reasonably expect the data they're retrieving to be generated, e.g. with a search. If you're using a query string to retrieve an unchanging resource from a database, then use URL-rewriting.
There are no standards that I'm aware of. Just be mindful of IE's URL length limit of 2,083 characters.
Standard for URI are defined by RFC2396.
Anything after the standardized portion of the URL is left to you.
You probably only want to follow a particular convention on your parameters based on the framework you use.
Most of the time you wouldn't even really care because these are not under your control, but when they are, you probably want to at least be consistent and try to generate user-friendly bits:
that are short,
if they are meant to be directly accessible by users, they should be easy to remember,
case-insensitive (may be hard depending on the server OS).
follow some SEO guidelines and best practices, they may help you a lot.
I would say that cleanliness and user-friendliness are laudable goals to strive for when presenting URLs.
StackOverflow does a fairly good job of it.
I use lowercase. Depending on the technology you use, QS is either threated as case-sensitive (eg. PHP) or not (eg. ASP). Using lowercase avoids possible confusion.
Like the other answers I've not heard about any conventions.
The only "standard" I would adhere to is to use the more search engine friendly practice of using a URL rewriter.
There are no standards that I know of, and case shouldn't matter.
However within your application (website), you should stick to your own standards. For your own sanity if nothing else.

Resources