CIPS logo

Canadian Information Processing Society

 

CIPS logo

 

 

News from National -- Current Articles

6/13/2002 7:59:22 AM
Developer & Trainer Paul Sheriff
Interview by S. Ibaraki, I.S.P.

This week, Stephen Ibaraki, I.S.P., has an exclusive interview with Paul Sheriff. Paul is an internationally known application developer and world renowned courseware developer/trainer. He writes regularly for Microsoft publications and for their web site and was named the top MSDN Regional Director. Paul has appeared in hundreds of videos and live Internet broadcasts as an international expert. He has amongst the highest ratings for his development, writing, video, and training work. We were able to catch-up with him at his corporate headquarters in Tustin Ca. – PDSA Inc. http://www.pdsa.com.

*****
Q: Paul, thank you for taking time out of your very busy schedule and agreeing to this interview.
A: I am very happy to have the opportunity to share any insights I might have with you and your audience.


Q: I initially caught your work through your excellent videos. How did you get into this area and into courseware development/training?
A: I started training other programmers approximately 15 years ago. I really enjoyed it and I found out that when I had to teach something it made me a better programmer! Besides training at my local company, I started to do public seminars with a seminar company doing Clipper training. I then started to create my own courseware since I could not find anything out there that I liked to teach from. Over the years I have refined my techniques of training from trial and error. About 7 years ago, I got involved with doing video training. It was a natural progression after doing so many live seminars.


Q: In my trips to California to do Internet broadcasts, they always mention this one [other] person. You are quite legendary at Smartforce: tops professionally, quick and thorough, and everything completed in one take. How did you get involved with Smartforce?
A: I actually got into SmartForce through the Vice President of my company. His wife worked for SmartForce so she made the initial introductions. I then did a couple of videos and web casts with the SmartForce team. They liked my work and their customers liked the content, so they have continued to use me and my material in their broadcasts.


Q: What have you learned from your video and Internet broadcast work? Can you provide us with your tips?
A: The first tip I can give you is to BE PREPARED! Most trainers do not take the time to prepare their material. Secondly PRACTICE! Unless you have rehearsed your material out loud, you do not know the timing to use, or how long the presentation will be. Third, always have more material than you need. It is easier to cut a presentation short, then it is to add material.


Q: Your articles consistently get the highest ratings. Can you provide some tips from your most recent articles about .NET and .NET development?
A: Thank you. I work hard to make my articles real-world. I always try to provide practical information that can be used right away in someone's work. Here are a few .NET tips & tricks:

I have had a lot of people ask me how to loop through all the controls on a web page. It is actually very similar to looping through controls in a VB6 program, except that you need to remember that all of the server controls are embedded within the "Form" control which is a server control as well. So the first thing you have to do is to find the control of the type "HtmlForm". Once you have the index of this control, you can now loop through all the controls within this control as shown in the following ReadControls procedure.


***********************************************
* Reading controls in a Web Page
***********************************************
 
Private Sub ReadControls()
  Dim ctl As Control
  Dim intIndex As Integer
 
  ' First find the Form object
  For Each ctl In Page.Controls
    If ctl.GetType Is GetType(Web.UI.HtmlControls.HtmlForm) Then
      intIndex = Page.Controls.IndexOf(ctl)
      Exit For
    End If
  Next
 
  ' Loop through all controls within Form Control 
  ' which is at Postion 1 in the Controls Collection
  For Each ctl In Page.Controls.Item(intIndex).Controls
    If ctl.GetType Is GetType(TextBox) Then
      Response.Write(CType(ctl, TextBox).ID & " = ")
      Response.Write(CType(ctl, TextBox).Text & "
")
    End If
  Next
 
  ' You may also access a control directly using FindControl
  Response.Write("
")
  Response.Write(CType(Page.Controls.Item(1).FindControl("TextBox2"), TextBox).Text)
End Sub
 
 
***********************************************
Transactions using ADO.NET
***********************************************

Below is some sample code on how to perform a transaction using the ADO.NET OleDb namespace. As you will see there are some big changes from ADO to ADO.NET. There is an OleDbTransaction object that holds the transaction information. You must give this transaction object to each command prior to executing the SQL that modifies the database. Once all your commands have been submitted, you then perform a Commit() method on the Transaction object. If things were not successful you perform a RollBack() on the Transaction object.


  Public Sub TransactionSample()
    Dim cnn As OleDbConnection
    Dim trans As OleDbTransaction
    Dim cmd As OleDbCommand
    Dim strConn As String
    Dim strSQL As String
 
    strConn = "Provider=sqloledb;Data Source=(local);Initial Catalog=Northwind;User ID=sa"
 
    Try
      cnn = New OleDb.OleDbConnection(strConn)
      cnn.Open()
      trans = cnn.BeginTransaction()
 
      strSQL = "INSERT INTO Customers(CustomerID, CompanyName) VALUES('ATEST', 'A Company Name')"
      cmd = New OleDbCommand(strSQL)
      cmd.Connection = cnn
      cmd.Transaction = trans
      cmd.ExecuteNonQuery()
 
      ' Now update the row
      strSQL = "UPDATE Customers SET CompanyName = 'A New Company' WHERE CustomerID = 'ATEST'"
      cmd.CommandText = strSQL
      cmd.Transaction = trans
      cmd.ExecuteNonQuery()
 
      ' Commit the Transaction
      trans.Commit()
 
    Catch exp As Exception
      trans.Rollback()
 
      MessageBox.Show(exp.Message)
 
    Finally
      If cnn.State = ConnectionState.Open Then
        cnn.Close()
      End If
 
    End Try
  End Sub

The DataTable Class:
A DataTable is a .NET class that is similar to a relational database table. It is made up of rows of data with each row (called a DataRow) having a set of columns (called DataColumn objects). Each column can have a name, a data type and other attributes assigned to it such as ReadOnly and a DefaultValue. A DataTable is made up of a collection of DataRow objects, and each DataRow object is made up of a collection of DataColumn objects.

Why use a DataTable:
A DataTable is useful to hold data when you need to store multiple rows and multiple values within each row. There are many ways that you can accomplish this same task, but a DataTable is very easy to use. Some of the other mechanisms you might have used in the past include:

  • An array of user-defined types
  • A collection of classes
  • An ADO Recordset

While all of these worked, they all required that you write quite a bit of code to accomplish what you were trying to do. You will find that a DataTable object is much easier to deal with because it replaces a number of VB6 constructs with a single object.

Load a DataTable:
You will now load some data into a DataTable using the code shown below, then display the data in a DataGrid on the form. You will first need to create a new instance of a form variable within the form class, but outside of any procedure. This is known as a member variable. Add the following code in the code snippet below to a Windows Form:


*** CODE ***
Public Class Form1
    Inherits System.Windows.Forms.Form
    
    'Declare the module-level DataTable:
    Private mdt As System.Data.DataTable
 
*** END CODE ***

You have added the Private (module level) variable named mdt. This variable is declared to be a DataTable class and will be used to hold your data. The code below shows how to create this DataTable and populate it with data.


*** CODE ***
Private Sub GridLoad()
    Dim dr As DataRow
    Dim intLoop As Integer
    
    ' Create new DataTable object:
    mdt = New System.Data.DataTable()
    
    ' Create Columns in DataTable:
    mdt.Columns.Add("ProductID")
    mdt.Columns.Add("ProductName")
    mdt.Columns.Add("UnitPrice")
    mdt.Columns.Add("UnitsInStock")
    
    ' Load data into DataTable:
    For intLoop = 1 To 10
        ' Create a new DataRow in the DataTable:
        dr = mdt.NewRow
        
        ' Load columns in new row with Data:
        dr("ProductID") = intLoop
        dr("ProductName") = "Product " & _
         intLoop.ToString()
        dr("UnitPrice") = intLoop * 10
        dr("UnitsInStock") = intLoop * 20
        
        ' Add New Row to DataTable:
        mdt.Rows.Add(dr)
    Next
    
    ' Tell Grid to AutoSize Columns:
    grdProducts.PreferredColumnWidth = _
        grdProducts.AutoColumnSize
    ' Load Grid with Data:
    grdProducts.DataSource = mdt
End Sub
 
*** END CODE ***

In the code above you declare a DataRow object named dr. You then create a new instance of a DataTable by using the New keyword to create a new instance of this type. Next you define the columns to use with this DataTable object. You do this by using the Add method on the columns collection and giving the new column a name.

Next, a loop generates some dummy product data. The loop runs 10 times and each time through the loop a new DataRow object is created. The DataRow object is built with the column definitions you defined earlier on the DataTable. The ProductID column in the DataRow is filled with the value in the intLoop variable. The ProductName column is filled with the string "Product 1", "Product 2", etc. Next you fill the UnitPrice and UnitsInStock with some simple calculations just to have some data in them. Finally the Add method appends the new DataRow object to the Rows collection of the DataTable.

Once the DataTable is built you can now set the DataSource property of the DataGrid control to this DataTable object. Before you do this, you should set the PreferredColumnWidth property to the property AutoColumnSize. This resizes the columns based on the largest data value in each column as it loads the data.


Q: What future Internet broadcasts, books, articles, and courseware can we expect from you?
A: My new book "ASP.NET Developer's Jumpstart" is out now and can be purchased at most bookstores and on Amazon.com. ISBN Number: 0-672-323-575. I have recently completed an eBook entitled "Architecting ASP.NET Applications", and am working on my next eBook entitled "Architecting N-Tier Applications". These eBooks may be purchased on my web site at www.pdsa.com/ebooks. We currently have 2 courses on .NET we offer. One is on ASP.NET and the other focuses on VB.NET and desktop development. I plan on doing more internet web casts with Microsoft this summer and fall.


Q: You have a long computing history filled with considerable and valuable experiences. Can you describe some of the projects that you have worked on and what tips you can pass on?
A: We have worked on various projects at my company. I have a staff of 15 developers and we have worked with small, medium and large corporations over my 11 years in business.
1. We have built a web application that linked over 150 offices together over the Internet. They needed a centralized database, but had all of these remote offices so a web interface made the most sense.
2. We built a VB6 application that integrated with an optical eye reader to verify a person was who they said they work. It works by taking a picture of a persons eye and digitizing the image. This image is then stored in an SQL Server database and compared when they next look into the reader.
3. We have just recently assisted in the architecture and design of an ASP.NET web site for a large financial institution. We helped them design the architecture of their ASP.NET pages and VB.NET classes. They also needed a content management system that was written in 100% .NET technologies, so we built one for them in just 5 weeks!

In each case we have always made sure that we have consistent programming standards and a consistent framework for each of our projects. Without these, and without careful project management, we would most likely have not succeeded and delivered a successful project to our clients. We have a good internal process for application development. This is what sets our company apart from other consulting companies.


Q: What are the top things that developers should do in their jobs?
A: 1). Keep up with technology. You need to keep learning new technologies. 2). Keep up with training. Attend training classes, user groups or any other types of places where you can learn from someone else. 3). Go back to the basics. Attend even beginner level trainings, as someone will sometimes say something that may help you out with even more advanced concepts. 4). Learn about other areas of computing besides just your area of specialization. If you just program in ASP or VB, try to learn more about networking and hardware or even another language like C++. The more you know, the more it will help you do your job. 5). Talk with other developers. Don't just program in a black-hole. Talk to your co-workers or other developers in user groups. Why reinvent the wheel if someone else has already created the same routine. Re-use is good in programming. 6). Don't just get buried in technology, try to understand the business side of what you are coding. This will help you QA your own routines and it will make you more valuable to your manager.


Q: Can you share your leading career tips for those thinking of getting into the computing field?
A: There are many things to consider when thinking of getting into computing. First and foremost you need to understand the type of person you are. Do you like change? Do you like a fast pace? Do you like to work alone for long hours? If you can answer yes to all of the following, then you are probably a good candidate for a developer. If you do not like change, then this is not the industry for you. You need to be willing to always learn new technologies and be able to re-invent yourself every few years when new technologies emerge. Once you are committed, get as much training as you can, but also get as much experience as you can. Either find an employer willing to take you on part-time, or simply create as many programs as you can on your own. As an employer myself, I look for people with degrees in either CIS or MIS. I also look at experience and how much "extra" things they have done. If they can show me some programs they wrote on their own, or show me a website they developed, then that counts for a lot. I also look for people willing to follow the corporate standard. If you think your way of programming is the only way, and you are not willing to follow anyone else's lead, or style, then you will not fit into most corporate environments. Be reliable, stable and not a job hopper. I know many people who moved from one company to another to find a better salary. But it seems like every few years there is a re-adjustment and the people with the least experience and are being paid the most are always the first to go. Look at what happened when the .COM's went under. All these "kids" that had only a couple of years experience making $70k per year were let go very quickly. When they looked for another job at more established companies, they could not even make $50k.


Q: You are on top of the latest technologies. What are the hottest topics that all IT professionals must know to continue their success in the short term and long term?
A: The hottest tickets right now are J2EE and Microsoft.NET. We should find programmers in these two areas in big demand over the next few years. J2EE and .NET have a lot of the same functionalities, but .NET is definitely more integrated and has a better development environment. I think this environment will always have a slight edge over J2EE. For the long term it is hard to say in this industry. The best I can say is what I have said before, keep up with technology and make sure you are as well rounded as you can. Don't just focus on one area of computing. Keep learning what is coming up and keep your eye on industry trends. Read as many articles as you can as this is a good way to learn what is coming up.


Q: What would be your recommended top ten references for the serious developer?
A: They are:

  • MSDN magazine and Visual Studio Magazine
  • For purchasing tools, I use www.xtras.com
  • Attend a conference like Tech Ed, VSLive, DevConnections or similar event
  • Your local user groups
  • Web sites: google.com, gotdotnet.com, devx.com


Q: You have so many accomplishments. What do you do to relax?
A: Just stay at home with my wife and kids. I swim, bike and take my dog for a walk.


Q: If you were doing this interview, what question would you ask of someone in your position and what would be your answer?
A: 1). What is the biggest problem in IT today? Answer: Lack of discipline and standards among teams. I consult with many shops that have no programming standards, no architectural framework, and many programmers re-create the same routines others in their shop have already created. It is not always the fault of the programmers; I find that management has a lot to do with it. Too often the managers of an IT organization are too busy, or pulled in too many directions to really set the standards and hire a good architect. This is where we are seeing a lot of our business coming from these days. We often are asked to come in and set standards, policies, guidelines and provide a good framework for all developers to use. Once completed, the IT organization can really start to be productive.


Q: It’s a blank slate, what added comments would you like to give to enterprise corporations and organizations?
A: I can not re-iterate enough that a Software Development LifeCycle (SDLC) needs to be in place at every organization. All developers must know and understand the process of creating a project from meeting with the users all the way through to the QA and delivery of the product. Spend the time to create this document, or hire someone to help you with this process. You will find the investment has a tremendous payoff in terms of productivity and worker satisfaction.


Q: Paul, thank you for sharing your valuable insights with us today
A: You are very welcome, thank you for allowing me to share my insights with your audience.

 

 

Copyright © 2000 - 2002 Canadian Information Processing Society All rights reserved. Terms of Use Privacy Statement