30
White Paper A .NET case study: Blackboard as Public Subscribe Christian Gilissen, Bart Meulenbroeks, Maurice Samulski 15th December 2004

White Paper A .NET case study: Blackboard as Public Subscribe

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

White Paper

A .NET case study: Blackboard as Public Subscribe

Christian Gilissen, Bart Meulenbroeks, Maurice Samulski

15th December 2004

Contents

1 Introduction 11.1 Blackboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Research 32.1 Research Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Research Question . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 Method 43.1 Case study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43.2 WhitePaper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.3 Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.4 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

4 Design 74.1 Blackboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74.2 .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84.3 Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.3.1 Extendability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.4 Program Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.4.1 Design Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.4.2 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.4.3 Module Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.4.4 Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.4.5 Sequence Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5 Implementation 145.1 OSSParser in Delphi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

5.1.1 Loginprocedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145.1.2 Parsing courses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.1.3 Differences between Delphi and C# . . . . . . . . . . . . . . . . . . . . . . 15

5.2 OSSControl in J# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175.3 OSSEmail in J# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

5.3.1 E-mail component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.4 OSSDB in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.4.1 Database access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.4.2 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.4.3 Solutions and Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205.4.4 Assemblies and DLL’s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5.5 WhitePaper (the merge) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.5.1 Merging in Delphi8.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.5.2 Merging in Visual Studio .NET 2003 . . . . . . . . . . . . . . . . . . . . . . 21

1

6 Conclusions 226.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

6.1.1 Realized Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226.1.2 Realized results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

6.2 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

2

List of Figures

1.1 .NET Basic[1] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

4.1 Database design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.2 Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.3 Class Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.4 Sequence Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5.1 Login procedure blackboard (technical) . . . . . . . . . . . . . . . . . . . . . . . . 14

3

List of Tables

3.1 Timetable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

5.1 Features of C# that Delphi hasn’t . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

6.1 Realized timetable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

4

Abstract

In this case study we examine the use of .NET as a tool for middleware development. For this weextend the Blackboard system with a push technology, given a very limited amount of resources.The application consists of four main modules implemented in three different .NET languages thateach handle a distinct functionality. We look for any kind of trouble in using and combining thesethree languages in .NET, but we are only able to find some minor difficulties. We then concludethat .NET really is a good tool for developing middleware, although we would have wished forsomething more interesting to report.

Chapter 1

Introduction

This research was conducted for the middleware project of the “Development of Large SoftwareSystems” course at the Radboud University of Nijmegen. The central subjects of this course arearchitecture, implementation and maintenance of large software systems. Typically these systemsconsist of a large number of cooperating components that are programmed in different periods oftime by different people with different goals using different programming languages. Middlewareplays an important role in producing these systems.The remainder of this introduction is about what Blackboard and .NET are, and is meant onlyfor the unfamiliar reader.

1.1 Blackboard

The Blackboard software is used at the Radboud University mainly for communication fromteachers to students. Teachers can add courses to which students can subscribe. They can thensee announcements, assignments etc. posted by the teacher of the course. Blackboard has a lot ofother fancy features, but most of them are seldom used. For a complete description of Blackboardsee the Blackboard webpage http://www.blackboard.com/products/index.htm.

1.2 .NET

Microsoft .NET is a software platform for developing numerous sorts of platform-independentapplications. .NET focusses a lot on web-services and uses a component-oriented programmingparadigm. In this respect it largely replaces the former component object model (COM). It offers:

• The Common Language Infrastructure (CLI) is a virtual machine and a standard class library(the Common Language Runtime is designed to be programming language and operatingsystem independent). The virtual machine executes the Common Intermediate Language(CIL) assembly.

• Access to components written in other languages and the underlying Microsoft Windowsplatform

The CLI is designed to provide support for any object-oriented programming language, sharing acommon object model and a large common class library.Microsoft and other vendors provide .NET versions of many languages, including:Built-in languages:

• C# programming language

• Visual Basic .NET, an improved, version of the classic Visual Basic programming language

1

• J# a programming language that resembles JAVA

There are also a lot of third-party languages available:

• FORTRAN

• Delphi 8 which is also called Delphi for .NET.

• COBOL

• Perl

• Python

• F sharp programming language

• Lisp

• Smalltalk

Figure 1.1: .NET Basic[1]

2

Chapter 2

Research

It is our intention to use the .NET environment to create a public subscribe system that extendsthe Blackboard digital learning environment with a push1 technology opposed to the current pull2

technology. As it is, one has to check Blackboard for any changes, which can obviously becomepretty annoying.We will call this system the same as our project: Whitepaper.

2.1 Research Goal

We see the goal of this project as: “To report on .NET’s qualities in developing middleware”

2.2 Research Question

Our main research question is: “How suited is .NET for developing middleware”.We think we can answer this question sufficiently when we have found an answer to the followingquestions:

1. Is it possible to develop a publish subscribe system for Blackboard with the use of .NET inthe circumstances that:

• The project time is only 7 weeks,

• The project team consists of only 3 people,

• There are no special Blackboard interfaces available except for the default web interface,

• None of the project members has (prior to the project) any experience in the use of.NET,

• None of the project members has (prior to the project) any knowledge of the internalsof Blackboard.

2. How easy3 is it to use multiple different programming languages in .NET for the constructionof one program?

1Webopedia defines this as: Push - In client/server applications, to send data to a client without the clientrequesting it.

2Webopedia defines this as: Pull - To request data from another program or computer.3“Easy” as in: What additional steps/learning is required

3

Chapter 3

Method

3.1 Case study

As a research method we use the case study. A case study can be defined in many ways. Like:

Rather than using large samples and following a rigid protocol to examine a limitednumber of variables, case study methods involve an in-depth, longitudinal examinationof a single instance or event. It is a systematic way of looking at what is happening,collecting data, analyzing information, and reporting the results. The product is asharpened understanding of why the instance happened as it did, and what mightbe important to look at more extensively in future research. Thus, case studies areespecially well suited toward generating, rather than testing, hypotheses.1

Or:

1. A detailed analysis of a person or group, especially as a model of medical,psychiatric, psychological, or social phenomena.

2. (a) A detailed intensive study of a unit, such as a corporation or a corporatedivision, that stresses factors contributing to its success or failure.

(b) An exemplary or cautionary model; an instructive example.2

We use a case study as a research method mainly because we don’t yet have enough informationto make any hypotheses about .NET as a tool for developing Middleware. This is intended as aexploration of the use of .NET. Or in other words:

Researchers do not focus on the discovery of a universal, generalizable truth, nordo they typically look for cause-effect relationships; instead, emphasis is placed onexploration and description.3

Because of this we’ve chosen to implement our application in three different programming lan-guages as to research one of .NET’s main features: Multiple programming languages. We’vechosen to work with:

• Borland Delphi for .NET Because this programming language is not a native Microsoftlanguage.

• C# Because this is a programming language entirely developed by Microsoft.

• J# Because this is a programming language based on a programming language that is notowned by Microsoft.

1According to Wikipedia2According to The Free Dictionary3According to the Colorado State University

4

3.2 WhitePaper

In this section we describe the functionality that our program (WhitePaper) should have. Toachieve its goal, WhitePaper should at least implement following functionality:

1. WhitePaper should be able to retrieve login information from some kind of storage.

2. WhitePaper should be able to login to Blackboard and retrieve information from its pages.

3. WhitePaper should be able to store this retrieved information in some kind of storage.

4. WhitePaper should be able to send E-mails to users containing information about Black-board.

When achieved, we have effectively extended Blackboard with push functionality.

3.3 Planning

For our research we used following timetable:

Table 3.1: Timetabletaskname period description start endDesign 1 week db-layout, software modules, in-

terfaces, requirements2004/11/01 2004/11/08

Implementation 2 weeks building a first prototype 2004/11/08 2004/11/22Testing 1 week testing / cleaning / fixing 2004/11/22 2004/11/29Evaluation 0 weeks adaption of timetable / require-

ments2004/11/29 2004/11/29

Implementation 1 week enhancing prototype 2004/11/29 2004/12/06Testing 1 week enhancing + testing 2004/12/06 2004/12/13Report and pre-sentation

1 week Writing report and presentation 2004/12/13 2004/12/20

Presentation 0 weeks Giving the presentation 2004/12/20 2004/12/20Total 7 weeks Application, Sourcecode, report 2004/11/01 2005/01/10

3.4 Tools

For our research we used some interesting tools.

Microsoft Visual Studio 2003

Microsoft Visual Studio is an IDE mainly used in combination with .NET. Visual Studio providessupport for C#, Visual Basic, C++ and J#, as well as webservices with asp.NET. The look-and-feel of Visual Studio is nearly identical to previous versions of the IDE. The IDE provides a lot offeatures that come in handy while programming:

• Different solution views, project views, class view, files view.

• Detailed status windows for debugging, which hide when not used

• Possibility to hide code

• Simple compilation interface

5

Microsoft SQL server

Microsoft SQL Server is a database management system produced by Microsoft. It supportsa dialect of SQL, called T-SQL, or Transact-SQL which adheres to the SQL standards, and iscommonly used in combination with other Microsoft development tools (such as .NET of course).SQL server also supports Open Database Connectivity (ODBC).

6

Chapter 4

Design

4.1 Blackboard

• My Blackboard. Once the student has logged in, this window appears. It provides a listingof all the announcements, courses and calendar items that the student is associated with, ata central location. On the left side there is a box called Tools with a link to Announcements.Clicking it will lead to a list of all announcements1. At the top there are three tabs for easynavigation: My Blackboard, Courses and Communities.

• Courses. The tab courses brings you to a complete list of courses in which you are enrolled2.When you click at a course it transfers you to the corresponding course page.

– The Course Page: On the left you have the Navigation Area. It consists of a row ofbuttons along the left side of the page. The amount of buttons can differ from courseto course. The teacher decides which blackboard features he wants to make available tothe students. We assume that the default buttons are enabled which gives the studentaccess to the following:

∗ Announcements. The student can access course announcements by selecting To-day, Last 7 Days, Last 30 Days or All by clicking on the corresponding tab. One ofthe strange things we noticed is that when we select All, the announcements aren’tsorted in any way. We expected to see a chronological ordering in the listing ofannouncements. This section is considered as one of the most important sectionsto watch for a student, therefore this section will be monitored for changes by ourapplication. If we look in more detail to announcements, they have the followingattributes: announcementdate, a unique course ID (eg. BFCA-FMT003B-4A-2004),title, the person who posted the announcement and last but not least the announce-ment text itself (in HTML format).

∗ Course Information. Normally this section doesn’t change in time and containsinformation about the course itself; a study guide.

∗ Staff Information. This section enlists the staff teaching the course with all therelated information including name, e-mail, work phone, office location, link towebpage and photo. Normally this section isn’t updated throughout the course.

∗ Course Documents containing course outlines, powerpoint slides, handouts, lec-ture materials, related readings, etc. This section is considered as an importantone which we will closely watch for changes in our application.

1This list contains all announcements of all the courses in which a student is enrolled. It’s produced by a Perlscript announcement.pl which is used to retrieve all the announcements.

2This list of courses is produced by a Perl script courses.pl which we use to retrieve all courses a student has beenenrolled in. A course has the following attributes: a course titel, a unique course ID (eg. BFCA-I00066-4A-2004),the instructor(s) and a directlink to the course.

7

∗ Assignments containing course assignments, tests, quizzes and surveys. Anothersection we will monitor for changes.

∗ Communication. Several communication methods are offered to the student:Collaboration, Discussion Boards (this is an asynchronous tool used for threadeddiscussions), Group Pages (the instructor can divide the class into study groups,project groups, etc.), Roster and Send Email (works only within Blackboard).These functions aren’t important for our application so we will not discuss themin further detail.

∗ External Links. Links to external resources, mostly to third party webpages. Wemight want to monitor this section in the future.

∗ Tools for the student: Address Book, Calendar, Digital Drop Box (This allowsinstructor and students to exchange files by uploading a file to a central location),Edit Your Homepage, Electric Blackboard (this is a synchronous chat room), Per-sonal Information, Student Manual, Tasks, View Grades. Again these features arebarely used and are not interesting enough to monitor.

• Communities. The tab communities gives a overview of all organizations in which you areparticipating. At the Radboud University these communities are rarely used.

4.2 .NET

.NET makes use of the Common Language Runtime (CLR). At a high level, the CLR is simply anenvironment which takes IL instructions, translates them into machine instructions and executesthem. All language compilers under .NET will generate this uniform, common language calledIntermediate Language (IL) no matter what language is used to develop an application. Infact, CLR will not be aware of the language used to develop the application, because equivalentprograms coded in different languages (eg. ”Hello World!” in C#, Delphi, etc) will generate theexact same IL. Therefore one of the things each language using the CLR has to do is mappingthe language’s unique types to a common set of types defined by the CLR. Delphi’s Real type forexample, will be mapped to the IL type float32. These mappings allow true integration betweenlanguages.

So far only positive aspects, but there may also be a negative aspect: speed. Although we didn’texperience any performance problems implementing our application, it could be that our programruns slower than an equivalent C/C++ program - or any other program that is compiled intomachine language. One of the reasons is that some specific C/C++ constructs which are focusedon speed can’t be translated to IL with the same performance characteristics.

4.3 Database Design

The database design was developed to be easily extendable. For now we only implemented receivingupdate information on announcements and assignments, but of course there are a lot of otherBlackboard subjects we can imagine one would like to receive update information on.

8

Figure 4.1: Database design

• student:This table stores all basic information about a student:

– studnr: the studentnumber of a student, necessary as a username to login to Blackboard.This is also the primary key.

– password: the password that is necessary to login to Blackboard. This is stored en-crypted.

– email: the email address the student wants to receive his update information on.

• followscourse:This is a mapping table. This table allows mapping multiple students to multiple courses.

– studnr: the primary key of the student table. (part of the primary key for the follows-course table)

– coursecode: the primary key of the course table. (part of the primary key for thefollowscourse table)

• course:This table stores all basic information about a course.

– coursecode: A unique code that identifies a course. This is also the primary key.

– name: the name of a course.

• announcement:This table stores announcements posted on Blackboard.

– coursecode: the code of the course that this announcement belongs to. (part of theprimary key)

– title: title of the announcement. (part of the primary key)

– date: the date that this announcement was posted on Blackboard. (part of the primarykey)

– text: the body of the announcement.

• assignment:This table stores assignments posted in Blackboard.

9

– coursecode: the code of the course that this assignment belongs to. (part of the primarykey)

– title: title of the assignment. (part of the primary key)

– date: the date that this assignment was posted on Blackboard. (part of the primarykey)

– text: the body of the assignment.

4.3.1 Extendability

As already mentioned the database is designed to be easily extendable. We think of future exten-sions like:

• additional update information about for example tasks or course documents:We can simply add another table and link it to a course with a coursecode.

• subscription for only certain updates from certain courses:We can simply add attributes to the user table with references to announcements, assign-ments and the course tables.

4.4 Program Design

4.4.1 Design Method

As a design method, we’ve chosen for the Unified Modeling Language (UML). This is one of thefew real modeling languages that we’ve all got some experience in. Furthermore it is completelysupported by Visual Studio and Microsoft Visio. It is possible to develop a model in Visio andthan have the proper code generated into Visual Studio. We however did not make use of thisfeatures because of our inexperience with it.UML is a modeling and specification language mainly meant for object-oriented software develop-ment and it is based on “best-practices” that have been proven successful in software development.We only used some diagrams from the UML model; Because of the relative small size of thisproject we deemed it not useful to construct all UML diagrams.

4.4.2 Design

For program design we divided the program in separate modules that are each responsible for oneclear defined functionality. Each module should be able to function independently from others.We make one exception, because there obviously needs to be one module that coordinates andcontrols the other modules. We call this module the OSSControl module. Each module offers aninterface to the outside world with which the module can be controlled. Changes to one moduleshould not effect the other modules.

4.4.3 Module Communication

For the communication between the modules we use a common data structure. Depending onwhat information we need, only parts of this data structure are used. This is only for reasons ofefficiency! This can be seen by looking at the methods Get UserCollection and Get Users. Thedifference between them illustrates the usage of parts of the datastructure. Get UserCollectionreturns all users with all their courses, and all announcements and assignments, while Get Usersreturns only the users with their properties, without any course information.

10

Figure 4.2: Data Structure

Figure 4.3: Class Diagram

11

4.4.4 Class Diagram

• OSSParser:This module is responsible for the contact with Blackboard. The module needs users infor-mation as an input and uses this to connect3 to Blackboard and parse information from theBlackboard pages.

• OSSDB:This module is responsible for the contact with the database that stores all information.The module provides an interfaces to retrieve and post information to the database.

• OSSEmail:This module is responsible for all outgoing contact with students. This is done by e-mailingstudents about relevant updates on Blackboard.

• OSSControl:This module is responsible for the contact with all modules. The control module is the heartof the application. It does all requests to other modules.

3Connecting to Blackboard is not trivial as will be explained later

12

4.4.5 Sequence Diagram

As shown in following sequence diagram, the OSSControl module coordinates all actions.

Figure 4.4: Sequence Diagram

13

Chapter 5

Implementation

5.1 OSSParser in Delphi

5.1.1 Loginprocedure

Figure 5.1: Login procedure blackboard (technical)

Logging into Blackboard without a “normal” webbrowser involves some knowledge about the loginprocedure BlackBoard uses. Behind the scenes there happens more than just sending the useridand password of the student. The figure above shows what exactly has to be done to correctly loginto the BlackBoard system.When a user accesses the homepage of Blackboard http://blackboard.ru.nl/ he gets an introductionscreen with only one button, namely ’Login’. If he clicks that button he gets transferred tohttp://blackboard.ru.nl/webapps /login and gets a HTML form on which he can fill in his usernameand password. In the source code of this HTML page you will see that there are some hiddenvalues being created. Most of them are unimportant but we definitely need the hidden valueone time token. This token is generated when we go from the intro page to the login page. Goingdirectly to the login page doesn’t work. This one time token is 128 bits long.

14

Before the entered password is sent to the login page it first becomes encrypted with the MD5algorithm. BlackBoard uses a clientside javascript for accomplishing this. The MD5 function inthis downloadable javascript is not fully compliant with the MD5 function in the .NET framework.The BlackBoard MD5 function converts the password to an ASCII encoding and returns the MD5hash as a string of 32 chars containing 16 hexadecimals. The MD5 function of .NET uses defaultUnicode encoding and returns the 16 hexadecimals separated with hyphens. Luckily the .NETframework contains functions to convert from one format to another.When the password is MD5 encoded it becomes concatenated with the one time token, result-ing in a string of 64 chars which gets encoded again with the MD5 algorithm. The resultingvalue is then send to the script /webapps/login which redirects to the mainpage of blackboard/webapps/portal/frameset.jsp.

5.1.2 Parsing courses

The BlackBoard system uses a perl script, located at /bin/common/courses.pl, which shows allcourses in which a student participates. This information is presented in HTML format and hasto be parsed. A course has the following attributes:

• URL : The URL links directly to the course information page

• Name : The name of the course (e.g. Ontwikkeling van grote Softwaresystemen)

• Code : The unique code of the course (e.g. BFCA-I00066-4A-2004 )

• Instructors: The instructors who give this course (e.g. Marko Eekelen)

5.1.3 Differences between Delphi and C#

During the implementation of our system we discovered some (mostly minor) differences betweenDelphi.NET and C#. We first take a look at C# and compare it to Delphi to see what C# featuresare missing in Delphi. We also present for each missing feature a possible solution or work-around.

15

Table 5.1: Features of C# that Delphi hasn’tFeature Possible solution / work-aroundforeach Enum := AnArrayList.GetEnumerator;

while Enum.MoveNext dobeginMyObject := TMyObject(Enum.Current);//do the things you want with MyObject

end;case statements with strings var

SelectStrings: TStringList;...// InitializationSelectStrings := TStringList.Create;SelectStrings.Add(’First’); (*1*)SelectStrings.Add(’Second’); (*2*)SelectStrings.Add(’Third’); (*3*)...// Use itcase SelectStrings.IndexOf(sPassedString) of0: //Firstbegin<do something>

end;1: //Secondbegin<do something>

end;2: //Thirdbegin<do something>

end;end;

assignment operators You can’t use these ’shortcuts’,(+=, ++, -=, etc) a += b has to be written as a:=a+bcircular references Occasionally, you’ll have a situation in whichare possible UnitA uses UnitB and UnitB uses UnitA. This is

called a circular unit reference. Theoccurrence of a circular unit reference isoften an indication of a design flaw in yourapplication; The optimal solution is oftento move a piece of data that both UnitA andUnitB need to use out to a third unit.However, as with most things, sometimes youjust can’t avoid the circular unit reference.Note that circular references in both theinterface or implementation section areillegal. Therefore, in such a case, move oneof the uses clauses to the implementation partof your unit and leave the other one in theinterface part. This usually solves theproblem.

can use classes from n/anamespaces withoutimporting the wholenamespace

16

5.2 OSSControl in J#

J# is a transitional language for programmers of Suns Java and Microsofts J++ languages, sothey may use their existing knowledge, and applications on Microsofts .NET platform.There are however some major differences between the Java Architecture and the .NET Architec-ture.

• Java is a cross-platform language (which will run on every Operating System as long asthere is a Java Virtual Machine for it) while programs written in J# can only run on theWindows-platform.

• J# code is compiled to MSIL (Microsoft Intermediate Language), which is a native languageitself. This language is compiled again on a computer when it is executed. On the otherhand, Java code is compiled to Java bytecode. Java bytecode is not a language but can beinterpreted by the JVM (Java Virtual Machine). Unfortunately interpreting bytecode takessome time, this is why Java is much slower.

The heart of the application is OSSControl. It directly controls the other classes.

• Get a list of users from OSSDBThis list can be used to check for changes for these students on Blackboard.

• Check on changes for each student:

– LoginUse the studentnumber and password to login on Blackboard.

– Get all coursesGet all the courses in which a student is enrolled.

– Verify coursesCheck if all courses are in the database. If not, the student is enrolled in the newcourses and the student receives an e-mail1.

– Check for each course:

∗ Check on new announcementsIf there is a new announcement on Blackboard, insert it into the database and sendthe student an e-mail1.

∗ Check on new assignmentsIf there is a new assignment on Blackboard, insert it also into the database andsend the student an e-mail1.

– LogoutEverything for this student is checked and changes will be send by e-mail. Now logoutfor this student.

• Send all collected data to OSSEmail so it can notify all students. At this moment, this isdone after a complete run to check for changes2.

5.3 OSSEmail in J#

OSSEmail is responsible for sending e-mails to the students. Although the .NET Framework hasthe possibility to send mail, we have decided to use a third party component because it is easierto use and has some additional features (like sending HTML messages with alternative body textand message queuing3).

1The e-mail will be send later on in the application2See OSSEmail in J# (section 6.3) for more details3Which is not used in our program but is necessary for a large group of students

17

5.3.1 E-mail component

The e-mail component is responsible for delivering the e-mails to the subscribed students. Theinternet provides a large lists of components which are capable of doing this. All components havetheir own benefits but the differences are minimal (mostly different styles of implementation).Most of the components have a trial-version which can be used. These trial-versions are limitedand most components can not sent multiple e-mailmessages at once. For our project, this is notimportant because we will not be sending large amounts of e-mail. When Whitepaper would beavailable for a large group of students, a component capable of sending multiple messages at once(message queuing) is required.The component, which is used, is called freeSMTP.Net and is developed by Quiksoft. It offers asimple and complete way to send e-mails. This component can be freely used as long as applicationsare not distributed or sold for profit.The most easy way, although not used in the program, to send an e-mail is used in the followingcode.

import Quikso f t . FreeSMTP ;

pub l i c c l a s s OSSEmail{

pub l i c void sendMail ( ){

SMTP. QuickSend ("mail.server.nl" , "[email protected]" ,"[email protected]" , "Subject" , "Body Text" ,BodyPartFormat . Pla in ) ;

}}

As mentioned before, the component can send only one email at once. If Whitepaper would beavailable for a large group of students, Quiksoft offers a solution called SMTP Express. This is ane-mail queuing and delivery system. It intercepts messages and sorts, queues, and reliably deliversthe messages in the background.Without SMTP Express, the system would work but it would be much slower. SMTP Expresssends up to 64 e-mailmessages at once1 which make the program much faster.

5.4 OSSDB in C#

In summary coding in C# is pretty easy if you have only some experience in a really ObjectOriented language like for example Java. The Visual Studio environment is a major help. It checkssyntax on the go, has name completion, produces sensible error reports and has the possibility tohide blocks of code from you, making everything a lot more synoptic.

5.4.1 Database access

Accessing a SQL-Server database with C# is pretty easy. .NET provides many Microsoft DataAccess Components: ADO, OLE DB, OLE DB Providers, and ODBC.The .NET Framework Data Provider for ODBC describes a collection of classes used to access anODBC data source. Using the OdbcDataAdapter class, you can fill a memory-resident DataSet,which you can use to query and update the data source.Second one can use SQLConnections. A SqlConnection object represents a unique session toa SQL Server data source. In the case of a client/server database system, it is equivalent to anetwork connection to the server. SqlConnection is used in conjunction with SqlDataAdapterand SqlCommand to increase performance when connecting to a Microsoft SQL Server database.

1There is a professional version available which sends up to 256 message at once

18

Because of it’s ease in use we’ve chosen to use SQLConnection objects for our database connec-tions. A SQL command performed with an SQLConnection will usually have a form like this:

// connec t i onSt r ing i s a s t r i n g with database l o g i n in fo rmat ion in a// s p e c i f i c formatSqlConnection sq lConnect ion = new SqlConnect ion ( connec t i onSt r ing ) ;t ry{

SqlCon . Open ( ) ;}catch ( Exception e ){

throw new Exception ("Could not open the database: " +e . Message , e ) ;

}SqlCommand sqlCommand = new SqlCommand( some SQL String , sq lConnect ion ) ;

t ry{

reader = sqlCommand . ExecuteReader ( ) ;}catch ( Exception e ){

throw new Exception ("Could not execute " + some SQL String , e ) ;}

whi le ( reader . Read ( ) ){

// do something with the data you got back from the SQL statamentreader [ t ab l e f i e l d name ] . ToString ( ) ,

}reader . Close ( ) ;sq lConnect ion . Close ( ) ;

In our case it would have probably been very helpful if we could have used an Object OrientedDatabase. An object oriented database can directly read and write complete objects to a database.However, because of our lack of knowledge in working with object oriented databases we decidedto make the safer choice and work with SQL Server.

5.4.2 Classes

The only interesting thing with building classes was that set properties make use of a specialvariable named “value”. This variable holds the value that was given to the set property whenevoked.

pub l i c s t r i n g Name{

get{

re turn name ;}s e t{

name = value . Trim ( ) ; ;

19

}}

Most other programming languages just use a parameter for the set property to achieve this.A problem with our class structure was that although it looked very nice to be continuously passingthrough the same datastructure, there would be a lot of duplicate information. In the database weuse key references to avoid storing duplicate information. With the use of ArrayList for classes, wecan easily enumerate all interesting data and their relevant relationships, but we also create a lot ofduplicate information. For this reason we decided it is best to only pass around the datastructuresthat are really useful. For example when retrieving announcements from blackboard, the parser isonly interested in usernames and passwords (the parser will simply parse all course information).Not in what courses a student takes etc. So the db module provides an interface for just retrievinguser information, without courses, announcements and assignments.

5.4.3 Solutions and Projects

While developing in the Visual Studio there was the need for developing multiple projects. At firstthe datastructure was developed. Developing an independent set of functions or classes is donewith a classlibrary type of project. A classlibrary can be used by other projects (Just like theuse of the System classlibrary). After that the database module was developed in a classlibraryas well. A classlibrary can however not run on itself, so for testing a classlibrary, one needs toinclude the library in some other project that is executable. (For instance a WindowsApplicationproject) But when used in a windowsapplication project it is very hard to debug a code library,because only the code of the executable program can make use of the debugging facilities.However there is a “Solution” to this problem. It is possible to use Solutions in Visual Studio: aSolution is a collection of projects that in some way belong together. When adding the windows-application, the database module and the datastructure to one solution, we can debug all of themat the same time.There are however some other things that have to be done before one can really debug all theseprojects at the same time:

1. For the classlibrary projects, one has to set debug information explicitly on within thecompilation options.

2. All projects should be build as debug build and not as release.

It is however some disappointment to see how much slower compilation and execution has thenbecome.

5.4.4 Assemblies and DLL’s

A .NET component is known as an Assembly. An assembly is an atomic unit. It doesn’t justcontain the code but also it’s meta data. This meta data is contained in a data structure calledManifests. With a DLL , the manifest is incorporated with the code itself. The Manifest containsthe following information :

• The identity of the assembly which consists of it’s name and version.

• Names of all the files in the assembly.

• An encrypted hash of all the files in the assembly. This hash is used to detect changes inthe files.

• Class details (properties, methods public, private etc.)

• Names and hashes of all the assemblies that the current assembly references.

20

Because the assembly already contains information about itself, DLL’s do not need to be registeredin the registry anymore. This is particularly convenient for network applications, that usually hadto register all their components at each network client.With Multifile assemblies the problems with different version DLL’s is also solved. You can justpack up different versions of a file in one DLL, and the appropriate version will always be used.

5.5 WhitePaper (the merge)

5.5.1 Merging in Delphi8.NET

At first we tried to merge the datastructure classlibrary made in C# with the OSSParser madein Delphi. We tried to merge these in the Delph8.NET IDE, but soon ran into some trouble witha .DCUIL file. The purpose of a .DCUIL file is to provide symbolic information to the compilerabout certain language constructs that can’t be generated from the CLR metadata alone. Itmakes the compiling process faster than for example the C# compiler, but for some reason thisfile sometimes doesn’t get updated properly. The result is that Delphi just compiles the old codeinto the executable regardless of what you changed in the sourcecode. The solution we came upwith is deleting the corresponding .DCUIL file and let Delphi regenerate it.Another similar problem we came across is the following. If we reference to an assembly madein an other language, Delphi generates a .DCPIL file for it which contains the symbols of theassembly dll. One of the purposes is that Delphi can quickly lookup the available assemblymethods and properties.However, if you update the assembly dll with a new version without changing the internal version,date or timestamp of the assembly, Delphi doesn’t know it’s updated and it doesn’t regeneratethe .DCPIL file. When you lookup the available methods and properties of that assembly, Delphishows the old list (stored in the old .DCPIL file). The dirty solution to this is to delete the.DCPIL file and let Delphi regenerate it. The better solution would be to let Visual Studioautomatically adjust the version of the assembly when you (re)build it and adjusting its timestamp.

5.5.2 Merging in Visual Studio .NET 2003

As mentioned before, we split up Whitepaper in 4 different modules, OSSDB (written in C#),OSSParser (written in Delphi.NET), OSSEmail (written in J#) and finally OSSControl (alsowritten in J#). The last module, OSSControl, is connected to the 3 other modules which aredeveloped separately.Having 3 assembly-files it is fairly simple to use these class-libraries in Visual Studio. Once createda project for OSSControl, you can simply add references to your project. By creating referencesto OSSDB, OSSParser and OSSEmail (the files), they are imported into your project and you canuse them like all other classes.When we started the project, we expected it would be very difficult merging the different modules(program languages). We did not expect it would be this easy by just adding some references.

21

Chapter 6

Conclusions

6.1 Conclusions

6.1.1 Realized Planning

In reality our timetable looked somewhat different from the planned timetable. In detail, weundertook following activities during those weeks:

Table 6.1: Realized timetableWeek Activities ReportWeek 1 Installing Visual Studio, developing basic design timetable, planningWeek 2 Building modules, changing design layout, researchWeek 3 Building modules IntroductionWeek 4 Code cleaning, enhancing modules Method, DesignWeek 5 Code cleaning ImplementationWeek 6 Merging modules, testing restructureWeek 7 Merging modules Conclusions, Finishing

It is clear to see that our realized timetable differs a lot from our planning. There are a few reasonsfor this:

• Writing the report was not as planned, a one week job. There was a lot of emphasis onwriting a good report and so we decided to write the report on the go.

• Merging our modules was more of an organizational task than a technical one. We neededone system were we could all work on, with Visual Studio and SQL Server installed properlyand all our sources.

• Because of some other courses we were doing some planned weeks we were just too busy, toget together.

6.1.2 Realized results

In the end we have realized following results:

• We have build the WhitePaper application with the functionality that was required

• We have learned about .NET and three of its languages (C#, J#, Delphi.NET)

• We have learned about .NETs capabilities in developing middleware

22

• We have written a full report on our case study of .NETs capabilities in developing middle-ware

Implementing all our required functionality, went with relative ease. Learning .NET, or any of itslanguages was no real challenge, which might be explained by our prior JAVA knowledge. TheVisual Studio .NET IDE was a great help, and made the learning process go very smoothly.Looking at our research questions we can say that:

• We did build a public subscribe system for blackboard in .NET in only 7 weeks without anyprior knowledge of .NET. Thus we can answer our first research question with: Yes

• We implemented our application in three different programming languages and then tied itall together. This went without any serious problems, so we can also answer our secondresearch question with: Pretty easy

And from these 2 answers we can conclude that .NET seems very suited for developing middleware.This is a somewhat disappointing result as we hoped to report on some difficulties that Microsoftdid not mention in advertising its .NET system. Unfortunately, we didn’t find any real problems.

6.2 Recommendations

When developing middleware, .NET is a very appropriate tool. It offers a wide variety of program-ming languages which can be used together almost seamlessly. The learning time for the native.NET languages is very small due to the Visual Studio IDE and the Microsoft Developer Network(MSDN) which offers a complete function reference with code examples for each native .NETlanguage. Furthermore, the use of multiple different programming languages poses no problem atall, and is very near as simple as advertised.

23

Bibliography

[1] “.NET”, from Microsoft.comFound at: http://www.microsoft.com/net/basics/whatis.asp

24