Data Access Layer Documentation

March 9, 2009

I tried to find a tool that can trace the dependency between “Data Access Layer” and database tables. I didn’t find a proper tool for that. Actually it’s very important to have this tractability. Especially if any change is required.
I tried to make new tool to maintain this. I started with quick and dirty web application to manage this. It needs a lot of work to be usable. Like:
1- Allow multi-project data to be on one installation.
2- Record the dependency between the Data Access Layer and the business or presentation layer.
Using this Application you can add your database tables. Then, create your Data Access functions and relate them to database table. You can also keep the query for each function. Finally you can get a report showing the dependency between data access layer and the tables.
It’s doing simple job but I think it’s important.
You can download the source code from here


Development on the (Traditional Egyptian Café) Style

January 24, 2009

In the Traditional Egyptian Cafés they are serving customers in a very unique way. The waiter is going to customer to collect the order without single piece of paper. After that he will call the person  making the drinks in a load voice: “And give me 1 cups of tea for Mr. X and make it well” as he knows every customer by name. In Arabic its it will be: “ We Ma’ak Wahed Shai Lee A’am X We Salaho”.

Lately I found out that some software makers are using the same technique. The person in charge will go and meet the customer to collect the requirement. As there is no written one from the customers the customer will tell the requirements verbally. Of course customer will forget or miss some points (X1). After that the person in charge will set with the developer(s) and tell them what the customer requirements are. Again the person in charge will miss or forget some points (X2). The developer again will miss some of the requirements while he is developing the program (X3). Finally, the requirements will be X – X1 – X2- X3= fight to figure out is it in scope or a change request. If you tried to tell them that they are better to write the requirements and singe it off from the customer.  There is no time for this, they will answer.

Let me explain also how much extra time they will spend if they didn’t write the requirements. First, the struggle about the requirements as discussed before. Then, imagine if the developer want to confirm something. As he/she don’t have reference to check in it, he will go back and ask the person in charge about the issue. Sometimes the person in charge also has to get back to the customer to confirm it. What if the tester wants to develop test cases?? The person in charge also has to set with the tester to transfer the requirements (and the same thing will happen). What if there is more than one developer involved in the thing. I will let you imagine how they will work and collaborate.

I can only tell these software makers one thing:

LET THE WAITER WRITE DOWN ORDERS


Comment it… It will run better

January 18, 2009

In the last period, I had to review some code having performance problems.

As a first step, I am running a profiler. Then, in most cases I got this result:

LET US COMMENT THIS

Extra checks, Unnecessary DB transactions or any kind of unnecessary code requires extra processing. It will not be noticeable in simple test case. It will be raised only if a large number of concurrent users hitting the same area or when huge transactions executed.

Here I think the non-functional requirements are very important but unfortunately most of the time it is not given enough attention. Also stress testing is totally recommended.

For developers, don’t comment it just don’t write it will be much better 🙂


ReadOnly TextBox ASP.NET 2008 Can’t be set using js

October 8, 2008

I Tried to create a ReadOnly TextBox in a webpage but when I am trying to set its Text property I can’t see the value in the server side.

To walk arround this issue I added the attribute this way:

txt1.Attributes.Add(“ReadOnly”, “true”);


Data Access Layer Documentation

September 28, 2008

Code documentation is a one from the most effective criteria makes code maintainable and usable. Change management board is relaying on such document also to find out which places the change will affect.

One of the important areas to cover in code documentation is “Data Access Layer”. For me, it should tell me a lot of information:

  • Which tables, stored procedures and DB functions the data access function hits?
  • Which columns from which tables the function retrieves (in case of selection)?
  • What are the conditions filters the data? In addition to grouping and sorting conditions?
  • Information about the connection and transaction.

Sometimes, I use this template for each data access layer function:

Function Name

Database objects

  • Table names
  • Stored procedures
  • Functions

Main operations

  • Table (add/update/remove)

Where conditions

  • Conditions

Group by conditions

  • Conditions

Having conditions

  • Conditions

External Usage

  • functions or modules using this function

 

Using documentation like this, the database administrator can tune the database by creating proper indexes. The requirement change board can decide changes either in database side or application side. In addition to: helping the data access layer functions users and helping developers trying to maintain the code in the future.


Localization in Visual Studio 2005 Web Application

May 18, 2008

A significant improvement in the web application localization have been done in VS2005. Now, the values are assigned automatically in a much better way.

To make your web page localizable:

1- Go to (Tools)

2- Click (Generate Local Resource)

3- wait until getting the following message:Finished creating resource content and adding ‘meta:’ attributes, the progress is now done.

you will find that a new folder named “App_LocalResources” have been created. In this folder you will find that a resource file have been created having the name <your page name>.asp.resx . In this file you will find that all of your controls properties have been added as entries in the resouce file but “Resource1” appended to the controls names.

Now, to add another language to your application you have to copy the resx file and add your culture name before the resx extention. (e.g. Default.asp.ar-eg.resx)

Localization have been improved in this version of Visual Studio but in needs more and more enhancement.


Dumb Localization in .NET 1.1 Web Applications

May 18, 2008

A lot of people always asking about how to localize ASP applications in .NET 1.1

Don’t expect too much from Visual Studio 2003 it provide nothing in this case.

if you want to build a localized web application you have to do it with your code.

and all of the localized controls MUST be server controls as you usually use a resource manager to retrieve the values from resource files and assign it to controls in runtime.

Take care that you need to retrieve the user culture (browser language) from the request object. Because the currentCulture is the server system culture.

You can made a loop to assign the resource entries to the controls properties but it will stay a very stupid process. Always there are keys forgetting and miss-spilling.

The conclusion: It was horrible believe me!!!