Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 03 14:13
    dennisdoomen commented #196
  • Jul 30 17:59
    dennisdoomen commented #263
  • Jul 30 17:59

    dennisdoomen on master

    Fixed example (#263) (compare)

  • Jul 30 17:59
    dennisdoomen closed #263
  • Jul 30 11:39
    bkoelman opened #263
  • Jul 23 08:10
    dennisdoomen closed #261
  • Jul 23 08:09
    dennisdoomen commented #261
  • Jul 22 09:20
    dependabot[bot] labeled #262
  • Jul 22 09:20
    dependabot[bot] opened #262
  • Jul 22 09:20

    dependabot[bot] on bundler

    Bump tzinfo from 1.2.9 to 1.2.1… (compare)

  • Jul 14 08:08
    gerryge edited #261
  • Jul 14 08:08
    gerryge edited #261
  • Jul 14 08:05
    gerryge opened #261
  • May 21 08:16

    dennisdoomen on bundler

    (compare)

  • May 21 08:16

    dennisdoomen on master

    Bump nokogiri from 1.13.4 to 1.… (compare)

  • May 21 08:16
    dennisdoomen closed #260
  • May 19 03:41
    dependabot[bot] labeled #260
  • May 19 03:41
    dependabot[bot] opened #260
  • May 19 03:41

    dependabot[bot] on bundler

    Bump nokogiri from 1.13.4 to 1.… (compare)

  • Apr 28 17:12
    dennisdoomen commented #259
Maher Jendoubi
@MaherJendoubi
@vansha if you like abstraction then var do the same thing with types
I would also say not use var x; (Back to Basics)
Maher Jendoubi
@MaherJendoubi
also I can't use var x = null;
Dennis Doomen
@dennisdoomen
I still believe var should only be used if the type is obvious from the context.
Maher Jendoubi
@MaherJendoubi
@dennisdoomen it makes sense for me I totally agree with you but I prefer to use var keyword as much I can :)
Ivan Korneliuk
@vansha
@dennisdoomen Not sure I understand the point of exposing too much from a method. I mean how not using var protects that. Could you please give a simple example?
Dennis Doomen
@dennisdoomen
The point is that you wan to prevent too much coupling between classes. For instance, you have some kind of domain entity with a method to do ask some information about one of its internal objects. I've seen developers returning an entire internal object even though only a single primitive value was sufficient. Quite often they don't realize that this causes way too much coupling.
Ivan Korneliuk
@vansha
Ah, I see. While I understand the concern, still believe that in many cases it would be obvious what sort of data is returned - whether it some primitive type or internal object.
Dennis Doomen
@dennisdoomen
If you're looking at the code from inside Visual Studio...yes.... But what if you're reviewing a Pull Request on GitHub or BitBucket?
Ivan Korneliuk
@vansha
I understand that we're referring code reviews. And understand your point. Just saying that it seems like a rare case, when I can't understand type from a variable name and usage (for common examples that I can imagine):
var employees = repository.FindEmployees(criteria); // Don't really care about 'customers' type. Whether it IEnumerable<Person>, IList or List. Just know that it has a collection semantic.
var topSalary = employees.Select(var emp => emp.CalculateYearSalary()).Max(); // While I don't know exact type of 'topSalary' would be, it's not that important to me. I'm pretty sure it's primitive type like Integer  or Double.
Dennis Doomen
@dennisdoomen
Depends on the context. In your first example, I might wanna know whether somebody is returning an internal domain entity rather than some kind of DTO construct. If it is the former, you end up with unnecessary class coupling and leaky abstractions. In the second example, the difference between an integer and a double isn't really relevant, but might be considered an serious issue in accounting.
Yves Goergen
@ygoe
Ehm, wait a minute, wouldn't you detect such inappropriate return type from the method definition? When it should return an int value it surely can't return a complex internal type. You only need to check the method definition once whereas you'd have to analyse and verify its usage many times. And should the return type be something as unspecific as object you'd have another reason to complain, right?
Dennis Doomen
@dennisdoomen
The point is that I'd like to understand the type without browsing to the method definition. If you're reviewing code through e.g. Github Pull Requests, you won't see all that.
Yves Goergen
@ygoe
But when you only review the use of a method, you can't change the method itself. If you want to be able to influence the method, you need to review its definition. Once that's approved, it's safe.
You can't pull out an internal type of a method that just doesn't return it, so you can't hide it in 'var' as well.
Oleg Kleyman
@OlegKleyman

Hey Guys, with respect to AV1515. Would the literal used here be considered a magic number when the constructor is define as:

/// <param name="characterCount">The amount of characters that a segment should have.</param>
public Segment(int characterCount) and the usage is as such public class

ModelSegment : Segment { public Model() : base(4) {} }

Would the 4 above be considered magic or is being aware of the definition of the parameter be enough?

Dennis Doomen
@dennisdoomen
@OlegKleyman I would still treat that as a magic number. If you're reading this line in an online diff such as on github, you have no clue what it means. And in most cases, the base-class definition would be in a seperate file.
Oleg Kleyman
@OlegKleyman
@dennisdoomen Then how would you know if the naming is an accurate representation of the value if you're unaware what it's used for?
Dennis Doomen
@dennisdoomen
That should have been verified when the base-class is being reviewed.
Oleg Kleyman
@OlegKleyman
@dennisdoomen but if you're reviewing the child class and you don't know what the base class documentation is then wouldn't you have to look at the documentation for it anyway to verify that the constant is named correctly?
Dennis Doomen
@dennisdoomen
Well, yes, but if you name the constant something like SegmentCharacterCount, it should be pretty clear.
Oleg Kleyman
@OlegKleyman
@dennisdoomen but lets say the name of the constant is SegmentCharacterCount, but you are unaware of the base constructor it is used in. Wouldn't it mean that it's not possible review the code for correctness because you wouldn't know whether the name SegmentCharacterCount is correct? On the flip side if you are aware of what the base constructor is doing then wouldn't you be aware of what the literal represents without it being in a constant?
Dennis Doomen
@dennisdoomen
@OlegKleyman Well, at least I would give me a cue that this is about the character count. Although it wouldn't surface bugs because somebody was passing a character count to an integer parameter that has nothing to do with it ;-)
Oleg Kleyman
@OlegKleyman
er I don't understand what you mean by "it wouldn't surface bugs". Wouldn't an incorrect integer cause a bug?
Dennis Doomen
@dennisdoomen
Yeah, but if you're looking at the constructor invocation, and notice that SegmentCharacterCount, you wouldn't be able to see whether the underlying parameter represents a character count. It could be some integer with a completely different purpose.
Oleg Kleyman
@OlegKleyman
well that's my argument, if you don't know what the documentation of the base is then the name of the constant is irrelevant because you shouldn't review/modify code you don't understand
Dennis Doomen
@dennisdoomen
IMHO, the change that somebody tries to pass a character count to a variable that isn't representing that is a lot less likely. Using a named constant will at least clarify the intention.
Oleg Kleyman
@OlegKleyman
ok, thanks! I really appreciate the discussion
Maher Jendoubi
@MaherJendoubi
Hello, what about C#6 now?
Dennis Doomen
@dennisdoomen
@MaherJendoubi any suggestions are welcome
Sathanu
@sathanu
I have one question about async in c#
when i run around 20000 task at a time using task.whenall, it won't run more than 1500 task
Can anyone explain what is the issue?
Vijay
@VQuery
Hi all ,
C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(277,5): error MSB4184: The expression "[System.IO.Path]::GetFullPath(C:/Jenkins/workspace/DataScience/datascience-buildrequest\C:/Jenkins/workspace/DataScience/datascience-buildrequest\Assemblies\)" cannot be evaluated. The given path's format is not supported.
facing below issue in project,please help me on this
Dennis Doomen
@dennisdoomen
Which project? The Github one?
Vijay
@VQuery
@dennisdoomen , Sorry i fixed this issue by / instead of \ :smile:
Vijay
@VQuery
How to publish web projects by msbuild engine exe?
Vijay
@VQuery
:worried:
But in vs15 machine its building fine
Christian Johansen
@cjjohansen_twitter
Hi looks interesting, just joined
Dennis Doomen
@dennisdoomen
:+1:
Ghost
@ghost~57ffe2fad73408ce4f2e0e53
I would like to discuss AV1200.
How does AV1200 relate to the old mantra to not use exceptions for control flow?
Dennis Doomen
@dennisdoomen
I don't agree with that mantra
What I mean is that I don't like to use return values for methods that are not supposed to fail.
If they can fail under normal circumstances, I would make that explicit in the name of the method.
Or by providing a property to see if calling that method is save to be called
E.g. Save and CanSave
Ghost
@ghost~57ffe2fad73408ce4f2e0e53
Thanks for the reply. We are having a recurring discussion surrounding this topic at my current job.