Client Apps

Client Apps

In these articles we've learnt how to create Jazz Web services, convert them to COBOL, bind the program so that it communicates with JSON, and we've created an interface encapsulating the rules of the service so that the final app developer's job is made easier. Now we need to learn how to use this Service Interface in our client app, the left-most part of the Bridge diagram, to display and update Employee records.

In summary the client is written by:

  • Create a program (form?, web page?, mobile app?) in a suitable project and instantiate the interface (JSPG2Client) in this form.
  • Write simple logic to attach textbox controls to interface properties, instantly ensuring that they will be validated correctly. For example, this is all that is necessary to ensure that EMPNO is validated as it is entered: any non-numeric character is immediately prevented. Similar code checks that SEX must be M or F, Salary must be >= 0, and so on

  • Buttons invoke relevant interface methods for reading (Enquire, and scrolling), Update, Add, and Delete. Finally, write logic for [Clear] and [Close]. For example, when btnUpdate is clicked the Update method is invoked.

  • The update method will return the checksum that was previously read, ensuring (pseudo-locking) that the Employee record has not been changed by another user. The checksum is not even visible to JSPG2Test.

For a detailed explanation read "Using a Client Interface". See Bridging Two Worlds to see it working.

Form JSPG2Test has about 320 lines of C# logic, but the Service Interface is another 1013 lines. 3/4 of the client logic has been written for you!

My example, form JSPG2Test, is designed purely to illustrate the use of the interface, but client apps are normal C# (or Java or VB or ...) programming and can do whatever you like. Your client may do more: update local databases, and/or access other services. It might do less, using only a few of the available fields and methods.

Developing the client program with its form (25 Textbox and Button controls, 320 lines of logic) is probably the hardest part of developing this bridge application. But most of the logic has been simple because the interface, generated with a few clicks, has handled the difficult bits. And it gets better! In the next article we'll show you how the Bridge architecture makes changes easy.

See our web page if you want more information about MANASYS Jazz and to see what it can do. Contact us if you have any questions, or connect with us on LinkedIn. Download a free evaluation copy to try out MANASYS Jazz yourself. And if you haven't done it already, please repost the link to this series of articles to your colleagues and contacts.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了