locked
is there any impact of using static methods in Business Access layer in 3 tier applciation RRS feed

  • Question

  • User-1465674731 posted

    is there any impact of using static methods in Business Access layer in 3 tier applciation,


    Please suggest me what are the best practices and standards

    Wednesday, August 25, 2010 5:14 AM

Answers

  • User-525215917 posted

    atconway is correct, one little note by me too. If your static variables use shared resources then you must be sure these resources are locked and unlocked correctly. And in this case you may face performance problems because threads are waiting when some other thread unlocks the object that method needs. If your static methods are just utility methods then there are no performance problems.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 28, 2010 1:46 PM

All replies

  • User1105131773 posted

    The easy answer is no - static methods are very viable in n-Tier systems. As with anything it depends how and for what you are going to use them in order to determine any 'gremlins' which might occur.

    Wednesday, August 25, 2010 7:27 AM
  • User-1818814851 posted

    it is not the question of impact of using static methods in BAL. That depends on your requirement, if you have frequent calls to same method again and again then you can use static methods.

    Wednesday, August 25, 2010 8:56 AM
  • User-952121411 posted

    is there any impact of using static methods in Business Access layer in 3 tier applciation,
     

    Not at all.  However I typically don't expose 'Shared' (VB.NET) or 'Static' (C#) methods Publically between layers too often.  If I am using Shared methods which typically correlate to helper methods that are used often, I expose them within that layer to be accessed in that manner.  So I am not usually calling Static or Shared methods on the BLL from the UI or obviously the other way around.  However I do have 'Utilities' classes within the UI or BLL marked as 'Friend' so they are fully accessible within that layer.

    Wednesday, August 25, 2010 9:55 AM
  • User-525215917 posted

    atconway is correct, one little note by me too. If your static variables use shared resources then you must be sure these resources are locked and unlocked correctly. And in this case you may face performance problems because threads are waiting when some other thread unlocks the object that method needs. If your static methods are just utility methods then there are no performance problems.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 28, 2010 1:46 PM