Creation of commercial exhibits in Access
In article are considered ways of the creation and spreading the programs, designed in ambience Microsoft Access. The Article is written on the grounds of seven-year experience of the development on Access VBA (the versions 97-2002) by author personally, as well as employee of the Consultation group Raven and Maksimov.
Introduction
Beside many developer of software (as beginning, so and experienced) there is steadfast prejudice to Microsoft Access as to facility of the development of the professional programme products. Try to describe the standard reasons of the origin this, with permitions to say, errors.
- Access, as managerial system database, is positioned as facility of given final user control without attraction of the programmer. This certainly is a plus Access as program, but leads to active неприятию his(its) IT-professional.
- In effect foregoing, the program on Access/VBA try to write the people, not having sufficient experience and skill of the programming. Such development even spread on commercial base, as well as выкладываются for free access in интернете. The Professional programmer comes to terror at familiarization with code such programs and spreads its opinion on facility of the development.
- So named literature for teapot only intensifies the impression about Access as несерьезной to system. Teaching the development database in HIGH SCHOOL зачастую is also founded on like book and allowance.
- Having Faced in the first once with need of the writing the own program on Access, professional of the object-oriented programming (C++, Delphi) often does not know with what sides to approach to process of the development, since Visual Basic for Application offers своеобразный set of the facilities of the work with class. Here necessary to notice that programmer, who beforehand has deeply studied COM-programming Windows will much easier understand the ways of the interaction of the classes, references etc.
- Access offers absolutely non-standard to wide-spread facility of the development approach to programming the user interface (the forms, reports). This can cause the difficulty for understanding for experienced programmer even, and even developer on related language Visual Basic. The Background moment here this that elements of control (checking) Access are not Windows-checking and have a no context window (hWnd). Though these checking and look as standard, as well as have a sets characteristic and event, essentially they are simply pictures, прорисовываемые by application on the form. Also нетрадиционный approach marketed for list and forms with data. Checking, as well as form itself, always has a source data, which can tune in without making additional component dynamically. Zachastuyu, not parsed in like particularity of the language and ambiences of the development, programmers cite on error of whole system.
Also many accuse Access in insufficient защищенности programs and given from unauthorized access. Probably, this single moment with which possible agree. That is to say, правильнее to say that for provision of protection data can be needed the additional actions, which in principle are not required when use of the other systems of the development. In detail to this subjects refer to chapter Restrictions .
On the other hand, I agree with that that изначально Access was intended for creation of local applications and was not shown to the ful by facility of the development of the commercial programme products. That who worked with Access 2.0, I think, confirm that with standpoint of the programmer system was very uncomfortable. In protection can say only that ancestor modern Delphi, versions 1.0 I довелось with him to work too was an далек from ideal. The Possibilities running versions Access (the versions 2000 and hereinafter) so increased that on him wholly possible to create very complex programs both local nature, and circulated systems.
The Description some provided in article of the decisions expects presence to special version for developer Microsoft Access: for version Office 97 - Access Developer s Toolkit (ADT), for more late version - Office Developer s Edition (ODE).
Hereinafter in article is described necessary, on my glance, actions on creation of professional application on Microsoft Access. Wanted only notice that recommendation data are not some standard, this sooner set of the rules, which wanted to follow at development of own applications.
Development of spread exhibit
Development database
Here necessary to settle the problem with choice vault data and way of the access to this data. Access offers the sufficient choice: Jet/DAO, ODBC, ADO. Regrettably, no possibility to stop in detail on this important question in given to article. Cost(stand)s realy that to note that strategy of the development Microsoft Access goes on way of the displacing own vault (MDB) server source given (SQL-server).
The Main question, regardless of vault this structure database. The Processes to normalizations of the structure given (as, apropos, and inverse денормолизации) certainly can be conducted and in process of the development of the program, but advisable изначально have a firm kernel database, to which can become attached the new structures and interfaces of the user.
The Structure of the given commercial programme product in obligatory order must have a possibility of the spreading in open type (or only so and spread). First or last, but this will without fall be necessary for changing given with the other program. Remember about this and try to was not shame on you for own functioning, when come to send documentation other developer.
Development to concepts of the interface of the user
At development of the user interface is urgently recommended limit use the standard facilities of the interface Windows (the menu, panels instrument, master, messages). Own красивости can look attractive with your standpoint, but will be an intuitive incomprehensible final user.
The Structure of the forms and reports as far as possible must be united. For instance, all forms for editing data have band type and standard color palette, headline contains the set a filter, buttons of control are situated in lion to lower corner.
Division of the interface and database
About this is spoken practically in any book or article on programming in Access for beginning. Simply добавлю that full branch of the interface can cause some difficulties when work with MDB/MDE. Certainly general data must be carried on server (the file or SQL). But even so inadvisable keep the temporary tables (if such are used) in additional local MDB-file. More so that this, regrettably, does not bring about stabilizations of the size of the main file of the interface (regular compression is don't care required).
Group development
Access fits in for development of application several programmers that detailed design (MDB or ADP) presents itself united file. Categorically it is impossible use the joint access to make file of the interface this will bring most project about damage. But Access contains the special methods of the conservation and reconstruction object program in text type (Application.LoadFromText, Application.SaveAsText). Regrettably, on incomprehensible me reason developers have not included the possibility of the assembly of the project from modules in ambience of the development. But at presence of a certain skill you may write the own superstructure on output of the project in text type and the following reconstruction (designed in our companies superstructure allows to convert in text files all possible objects Access: the forms, modules, reports, requests, tables with data, references, panels instrument). It is a must for supports of the popular programs of the group development of applications (CVS, SourceSafe, TortoiseSVN). Comprised of ODE-version Access program SourceSafe on idea must was support such operation automatically, but us not to manage to find such option ( shall pleased mistaken if she there even so there is).
Documentation
Write as far as possible code, which does not require the additional explanation. This can be shown strange for many, but one of the modern concept of the programming expects practically full absence of the commentaries in text of the procedures and function. The Programme identifiers must themselves describe use the short procedures, speaking name of the classes, function, tables, flap, do not spare on length identifier.
That can require the additional commentaries and even separate documentation, so this structure database. Exists the ensemble of the systems for modeling of the structures data and business-processes (ErWin, Power Designer). The Minimum necessary actions are on registration of the structure given possible to do with the help of own diagrams given Access or SQL-server.
Special facilities
Inheritance interface
About impossibility normal inheritances in class Visual Basic can announce any programmer well-mannered on classical object-oriented programming languages. Not shall nobody to over-persuade even sooner comply with this statement. As judged by direction of the development of the facilities of the development from Microsoft, in the following version Access this gap will even so is eliminated. However, even in the running version possible (and it is necessary) use the possibility OOP VBA on maximum. Try to understand the possibility of the inheritance interface. This particularity of the language possible and will not add expected функциональности inheritances, but will do the code of the program more demonstrative, comprehensible, simple for development and carrying on the other platform.
Patterns of the code
VBA does not support special функциональности pattern of the classes or anything like. Under pattern of the code, I here imply, standard set of the descriptions, procedures and function wanted in several modules of the program. This can be a set standard handler event for worker of the forms, or, for instance, code on organizations of the forms-master. Such patterns can be designed as beforehand, so and in process of the development. Do Not are afraid to repeat such alike code in several places of the program such code looks the нагляднее, понятнее and for testing more simply and contributing the special change, than call global function and procedures. The Renovation of the pattern also is not a labour-consuming operation. In many events patterns code makes sense combine with inheritance interface.
Copies of the forms
Access allows to work with several copies one and same forms or report. On incomprehensible me reason in documentation and example Microsoft recommends to use the traditional way of the opening of the forms (through command DoCmd.OpenForm). On experience of the functioning we have not found some hidden error when use copy forms, under that that this adds well over possibilities on programming the interface and does his(its) more modern and suitable final user.
Temporary tables and requests
This point is enclosed in list only to pay attention to particularities of the work with temporary table and request when use copy forms and reports. If some form is founded on time table, that will take to create the separate copy of such table for use in copy of the form. In this case makes sense develop the generator of the temporary tables and request.
Processing own event
The Orientation on events is big at a walk onward in development of the programme systems. The Programs Access also possible to force to process your own events moreover without attraction функциональности сабклассинга and Windows API. The Events in this case present itself object of the class and are processed by special hidden forms (the processor), downloaded at start of the program. Through events possible to send the results from modal windows, context to update the list on all opened worker forms, start the server procedures in anisochronous mode etc. Thereby, possible practically dispose of use global variable. Besides, VBA gives special функциональность for interaction of the classes through events (refer to reference on WithEvents and RaiseEvent).
Conditional compiling
This is a powerful facility, allowing circulate the programme modules in different projects under small change функциональности (refer to reference on #If). Wanted only call attention that conditional compiling makes sense only at accompaniment of the condition right in characteristic of the project VBA (the menu Tools\<projectname> Properties). When use the keyword #Const majority useful characteristic to conditional compiling gets lost, since such constant has a visibility scope at a rate of module only
Superstructures
Can come in handy stand certain функциональность applications in separate file of the superstructure. Access supports three types superstructure: separate file, инсталлируемые superstructures (requiring USysRegTable) and COM-superstructures. The Superstructure in the manner of separate file must be installed in the same directory, as file msaccess.exe. In this case will not take to set the relationship up with these file at a rate of collections References. Much useful when programming superstructure to use the description Friend for characteristic and methods of the classes in usual project Access this description does not differ from Public. Installiruemye and COM-superstructures are basically intended for relief of the process of the development and can be of no use final user of the program (the user can in general have not a standard version Access).
Sabklassing
Try to dispense with use сабклассинга (the redefinings main to functions window). Particularly this concerns the main a window exhibits. When origin of any untilled error application is closed with system message Access (possible hereon attempt of the reconstruction database will is made) that looks for user пугающе. In general good stiletto is a possibility of the reconstruction of importances global variable and rebooting the hidden forms when origin of any critical error in program.
read hereinafter >>