Skip to content

Instantly share code, notes, and snippets.

@JoanComasFdz
JoanComasFdz / thoughts-on-testing.md
Last active April 30, 2024 12:33
Thoughts on Testing

Reevaluating Testing Strategies in Software Development

Introduction:

Software development practices have evolved significantly over time, with a prevailing trend towards thorough testing at all levels. This report aims to critically analyze the effectiveness and efficiency of current testing methodologies, particularly in light of concerns regarding return on investment and the burden of maintaining extensive test suites. Additionally, it explores alternative approaches, such as organizing code into smaller, well-documented modules reminiscent of microservices architecture, and the trend in functional programming to minimize testing of side effects.

Argument 1: Distinguishing Business Logic from Infrastructure Concerns when Unit Testing

Description: Emphasizes the importance of distinguishing between code segments directly contributing to the core business logic, which must be thoroughly tested specially with unit tests, and ancillary code responsible for infrastructure operations, such as fil

@JoanComasFdz
JoanComasFdz / gist:1555473
Created January 3, 2012 15:56
Basic TreeView with DataTemplate that contains a ContextMenu capable to bind to TreeView DataContext.
<TreeView x:Name="treeExample"
ItemsSource="{Binding Items}">
<TreeView.Resources>
<DataTemplate DataType="{x:Type yourNamespace:BussinessObjectViewModel}">
<StackPanel Orientation="Horizontal">
<TextBlock
Name="txtId"
Text="{Binding Id}"
/>
<TextBlock
@JoanComasFdz
JoanComasFdz / gist:1555464
Created January 3, 2012 15:54
Basic binding for properties inside a ContextMenu.
MyProperty="{Binding DataContext.PropertyToBind, RelativeSource={RelativeSource TemplatedParent}}"
@JoanComasFdz
JoanComasFdz / BussinessObjectViewModel.cs
Created January 3, 2012 15:51
Basic VieModel for BussingessObject class
class BussinessObjectViewModel : System.ComponentModel.INotifyPropertyChanged
{
#region Implementation of INotifyPropertyChanged
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
#endregion
private BussinessObject _bussinessObject;
@JoanComasFdz
JoanComasFdz / BussinessObject.cs
Created January 3, 2012 15:48
Basic bussines object
class BussinessObject
{
public int Id { get; set; }
public string Name { get; set; }
public BussinessObject(int id, string name)
{
Id = id;
Name = name;
}
@JoanComasFdz
JoanComasFdz / gist:1527490
Created December 28, 2011 10:27
Basic Skype Manager for C#
public delegate void SkypeIncomingCall(string user_id);
public class SkypeManager
{
/// <summary>
/// The ActiveX component to control the current
/// running instance of Skype.
/// </summary>
private Skype _skype;
@JoanComasFdz
JoanComasFdz / gist:1527488
Created December 28, 2011 10:27
Register Skype4COM ActiveX component
regsvr32 "C:\Program Files (x86)\Skype\Skype4COM.dll"
@JoanComasFdz
JoanComasFdz / WpfFlashControl.xaml.cs
Created December 28, 2011 10:20
Basic WPF control to contain a SWF Flash object
public partial class WpfFlashControl
{
/// <summary>
/// Allows an WPF ui element to embed a WinForms element.
/// </summary>
private WindowsFormsHost _host;
/// <summary>
/// The WinForms flash control.
/// </summary>
@JoanComasFdz
JoanComasFdz / WinFormsFlashControl.cs
Created December 28, 2011 10:19
Basic WinForms control to contain a SWF Flash object.
partial class WinFormsFlashControl :System.Windows.Forms.UserControl
{
private Uri _source;
/// <summary>
/// Gets or sets the path to the .swf file.
/// </summary>
/// <exception cref="FileNotFoundException">Occurs when
/// the specified file is not found.</exception>
public Uri Source
@JoanComasFdz
JoanComasFdz / gist:1527253
Created December 28, 2011 09:15
Getting the string value of an string enumerator and parsing it again.
// Get the value from the first member of the enumerator.
string value = StringEnum<MyStringEnum>.Value(MyStringEnum.Member1);
// Parse the value to re-obtain the member.
MyStringEnum member = StringEnum<MyStringEnum>.Parse(value);