TDD and WiseJ event handlers

Closed
0
0

Hello

I’m presently evaluating WiseJ for my upcoming needs in developing a Kestrel-based web application for distribution.

I practice TDD exclusively; I’m quite fond of the tightly-modularized code that results.

I’m noticing something with WiseJ’s approach to application architecture that seems a throwback to the heyday of WinForms/WebForms designs. Unfortunately, the paradigm presents an impedance factor, some resistance, to TDD implementation.

I’m referring to the event handler approach:

Imports System

Public Class Window1
  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Label1.Text = "Button clicked."
  End Sub
End Class

This code is not unit-testable. Also, it can easily lead to “code sprawl,” where lines and lines of important logic end up in the handler. Monolithic, inflexible and difficult-to-maintain code tends to be the result.

I’ve gone into this in a little more detail in the comments on this CodeProject article:

https://www.codeproject.com/Articles/1208339/Wisej-The-Easy-Button-for-Enterprise-Software

I want to be wrong. I want to be able to consider using WiseJ for my projects.

I’d like to invite further discussion and insight into this apparent conundrum. If others have settled on workable resolutions I’m very interested in knowing about it.

Thanks,
Jeff Bowman
Fairbanks, Alaska

  • Thomas (ITG)
    Hi Jeff, Wisej.NET doesn’t have event handlers. Events are a standard feature of .NET and there is only one way to handle and fire events in .NET. Using Wisej.NET, there are different approaches to structure and organize code, especially for complex line-of-business applications. Some of our clients follow MVVM concepts, some Wisej.NET projects have been using ReactiveUI, and others prefer to use binding and commanding – which is similar to the way WPF is integrated with business logic. The latest Wisej.NET release (released last night) just added some features around this: https://docs.wisej.com/docs/releases/whats-new-in-3.2 We don’t encourage our customers to mix business logic with data access, UI and flow handling in one place. This should be split up and organized with separation of concerns. For unit testing, Wisej.NET integrates well with several unit testing frameworks and tools, such as TestProject.io, TestWright, Selenium and others. Hope this helps!
  • Jeff Bowman
    Thank you for your kind reply. Yes, it helps.
  • Jeff Bowman
    I’ve come across another post that looks at the event handler issue: https://softprinciples.blogspot.com/2016/12/testable-winforms-applications.html This is a simple approach that addresses the situation nicely.
  • You must to post comments
-1
0

You can organize your code and architecture in any way you like. Check our case studies to see some of the largest and most complex cloud applications to ever run on the web.

This forum is for free support related to Wisej specific issues. If you have a specific bug or feature question please open an issue with a clear description and a test case.

For professional consulting about architecture or training contact sales. We have prepaid packages of 4h.

  • You must to post comments
Showing 1 result