Abstract Factory configuration error-prone issues

Source: Internet
Author: User

Feeling that you have a very deadly weakness is not daring to act. Afraid of mistakes, especially in the computer room is to highlight this shortcoming. In the beginning of the abstract factory, first looked at a lot of information before beginning programming, thought can be foolproof, experienced after only found that no one can solve all your problems seamlessly, just like a person if you do not go to practice a little bit more theory is just an armchair. These seemingly superficial truths have been forgotten on my programming path.

My configuration file

The code in the factory is:


I thought it was written in a big talk design pattern that the above code should be fine, but the class that was not found was always displayed during debugging. This means that the factory did not successfully create the interface class. After repeated checks to compare their own code with the difference in the book, found that their code framework because it is exported in the EA, so added namespace. So the full name of the class D on the above should be the SqlDAL.SqlDAL.BasicDateSetDAL class, and my code above is built by the Sqldal.basicdatasetdal class, of course, can not find the corresponding class will be reported as null. and the order of the above code is also problematic, the intention is to extract as much as possible the reuse of code, but the problem of the order of ignoring, classdal Start no assignment, so classname is only SQLDQL and classdal part is null, And in the function just copy the Classdal but did not re-assign to classname. In this case, the classname is eventually null and the object is not found.

As long as a slight modification can be as follows:

Abstract Factory configuration error-prone issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.