locked
Is it Business Logic or Presenation ? RRS feed

  • Question

  • I have a person with int score

    person 1   - 5

    person 2   - 2

    person 3   - 3

    person 4  -  5

    person 5  -  3

    And I need to show

    Group 1

    person 1   - 5

    person 4  -  5

    Group 2

    person 5  -  3

    person 5  -  3

    Group 3

    person 2   - 2

    So I have group logic.

    return temp.GroupBy(x => x.Value).Select(x => new Data2 { Place = ++i, Datas = x }).ToArray();

    And i am confused where to put it.

    1. At Business Component and it will be a business logic.

    2. To Controller and it will be presentation logic. ( It's a web application )


    <a href="http://smartwhy-dotnet-en.blogspot.com/">My .NET Blog</a> with projects and feedback.

    Monday, June 16, 2014 1:55 PM

All replies

  • Hi,

    For me, this is clear business logic. That people can be grouped by score is a feature of the application, and not just some artefact of the presentation layer.

    Think of it this way. The code you showed could easily be subject to unit testing to verify the implementation meets the specification. The unit testable code is not encumbered with anything specific to the presentation layer, its exists and works in then business domain.

    Hope that helps,

    Nick.

    Monday, June 16, 2014 10:52 PM
  • Not so clear for me. You can argue that the business requirement is to project a list of person and scores, how you choose to sort that is up to the presentation.

    http://pauliom.wordpress.com

    Thursday, June 19, 2014 11:03 AM