Technical Debt Is Not a Myth Either!

Technical Debt Is Not a Myth Either!

Most people recall the phrase from the Movie, "Water World", that "dry land is not a myth". It was considered a myth because no one had seen land while living on a "Water World". If you work in an environment where writing software is equivalent to "running a well greased machine" then the term, "technical debt" may not resonate, but that does not mean that technical debt is not being compounded. Over time any debt starts to complicate our lives. On the other hand, some amounts of debt are normal as long as there is a plan for handling it. For instance, I need to buy a new transmission for my truck. I might use a credit card to purchase and have it installed, and since I do not have the money right then, I will charge it to my credit card and pay it off within the next couple of months. The plan for handling any debt is what is necessary for making sure debt remains relatively low.

So what is technical debt? Well as mentioned earlier, some debt is ok which I will explain later, but bad technical debt occurs when there is a lack of strategy for building and maintaining technology and it starts effecting the delivery of software. Just because there is a team of developers and software is being written, does not mean it is being done correctly. Technical debt also effects how we estimate software tasks and how effective we are for deploying software. IT companies and departments incur it daily, however just like the example about the truck transmission, it is necessary to sometimes incur technical debt in order to provide a "minimal viable product" (MVP). This means a developer might take shortcuts in their code to get a software product out to customers, and as long as there is a plan to fix the debt, it does not continue to incur to the point that over time it becomes a problem.

Avoiding technical debt is all about making sure you have effective processes in place for writing software and a strategy for maintaining future software changes. These processes are very important for keeping estimates and deadlines for delivering software. Just as you may monitor your checking account, it is important to monitor the technical debt your development team accumulates by doing the following:

1. Talking with your team and other departments about recommendations around development. There should always be transparency about what others are building. "Silo software development" is equivalent to someone who is a bad gambler and is headed to Las Vegas.

2. Create processes around delivering software. These processes should be measureable and conducive to delivering new products to customers or the business effectively. Do not create processes for the sake of creating processes as this can promote technical debt.

3. Measure the effectiveness for existing processes as these may need to change over time. This is done by training the development team on effective ways to estimate tasks. Identify reasons for "sliding deadlines", and make sure that the processes include everyone, including other departments who play a role for making sure software gets delivered, like infrastructure and testing groups.

There is bad and good technical debt, and it is all relative to the amount of debt your software team can handle. Just like financial debt, it must be managed by planning out how to reduce the amount of debt incurred. To learn more about the different types of technical debt a software shop encounters and ways of reducing it please contact me.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 9/4/2015 at 2:21 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Is Microsoft’s .NET Ecosystem on the Decline?

Recently I was directed to Dice's posting about .NET jobs on the decline. The posting can be found here

My response was...

"Not arguing with the stats because they might be correct as I have not seen them, however you can take almost any stats and make them what you want. This might just show that clearly there are other technologies that are now available for doing development, but I would not go as far to say that companies are ditching Microsoft.NET. In my region, .NET is still sexy and as long as you have the skills, you will have multiple job offers."

 One thing I have experienced and honestly can't stand is when companies make rash decisions to move away from a technology stack. In my opinion there is no real business strategy or requirement that warrents such an initiative and that these decisions are simply unfortunate human characteristics that we have to deal with!  What are your thoughts?

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 6/18/2015 at 2:44 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Microsoft Ends Support for AppFabric 1.1 In A Year

It does not seem that long that AppFabric came out, and now Microsoft has decided to end support for AppFabric 1.1 for Windows Server about a year from now (Read Here). I consider this technology a pioneer for building scalable caching and implementing enterprise business processes easily using other technologies like WCF & WF. Since then new technologies have rapidly taken shape. For instance, Redis is now the technology of choice for caching and we have seen a new migration to the cloud and Azure, which now includes BizTalk services instead of the raw frameworks like WCF and WF for implementing business process solutions. Although, I feel AppFabric was somewhat short lived, but the concept was an important factor to conquer, and as a technologist, we cannot invest to heavily in a technology because they always evolve. This is a frustration unfortunately we will always live with. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 4/3/2015 at 1:50 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Code Impact - Free Microsoft.NET Community Event In Jacksonville, Florida

Summer is my favorite time of year. Kids are off from school, traffic is better in Jacksonville and Jacksonville's .NET Community comes alive. This year, we are hosting a free event called "Code Impact Jax", which will be held on September 13, 2014 at University of North Florida, located at 1 UNF Drive
Jacksonville, FL 32224. To register, visit

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 7/22/2014 at 1:43 AM
Categories: General
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Remote Desktop Connection To Azure WebRoles (Cloud Services)

Connecting to virtual machines though Azure IaaS is common, but you may have wondered how content can be managed for web roles, hosted as Cloud Services. Cloud Services are somewhat of a "black box" when it comes to traditional websites hosted in Microsoft Azure and rightfully so, since web roles are more complex and align with traditional tiered architecture for enterprise web applications. This post will walk through setting up RDP for your cloud services, so you can RDP to one or more instances of the web roles and debug or make necessary changes.

There are a couple of ways to setup RDP for cloud services. One way is by enabling RDP while publishing a webrole to Microsoft Azure,

http://msdn.microsoft.com/en-us/library/gg443832.aspx

however you can also use the portal to set it up. 

1. After filtering a subscription from the Azure Portal, select "Cloud Services" from the menu.

 

2. Select the service and choose Configure

 

3. Down at the bottom of the configuration page, click on the Remote link. The link below walks through the rest for setting it up and more details around removing the RDP configuration.

http://azure.microsoft.com/en-us/documentation/articles/cloud-services-how-to-configure/

but the next step is setting up the configuration by selecting the role, username/psw, certificate and when the RDP will expire on. The above link also provides more detail around the certificate and rebooting of the role once RDP is configured.

4. After selecting the check button from the Configure Remote Desktop window from the Azure Portal, Azure will crunch for a bit and indicate that it is processing the request ot configure RDP for the role. This can take a little bit of time.

5. Once configuration is completed, RDP can be accessed from within Visual Studio and Server Explorer.

 

6. Right-clicking on either of the instances for WebRole1 will start an RDP session, where you can remote into either instances.

Once remoted in, go to IIS so you can see your hosted site and demystify the web role for both instances, and see the file structure for the files that were uploaded during the last deployment. You can also save the .RDP profile so you can remote in from a different computer.  

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 4/24/2014 at 6:13 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Processing Service Bus Subscriptions Through WCF - Part 2

In my last post I showed how a WCF service is used to process messages that are sent to Windows Service Bus topic. This post completes the concept by showing how a client application can send event engagement requests to a Windows Service Bus topic, so the messages can later be processed by the WCF service built in my previous post. This post assumes that Windows Service Bus has already been installed. For more information on installing service bus, visit here.

1. Create a new Console Application, which will serve as the client application that will submit messages to the service.

2. Add the service contract which has the interface the WCF service implements, and the data contract for the engagement request. Since the console application does not need a reference to System.ServiceModel.Web, this directive can be commented out.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Runtime.Serialization;

using System.ServiceModel;

//using System.ServiceModel.Web;

using System.Text;

namespace SB.WCF.Subscription

{

[
ServiceContract]

public interface IEngagementService

{

[
OperationContract(IsOneWay = true, Action = "RequestEngagement")]

[ReceiveContextEnabled(ManualControl = true)]

void RequestEngagement(EngagementRequest request);

}

[
DataContract]

public class EngagementRequest

{

[
DataMember]

public Guid EngagementId { get; set; }[

DataMember]

public EngagementInfo Venue { get; set; }[

DataMember]

public string Description { get; set; }[

DataMember]public List<EngagementEvent> EventSchedule { get; set; }

}

public class EngagementEvent

{

[
DataMember]

public string EventName { get; set; }[

DataMember]public DateTime EventDate { get; set; }

}

public class EngagementInfo

{

[
DataMember]

public int Capacity { get; set; }[

DataMember]public string Location { get; set; }

}

}

3. Add the nuget package for Service Bus 1.1. This will add some default configuration to the app.config.

4. Change the app.config with the configuration indicated below. Notice that the configuration is not too different then the configuration used for setting up the WCF service.

<?xml version="1.0" encoding="utf-8"?>

<configuration><

system.serviceModel>

<extensions><

bindingElementExtensions>

<add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /></

bindingElementExtensions>

<bindingExtensions><

add name="netMessagingBinding" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

</bindingExtensions><!--

In this extension section we are introducing all known service bus extensions. User can remove the ones they don't need. -->

<behaviorExtensions><

add name="connectionStatusBehavior" type="Microsoft.ServiceBus.Configuration.ConnectionStatusElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

<add name="transportClientEndpointBehavior" type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /><

add name="serviceRegistrySettings" type="Microsoft.ServiceBus.Configuration.ServiceRegistrySettingsElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

</behaviorExtensions></

extensions>

<behaviors><

endpointBehaviors>

<behavior name="endpointBehavior"><

transportClientEndpointBehavior>

<tokenProvider><

windowsAuthentication>

<stsUris><

stsUri value="https://attpa-10130435.at.local:9355/ServiceBusDefaultNamespace" />

</stsUris></

windowsAuthentication>

</tokenProvider></

transportClientEndpointBehavior>

</behavior></

endpointBehaviors>

</behaviors><

bindings>

<netMessagingBinding><

binding name="messageBinding" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:03:00" sendTimeout="00:03:00" sessionIdleTimeout="00:01:00" prefetchCount="-1">

<transportSettings batchFlushInterval="00:00:01"></transportSettings></

binding>

</netMessagingBinding></

bindings> <client>

<endpoint name="EngagementRequestor"

address="sb://attpa-10130435.at.local/ServiceBusDefaultNamespace/EngagementTopic"

binding="netMessagingBinding"

bindingConfiguration="messageBinding"

contract="SB.WCF.Subscription.IEngagementService"

behaviorConfiguration="endpointBehavior"></endpoint>

</client></

system.serviceModel>

</configuration>

 You will notice that the endpoint only has an address, which was different than the configuration used for the WCF service. This is because the client only needs to know the address (topic) of where the message will be sent.

 4. Now add the following code, which references the WCF service and builds the data contract that will be sent as a message to the service bus.

using SB.WCF.Subscription;

using System;

using System.Collections.Generic;

using System.Linq;

using System.ServiceModel;

using System.Text;

using System.Threading.Tasks;

namespace SB.Subscription.Client

{

class Program

{

static void Main(string[] args)

{

CreateServiceClient();

}

private static void CreateServiceClient()

{

ChannelFactory<IEngagementService> channel = new ChannelFactory<IEngagementService>("EngagementRequestor");

var engagementRequest = new EngagementRequest

{

EngagementId =
Guid.NewGuid(),

Venue = new EngagementInfo { Capacity=50, Location="Hotel California" },Description =

"Geographical Beetle Fighting Tournament",

EventSchedule = new List<EngagementEvent> //[] //indicates a dynamic array

{

new EngagementEvent { EventDate = Convert.ToDateTime("5/6/2014"), EventName="US Beetle Competition"}, new EngagementEvent { EventDate = DateTime.Now, EventName="Asia Beetle Competition"}

}

};

var engagementService = channel.CreateChannel();

engagementService.RequestEngagement(engagementRequest);

channel.Close();

}

}

}

Your client is now ready to send messages to the service bus. Make sure the WCF service is running, that will consume service bus messages and then fire up the client to send a message.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 4/22/2014 at 1:43 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Processing Service Bus Subscriptions Through WCF - Part 1

Microsoft provides a .NET API for working with Windows Service Bus, therefore you can write applications that interact asynchronously with queues, topics & subscriptions, however MS also provides WCF bindings that natively process service bus messages through WCF. After setting up the configuration, messages can be sent to a WCF service for processing. Let me show you how in this post by building a service that will take engagement requests for planned events. Note: This post assumes that you already have Windows Service Bus running locally and that you are aware of how to build Topics and Subscriptions. Another post will come later that illustrates how to send messages to service bus. For more information on installing service bus, visit here

1. Create a new WCF Service Application.

 2. Renamed the default service and interface files to:

EngagementService.svc
IEngagementService.cs

3. Change the IEngagementService.cs code as follows building the interface that the service will use. It also has the data contract that will pass data about the engagement:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Runtime.Serialization;

using System.ServiceModel;

using System.ServiceModel.Web;

using System.Text;

namespace SB.WCF.Subscription

{

[
ServiceContract]

public interface IEngagementService

{

[
OperationContract(IsOneWay = true, Action = "RequestEngagement")]

[ReceiveContextEnabled(ManualControl = true)]

void RequestEngagement(EngagementRequest request);

}

[
DataContract]

public class EngagementRequest

{

[
DataMember]

public Guid EngagementId { get; set; }[

DataMember]

public EngagementInfo Venue { get; set; }[

DataMember]

public string Description { get; set; }[

DataMember]public List<EngagementEvent> EventSchedule { get; set; }

}

public class EngagementEvent

{

[
DataMember]

public string EventName { get; set; }[

DataMember]public DateTime EventDate { get; set; }

}

public class EngagementInfo

{

[
DataMember]

public int Capacity { get; set; }[

DataMember]public string Location { get; set; }

}

}

4. Before changing the code for the service, there are some references that need to be added. Add the nuget package for Service Bus 1.1 .

5. Add the following code to the EngagementService.svc. I am using a complex object for requesting an engagement to illustrate a little more complexity. The only objective for the code below is to show that the engagement request has been sent to the WCF service:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Runtime.Serialization;

using System.ServiceModel;

using System.ServiceModel.Web;

using System.Text;

using System.ServiceModel.Channels;

namespace SB.WCF.Subscription

{

public class EngagementService : IEngagementService

{

public void RequestEngagement(EngagementRequest request)

{

try

{

Guid engagmentId = request.EngagementId;

var capacity = request.Venue.Capacity;

var location = request.Venue.Location;foreach (var engEvent in request.EventSchedule)

{

var docName = engEvent.EventDate;

var docValue = engEvent.EventName;

}

var desc = request.Description;

var messageProperties = OperationContext.Current.IncomingMessageProperties;

ReceiveContext receiveContext;if (ReceiveContext.TryGet(messageProperties, out receiveContext))

{

receiveContext.Complete(
TimeSpan.FromSeconds(10.0d));

}

}

catch (Exception)

{

//something un-amazing has happened

}

}

}

}

6. Next step is to add the glue, which is the configuration. If you noticed, once Service Bus 1.1 gets installed, it loads a ton of config settings within the web.config. Go ahead and delete what is in the web.config and add the following:

<?xml version="1.0" encoding="utf-8"?>

<configuration><

system.web>

<compilation debug="true" targetFramework="4.5" /><

httpRuntime targetFramework="4.5" />

</system.web><

system.serviceModel>

<behaviors><

serviceBehaviors>

<behavior><!--

To avoid disclosing metadata information, set the values below to false before deployment -->

<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /><!--

To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->

<serviceDebug includeExceptionDetailInFaults="false" /></

behavior>

</serviceBehaviors><

endpointBehaviors>

<behavior name="EndpointBehavior"><

transportClientEndpointBehavior>

<tokenProvider><

windowsAuthentication>

<stsUris><

stsUri value=https://ServerName:9355/ServiceBusDefaultNamespace />

</stsUris></

windowsAuthentication>

</tokenProvider></

transportClientEndpointBehavior>

</behavior></

endpointBehaviors>

</behaviors><

services> <service name="SB.WCF.Subscription.EngagementService">

<endpoint name="EngagementProcessor"

listenUri="sb://ServerName/ServiceBusDefaultNamespace/EngagementTopic/subscriptions/EngagementSub1"

address="sb://ServerName/ServiceBusDefaultNamespace/EngagementTopic"

binding="netMessagingBinding"

bindingConfiguration="messageBinding"

contract="SB.WCF.Subscription.IEngagementService"

behaviorConfiguration="EndpointBehavior"/>

</service></

services>

<bindings><

netMessagingBinding>

<binding name="messageBinding" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:03:00" sendTimeout="00:03:00" sessionIdleTimeout="00:01:00" prefetchCount="1"><

transportSettings batchFlushInterval="00:00:01"></transportSettings>

</binding></

netMessagingBinding>

</bindings><!--

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />-->

<extensions><!--

In this extension section we are introducing all known service bus extensions. User can remove the ones they don't need. -->

<behaviorExtensions><

add name="transportClientEndpointBehavior" type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

</behaviorExtensions><

bindingElementExtensions>

<add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /></

bindingElementExtensions>

<bindingExtensions><

add name="netMessagingBinding" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

</bindingExtensions></

extensions>

</system.serviceModel><

system.webServer> <modules runAllManagedModulesForAllRequests="true" />

<!--

To browse web app root directory during debugging, set the value below to true.

Set to false before deployment to avoid disclosing web app folder information.

-->

<directoryBrowse enabled="true" /></

system.webServer>

</configuration>

I want to explain two settings from the web.config are the following:

listenUri="sb://ServerName/ServiceBusDefaultNamespace/EngagementTopic/subscriptions/EngagementSub1"

address="sb://ServerName/ServiceBusDefaultNamespace/EngagementTopic"

ListenUri listens to the subscription where address points to the topic where messages are being sent.

There are some ok examples out there but nothing fully complete in my opinion. Must of the samples use Azure Service Bus which is fine, but I wanted to show strictly how to use Windows Service Bus, as a pure on-premise setup. My next post will demonstrate how to send messages to the service created in this post. Fire away if you have any questions.

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 4/18/2014 at 2:39 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Updating The Password For The Account Windows Service Bus Is Running Under

At the end yesterday's work day,my Service Bus Farm was working as expected, however this morning I was checking messages and they were failing to be sent to the queue. The error I was getting was, "The service did not start due to a logon failure." This particular farm is on the domain, so I have to use VPN to see it, which is one of the potential points of failure. Also, this morning I was informed that my password needed to be changed for the domain, and I did that too, for the second point of failure. My first thought pointed me to a post I did a while back for checking the status of the SB farm, and the power-shell commands for checking that the farm was up and running. All of the services were up and running, however I knew that changing my password caused the issues, next steps were to understand how it could be fixed.

The services were running because I had left the machine running, so I decided to reboot the machine. when I did I found that there were a couple of the services that failed to start up.

When tried to restart the SB host, is when I realized that changing the password was what was causing my issue. Therefore the solution was to go to the services and reset the password for the account that the windows services FabricHost and Service Bus Message Broker are running under.

 

Once the password is updated, the services can be either restarted from the "Services" window or simply by re-issuing the "start-sbhost" power-shell command. Messages will now continue to flow.

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 4/17/2014 at 3:12 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Workflow Runtime Events

As a follow up to my session while speaking at Orlando's Codecamp, here is a cheatsheet on the different events that happen with workflow instances and the WF Runtime. In each event I share some explanation on "when","why" and "what happens" during workflow execution.

One of the important jobs of the workflow runtime is to manage running workflow instances events. You can think of the events as a workflow’s lifecycle. Let’s take a look at what workflow instance events we should be interested in following, whilte a workflow instance is running. 

 

WorkflowCreated

A workflow has been spun up or “created” when this event fires, however none of its activities have executed. In most cases, this event is so below the covers in the WFRuntime that it is not important to track.

 

WorkflowStarted

After the workflow instance has been started, scheduling of it’s root activity for execution occurs, therefore the WF Runtime raises the WorkflowStarted event. In most cases, this event is so below the covers in the WFRuntime, and is not important to track.

 

WorkflowLoaded

A workflow instance has been loaded into memory, however this occurs from a pre-existing workflow instance that has been previously persisted. Once the workflow instance has been loaded, it is now ready for it’s activities to be executed. In most cases, this event is under the covers in the WFRuntime, and is not important to track.

 

WorkflowIdled

Just because a workflow is loaded into memory, it does not mean that it is not doing work. A workflow instance can become idle as it is waiting to do work. For instance, it might be delayed or simply waiting on external events to set it in motion once again. This is an important feature of WF, because with WF’s persistence mechanisms, it can unload the workflow from memory releasing precious computer CPU cycles. Once a workflow instance becomes idle, it will raise this event, therefore it is very important to track.

 

WorkflowPersisted

Workflows can be persisted, allowing memory to be freed up from the CPU. Persisting a workflow is important when important work has been completed, the workflow has become idle, and when the workflow needs to be unloaded from memory. This is an important event to track because it lets you know when the workflow has been saved to the persistence store, however it can still fire even if a persistence store has not been enlisted by the WFRuntime. In most cases, this event is under the covers in the WFRuntime, and is not important to track.

 

WorkflowUnloaded

A workflow is said to be “unloaded” once it has been unloaded from memory. This can happen as the workflow becomes idle and by setting the UnloadOnIdle can be set to “True”. It can also happen once the workflow has been persisted, however a workflow can also be unloaded from the workflow host as well by calling WorkflowInstance.Unload. This is an important event to track because it lets you know when the workflow is no longer executing and has been freed up from memory.

 

WorkflowAborted

Sometimes a running workflow instance can run into problems during execution and needs to be aborted. Now don’t get confused with aborting and workflow and termination, because an aborted workflow is not terminal. Instead, the workflow runtime decides to go back to the last point from when the workflow was persisted. That way, the workflow can always be restarted from it’s last persisted point again. A workflow instance can also be aborted from it’s host during appropriate situations for ending a workflow’s execution. This event could be one you might want to track for a workflow instance’s execution.

 

WorkflowSuspended

Workflow instances that are running can be suspended from execution, however the instance is not unloaded. This is because a suspended workflow instance allows for changes to be made to the application, so the workflow instance can be resumed. In most cases, this event is under the covers in the WFRuntime, and is not important to track. Windows AppFabric is usually where you see these events tracked.

 

WorkflowResumed

After a workflow has been suspended, and the appropriate changes have been made to help the workflow run better, it can be resumed. Once the workflow has been resumed WorkflowResumed is fired. In most cases, this event is under the covers in the WFRuntime, and is not important to track. Windows AppFabric is usually where you see these events tracked.

 

WorkflowTerminated

A terminated workflow is cleared from memory and is not allowed to be reloaded. Terminating a workflow can occur, by calling the workflow instance to terminate from the workflow host or unhandled exceptions during workflow execution. WorkflowTerminated event is raised after the workflow instance has been terminated. In most cases, this event is under the covers in the WFRuntime, and is not important to track, however the WorkflowApplicationHost does have an OnUnhandledException event that should be tracked so you are aware when any exceptions occur, that are not accounted for so the workflow host can react accordingly.

 

WorkflowCompleted

Once a workflow has completed its execution from start to finish, the WorkflowCompleted event fires letting you know it has completed successfully. There are parameters that can be gathered as results of the workflow and the work that it has completed. This event is one you would definitely want to track for a workflow instance’s execution.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 3/24/2014 at 1:46 AM
Categories: Windows Azure AppFabric
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Applying Recursion To Build Tree Structures

In my last post, the goal was to show how parent/child relationships could be derived from Entity Framework(EF) using recursion, however the code below does not do anything meaningful other than apply recursion for looping though a parent/child relationship for a books table of contents. it cannot be used alone for building a tree structure. Why?

private void DisplayTOCData(TableOfContent TOC)
        {
            if (TOC.TableOfContents.Count > 0)
            {
                foreach (var child in TOC.TableOfContents.OrderByDescending(o => o.ContentOrder))
                {
                    DisplayTOCData(child);
                    Console.WriteLine(". {0} is the root of {1}",TOC.Title,child.Title);
                }
            }
        }

 The reason why is probably the most important factor for understanding recursion and how it needs to work. The code above simply looks to see if there are any table of contents, orders the table of contents and then checks to see if there are any other table of contents underneath a parent table of contents so they can be dispayed. When thinking about how to build a tree, it is important to think about the characteristics of a tree structure, applied to characteristics of the data, used to shape th tree. For instance,

  1. A tree will have a starting root, therefore the parent/child relationship of data must have a starting root.
  2. An element within the tree may just be a parent element and maynot have content, therfore there will be table of content headers that may or may not have content associated to a page in a book.
  3. Siblings under a parent might have an order (so they are not randomly loaded), therefore each table of content element may have an order so they can be ordered accordingly to other table of contents under the same topic.
  4. There is a very high chance that the data loaded into the tree will not be ordered the way the tree anticipates, therefore comparisons must be made to the next possible element to see if it is another sibling or belongs elsewhere.

The code below will model from the previous post, and use the TableOfContent object referenced earlier.

 private void BuildTOCDetails(TableOfContent toc)
{
    if(toc.TableOfContents.Count > 0)
    {
       if (!toc.ParentContentId.HasValue)
       {//this is the root

       }
       foreach (var child in toc.TableOfContents.OrderBy(o => o.ContentOrder))
       {                    
          if (!this.CurrentParentId.Equals(toc.ContentId)
          && child.ContentOrder.Equals(1))
          {//starts the grouping of child topics by checking the first elements order

          }
         
          if (child.TableOfContents.Count.Equals(0)
          && child.ContentOrder.Equals(toc.TableOfContents.Count)) //last sibling with no children
          {//close the grouping of siblings
             if (child.TableOfContents.Count > 0) //check if the child has children
             {
                 //get the children through recursion
                 BuildTOCDetails(child);
             }
          }
       }
    }
}

 

Within each of the conditions code, you can add your own code for building your tree, using either 3rd party controls or HTML markup. Each condition illustrated in code takes into consideration the different concepts that should be applied for building the tree. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: BayerWhite
Posted on: 2/27/2014 at 2:03 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed