Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Performance between JavaScript, C# and SQL in Business Rules

Hey, guys.

Recently I planned to start a new project using C# code only.
Just curious, is there any performance issue if all the business rules written in C# compared to JavaScript and SQL?
Also, I found that it is much more convenience to manage the functions just like MyProfileBusinessRules.cs which generated by COT automatically.

Known Exception:
- Attachment validation (naturalWidth, naturalHeight, set byte[] to null) can only be done in JavaScript.

2 people have
this question
  • 1

    This is a very good question, unfortunately, the answer to this question is the dreaded: "it depends".

    But each tier has its "natural" purpose, if you can afford to write all code business rules in c# instead of wasting a roundtrip to the database for simple variable initializations, calculations o validations, do it. But, honestly, unless it is embedded in a complex loop the improvements in performance is negligible.

    After some years using this framework, CoT has been improving the client tier (javascript) so, saving roundtrips to the server might help responsiveness very much. Now, I try to do as much as I can in the client tier, but it is a painful process due to lack of documentation.

    Now, where you have the most to gain is in the database side, plan the data model carefully and be very aware which tables are going to grow, do not expose heavy views to the user interfase, they will come back to bite you. If you have formal computer science education, take into consideration that normal forms are not always suitable for "real world" data models, as you might have to cache a lot of calculations to keep the application responsive.

    And this is just the tip of the iceberg...

    Best regards,

  • (some HTML allowed)
    How does this make you feel?
    Add Image

    e.g. indifferent, undecided, unconcerned sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited