Coding For a Living

rss

A place to share and comment about coding for a living.


Visual Basic 2012– Caller Information Mike McIntyre

New in Visual Basic 2012 is the caller information feature. This feature enables you to obtain information about the caller of a method.

By using Caller Info attributes, you can obtain information about the caller to a method. You can obtain file path of the source code, the line number in the source code, and the member name of the caller. This information is helpful for tracing, debugging, and creating diagnostic tools.

To obtain this information, you use attributes that are applied to optional parameters, each of which has a default value. 

For more information about using the Caller Information feature click:

       Caller Information (C# and Visual Basic)

Sample Use

' Imports System.Runtime.CompilerServices ' Imports System.Diagnostics Private Sub DoProcessing() TraceMessage("Something happened.") End Sub Public Sub TraceMessage(message As String, <CallerMemberName> Optional memberName As String = Nothing, <CallerFilePath> Optional sourcefilePath As String = Nothing, <CallerLineNumber()> Optional sourceLineNumber As Integer = 0) Trace.WriteLine("message: " & message) Trace.WriteLine("member name: " & memberName) Trace.WriteLine("source file path: " & sourcefilePath) Trace.WriteLine("source line number: " & sourceLineNumber) End Sub ' Sample output: ' message: Something happened. ' member name: DoProcessing ' source file path: C:\Users\username\Documents\Visual Studio 2012\Projects\CallerInfoVB\CallerInfoVB\Form1.vb ' source line number: 15

xRad–Well Known Schemas Mike McIntyre

In my three previous xRad posts I explained the use of well known names and how they help make extra rapid application development (xRad) possible.

  Coding For a Living  xRAD Well Known Names– Part 1
  Coding For a Living  vRAD Well Known Names– Part 2
Coding For a Living  vRAD Well Known Names– Part 3

 

In this post I will expand on the ‘well known’ concept that speeds up application development by discussing well known table schemas.

There are many database tables that are commonly used in business applications. A few examples are:

  Customer CustomerType Comment Location Table
  Contact ContactType Role Profile Price
  Address AddressType Version File  
  Order OrderType User Permission  
  Item ItemType AppLog Role_Permission  

 

Since 1992 we have identified 1104 well known table schemas.

Like well known names, well known table schemas are used in my databases, models, code, generators, and snippets.image

And, like well known names, well known schemas reduce development time because they are reusable.

Some benefits of well known table schemas are:

1.  When a new project starts up no design time is spent on the well known tables.

2.  Programmer documentation about well known schemas has not changed since 2011.  We will add more well known tables schemas but they will be additions, not changes.

3.  We run one script to install all well known tables at the beginning of a project.

4.  Code, text, comment, and documentation generators - auto create data access code, enum code, validation code, classes, and more for the well known tables. Once we install the tables and run the generators everything just works.

We’ve found it’s easier to install the well known tables and generate supporting code than to pick and choose.