Hi all
Developing C# web apps, .net1.1
I have gotten in habit of placing commonly used (interface) functions
in my base page. However, some apps I work on use a seperate "Utility"
class containing common utility functions.
Is there any benefit in doing it one way or the other?
For instance, does having to load up a seperate class cost more or
less than loading a base page?
Best practices / thoughts are wanted.
Thanks
Jeff 4 3223
Jeff User wrote:
Hi all
Developing C# web apps, .net1.1
I have gotten in habit of placing commonly used (interface) functions
in my base page. However, some apps I work on use a seperate "Utility"
class containing common utility functions.
Is there any benefit in doing it one way or the other?
For instance, does having to load up a seperate class cost more or
less than loading a base page?
Best practices / thoughts are wanted.
Thanks
Jeff
The cost of course depends on what the constructor does in each case.
The actual creation of the object costs very little.
--
Göran Andersson
_____ http://www.guffa.com
check out the visitor pattern http://en.wikipedia.org/wiki/Visitor_pattern
Ollie Riches
"Jeff User" <je*****@hotmai l.comwrote in message
news:hh******** *************** *********@4ax.c om...
Hi all
Developing C# web apps, .net1.1
I have gotten in habit of placing commonly used (interface) functions
in my base page. However, some apps I work on use a seperate "Utility"
class containing common utility functions.
Is there any benefit in doing it one way or the other?
For instance, does having to load up a seperate class cost more or
less than loading a base page?
Best practices / thoughts are wanted.
Thanks
Jeff
"Jeff User" <je*****@hotmai l.comwrote in message
news:hh******** *************** *********@4ax.c om...
Hi all
Developing C# web apps, .net1.1
I have gotten in habit of placing commonly used (interface) functions
in my base page. However, some apps I work on use a seperate "Utility"
class containing common utility functions.
Is there any benefit in doing it one way or the other?
For instance, does having to load up a seperate class cost more or
less than loading a base page?
Best practices / thoughts are wanted.
2 best practices are
1) avoiding code duplication
2) avoiding a bloated base class
When you find that 2 base classes have identical methods then you can
extract this out to a common utility class. You can still keep your method
in the base class if you want but it does nothing but use the utility class.
The advantage of this is that it is easy to know what methods are available
for your class however this also tends to bloat your base classes with many
methods.
Most people use the code smell principle. When it smells a little off then
it probably is and you refactor.
PS
Thanks everyone for all the good advice
Jeff
On Sun, 11 Feb 2007 13:25:10 -0500, Jeff User <je*****@hotmai l.com>
wrote:
>Hi all
Developing C# web apps, .net1.1
I have gotten in habit of placing commonly used (interface) functions in my base page. However, some apps I work on use a seperate "Utility" class containing common utility functions.
Is there any benefit in doing it one way or the other? For instance, does having to load up a seperate class cost more or less than loading a base page?
Best practices / thoughts are wanted.
Thanks Jeff
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Markus Dehmann |
last post by:
I have a two different value types with which I want to do similar
things: store them in the same vector, stack, etc. Also, I want an <<
operator for each of them.
class Value{}; // this would be "public interface Value{}" in Java!
class IntValue : public Value{
private:
int _value;
public:
|
by: Santi |
last post by:
I have two classes: Product and Fruit which inherits from Product.
If I try to narrow the reference to the base type by a cast, I always get a
reference to the inherited type.
For example:
Fruit lemon = new Fruit();
Product prod = (Product)lemon; // Now prod is a Fruit Type!!
I want to get a Product reference from a Fruit object, is it possible?
thank you.
|
by: Bijoy Naick |
last post by:
My project contains multiple aspx pages. Many of these pages have
code-behind that use several helper functions.
Instead of copying each helper function into each aspx page, I am
thinking of using a VB Class file to store these.
Questions -
- How would I "include" this class in each aspx page?
|
by: Diffident |
last post by:
Hello All,
I have written a webform which is by default derived from "Page" class. I
have coded another utility class with few methods and an object of this class
is instantiated from the webfom class.
Methods inside the utility class set few global variables which act as
mediums of persistence to hold data. Now my question is all works fine during
my initial request and all the global variables are set correctly, but during
later...
|
by: Andy |
last post by:
Hi all,
I have a site with the following architecture:
Common.Web.dll - Contains a CommonPageBase class which inherits
System.Web.UI.Page
myadd.dll - Contains PageBase which inherits CommonPageBase
- Contains myPage which inherits PageBase
Each of these classes overrides OnInit and ties an event handler
| |
by: Wade |
last post by:
Hi all,
We have created some "Base" class pages for our WebForms and UserControls.
For instance, when we create a WebForm called "WebForm1.aspx", instead of
inheriting from "System.Web.UI.Page" we implement from our "Base" class page
which itself inherits from "System.Web.UI.Page" -- I know, pretty standard.
We do the same with our UserControls, instead they inherit from
"System.Web.UI.UserControl".
Now, there are some methods that we...
|
by: Ratko |
last post by:
Hi all,
I was wondering if something like this is possible. Can a base class
somehow know if a certain method has been overridden by the subclass?
I appreciate any ideas.
Thanks,
Ratko
|
by: =?Utf-8?B?SmF5IFBvbmR5?= |
last post by:
I am trying to access a Public property on a Master Page from a Base Page.
On the content pages I have the MasterType Directive set up as follows:
<%@ MasterType virtualpath="~/Master.master" %>
On the Master Page I have a public property exposed:
Public Property ErrorMessage() As String
Get
Return txtError.InnerText
End Get
|
by: =?Utf-8?B?c29uaWNt?= |
last post by:
Hi,
What is the best way of populating a repeater control from a SQL Database
using a base class. I am trying to impliment a base class that can be used
across future websites and will populate a repeater control on the aspx page.
The logic is losing me a bit as it seems wrong to try to access the control
from a base class but I can't seem to get the base class to work correctly
unless I copy all the html code into the base class and...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |