Skip to main content
deleted 146 characters in body
Source Link
Mathieu Guindon
  • 75.6k
  • 18
  • 195
  • 469

Minor annoyance:

namespace Console

If you're using System;, you've just asked for name clashes with your top-level namespace named like this. Hence:

        System.Console.WriteLine("{0} - {1}", "Title", data.Body);
        System.Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        System.Console.WriteLine("{0} - {1}", "ID", data.Id);
        System.Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        System.Console.WriteLine(data.Fetch);
        System.Console.WriteLine();

I'd rename the Console namespace to MyConsoleApp or whatever - anything but something that clashes with a class that's in the System namespace. Then the Console.WriteLine calls wouldn't need to be fully qualified:

        Console.WriteLine("{0} - {1}", "Title", data.Body);
        Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        Console.WriteLine("{0} - {1}", "ID", data.Id);
        Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        Console.WriteLine(data.Fetch);
        Console.WriteLine();

This class smells:

public abstract class Data
{
}

It seems to be used as a marker base class...

public sealed class NewestQuestionsByTagData : Data
public sealed class ActiveQuestionsData : Data

Based on usage, it seems Id could be moved from the derived types to the base class:

public abstract class Data
{
    [JsonProperty("id")]
    public string Id { get; internal set; }
}

If that doesn't make sense, then I'd make Data a marker interface instead, which is less surprising than an empty abstract class - and include XML comments to clarify:

/// <summary>
/// A marker interface that marks a type as a JSON response data type.
/// </summary>
public interface IData { /* empty */ }

Also this "magic" value:

new DateTime(1970, 1, 1)

Should be defined somewhere with a meaningful name, not hard-coded like this.

Minor annoyance:

namespace Console

If you're using System;, you've just asked for name clashes with your top-level namespace named like this. Hence:

        System.Console.WriteLine("{0} - {1}", "Title", data.Body);
        System.Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        System.Console.WriteLine("{0} - {1}", "ID", data.Id);
        System.Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        System.Console.WriteLine(data.Fetch);
        System.Console.WriteLine();

I'd rename the Console namespace to MyConsoleApp or whatever - anything but something that clashes with a class that's in the System namespace. Then the Console.WriteLine calls wouldn't need to be fully qualified:

        Console.WriteLine("{0} - {1}", "Title", data.Body);
        Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        Console.WriteLine("{0} - {1}", "ID", data.Id);
        Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        Console.WriteLine(data.Fetch);
        Console.WriteLine();

This class smells:

public abstract class Data
{
}

It seems to be used as a marker base class...

public sealed class NewestQuestionsByTagData : Data
public sealed class ActiveQuestionsData : Data

Based on usage, it seems Id could be moved from the derived types to the base class:

public abstract class Data
{
    [JsonProperty("id")]
    public string Id { get; internal set; }
}

If that doesn't make sense, then I'd make Data a marker interface instead, which is less surprising than an empty abstract class - and include XML comments to clarify:

/// <summary>
/// A marker interface that marks a type as a JSON response data type.
/// </summary>
public interface IData { /* empty */ }

Also this "magic" value:

new DateTime(1970, 1, 1)

Should be defined somewhere with a meaningful name, not hard-coded like this.

Minor annoyance:

namespace Console

If you're using System;, you've just asked for name clashes with your top-level namespace named like this. Hence:

        System.Console.WriteLine("{0} - {1}", "Title", data.Body);
        System.Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        System.Console.WriteLine("{0} - {1}", "ID", data.Id);
        System.Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        System.Console.WriteLine(data.Fetch);
        System.Console.WriteLine();

I'd rename the Console namespace to MyConsoleApp or whatever - anything but something that clashes with a class that's in the System namespace. Then the Console.WriteLine calls wouldn't need to be fully qualified:

        Console.WriteLine("{0} - {1}", "Title", data.Body);
        Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        Console.WriteLine("{0} - {1}", "ID", data.Id);
        Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        Console.WriteLine(data.Fetch);
        Console.WriteLine();

This class smells:

public abstract class Data
{
}

It seems to be used as a marker base class...

public sealed class NewestQuestionsByTagData : Data
public sealed class ActiveQuestionsData : Data

Based on usage, it seems Id could be moved from the derived types to the base class:

public abstract class Data
{
    [JsonProperty("id")]
    public string Id { get; internal set; }
}

If that doesn't make sense, then I'd make Data a marker interface instead, which is less surprising than an empty abstract class - and include XML comments to clarify:

/// <summary>
/// A marker interface that marks a type as a JSON response data type.
/// </summary>
public interface IData { /* empty */ }
added 152 characters in body
Source Link
Mathieu Guindon
  • 75.6k
  • 18
  • 195
  • 469

Minor annoyance:

namespace Console

If you're using System;, you've just asked for name clashes with your top-level namespace named like this. Hence:

        System.Console.WriteLine("{0} - {1}", "Title", data.Body);
        System.Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        System.Console.WriteLine("{0} - {1}", "ID", data.Id);
        System.Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        System.Console.WriteLine(data.Fetch);
        System.Console.WriteLine();

I'd rename the Console namespace to MyConsoleApp or whatever - anything but something that clashes with a class that's in the System namespace. Then the Console.WriteLine calls wouldn't need to be fully qualified:

        Console.WriteLine("{0} - {1}", "Title", data.Body);
        Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        Console.WriteLine("{0} - {1}", "ID", data.Id);
        Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        Console.WriteLine(data.Fetch);
        Console.WriteLine();

This class smells:

public abstract class Data
{
}

It seems to be used as a marker base class...

public sealed class NewestQuestionsByTagData : Data
public sealed class ActiveQuestionsData : Data

Based on usage, it seems Id could be moved from the derived types to the base class:

public abstract class Data
{
    [JsonProperty("id")]
    public string Id { get; internal set; }
}

If that doesn't make sense, then I'd make Data a marker interface instead, which is less surprising than an empty abstract class - and include XML comments to clarify:

/// <summary>
/// A marker interface that marks a type as a JSON response data type.
/// </summary>
public interface IData { /* empty */ }

Also this "magic" value:

new DateTime(1970, 1, 1)

Should be defined somewhere with a meaningful name, not hard-coded like this.

Minor annoyance:

namespace Console

If you're using System;, you've just asked for name clashes with your top-level namespace named like this. Hence:

        System.Console.WriteLine("{0} - {1}", "Title", data.Body);
        System.Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        System.Console.WriteLine("{0} - {1}", "ID", data.Id);
        System.Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        System.Console.WriteLine(data.Fetch);
        System.Console.WriteLine();

I'd rename the Console namespace to MyConsoleApp or whatever - anything but something that clashes with a class that's in the System namespace. Then the Console.WriteLine calls wouldn't need to be fully qualified:

        Console.WriteLine("{0} - {1}", "Title", data.Body);
        Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        Console.WriteLine("{0} - {1}", "ID", data.Id);
        Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        Console.WriteLine(data.Fetch);
        Console.WriteLine();

This class smells:

public abstract class Data
{
}

It seems to be used as a marker base class...

public sealed class NewestQuestionsByTagData : Data
public sealed class ActiveQuestionsData : Data

Based on usage, it seems Id could be moved from the derived types to the base class:

public abstract class Data
{
    [JsonProperty("id")]
    public string Id { get; internal set; }
}

If that doesn't make sense, then I'd make Data a marker interface instead, which is less surprising than an empty abstract class - and include XML comments to clarify:

/// <summary>
/// A marker interface that marks a type as a JSON response data type.
/// </summary>
public interface IData { /* empty */ }

Minor annoyance:

namespace Console

If you're using System;, you've just asked for name clashes with your top-level namespace named like this. Hence:

        System.Console.WriteLine("{0} - {1}", "Title", data.Body);
        System.Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        System.Console.WriteLine("{0} - {1}", "ID", data.Id);
        System.Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        System.Console.WriteLine(data.Fetch);
        System.Console.WriteLine();

I'd rename the Console namespace to MyConsoleApp or whatever - anything but something that clashes with a class that's in the System namespace. Then the Console.WriteLine calls wouldn't need to be fully qualified:

        Console.WriteLine("{0} - {1}", "Title", data.Body);
        Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        Console.WriteLine("{0} - {1}", "ID", data.Id);
        Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        Console.WriteLine(data.Fetch);
        Console.WriteLine();

This class smells:

public abstract class Data
{
}

It seems to be used as a marker base class...

public sealed class NewestQuestionsByTagData : Data
public sealed class ActiveQuestionsData : Data

Based on usage, it seems Id could be moved from the derived types to the base class:

public abstract class Data
{
    [JsonProperty("id")]
    public string Id { get; internal set; }
}

If that doesn't make sense, then I'd make Data a marker interface instead, which is less surprising than an empty abstract class - and include XML comments to clarify:

/// <summary>
/// A marker interface that marks a type as a JSON response data type.
/// </summary>
public interface IData { /* empty */ }

Also this "magic" value:

new DateTime(1970, 1, 1)

Should be defined somewhere with a meaningful name, not hard-coded like this.

Source Link
Mathieu Guindon
  • 75.6k
  • 18
  • 195
  • 469

Minor annoyance:

namespace Console

If you're using System;, you've just asked for name clashes with your top-level namespace named like this. Hence:

        System.Console.WriteLine("{0} - {1}", "Title", data.Body);
        System.Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        System.Console.WriteLine("{0} - {1}", "ID", data.Id);
        System.Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        System.Console.WriteLine(data.Fetch);
        System.Console.WriteLine();

I'd rename the Console namespace to MyConsoleApp or whatever - anything but something that clashes with a class that's in the System namespace. Then the Console.WriteLine calls wouldn't need to be fully qualified:

        Console.WriteLine("{0} - {1}", "Title", data.Body);
        Console.WriteLine("{0} - {1}", "Tags", string.Join(", ", data.Tags));
        Console.WriteLine("{0} - {1}", "ID", data.Id);
        Console.WriteLine("{0} - {1}", "Site ID", data.SiteId);
        Console.WriteLine(data.Fetch);
        Console.WriteLine();

This class smells:

public abstract class Data
{
}

It seems to be used as a marker base class...

public sealed class NewestQuestionsByTagData : Data
public sealed class ActiveQuestionsData : Data

Based on usage, it seems Id could be moved from the derived types to the base class:

public abstract class Data
{
    [JsonProperty("id")]
    public string Id { get; internal set; }
}

If that doesn't make sense, then I'd make Data a marker interface instead, which is less surprising than an empty abstract class - and include XML comments to clarify:

/// <summary>
/// A marker interface that marks a type as a JSON response data type.
/// </summary>
public interface IData { /* empty */ }