You say not to put business logic in your page itself, but then you contradict it by creating an instance of a class within your button's click event, instead of creating the instance as a property of the form or making this method static, which is also more business logic then the creation of a string, which in my opinion, is part of the designers work who you would now have to share your Greeter Class in order to be able to change that.
I realize this is an old thread but I found this to be quite useful -- thanks, bidwx. To answer exlova's question, it's bad form to embed business logic such as "Hello world" in the codebehind. Typically, if a future developer wanted to change this greeting, the appropriate place to look would be in the construct behind the button's instance, which is what he is demonstrating here.
Hi - In order to improve the ability to maintain, change, and extend the code, business logic should not be combined with the user interface code. Check out our videos on UML for a discussion on how to break an application into classes.
This has been flagged as spam show
Hi! Could you guys please check out my channel? I will do a giveaway when I reach 100 subscribers! Thanks!
hackster2011 2 months ago
I am kinda new in the .net scene and ill be watching more but whatsup with the cursor it looks mad.
goliathlup1 7 months ago
You say not to put business logic in your page itself, but then you contradict it by creating an instance of a class within your button's click event, instead of creating the instance as a property of the form or making this method static, which is also more business logic then the creation of a string, which in my opinion, is part of the designers work who you would now have to share your Greeter Class in order to be able to change that.
These tricks should only be done in big programs.
Xelights 8 months ago
I realize this is an old thread but I found this to be quite useful -- thanks, bidwx. To answer exlova's question, it's bad form to embed business logic such as "Hello world" in the codebehind. Typically, if a future developer wanted to change this greeting, the appropriate place to look would be in the construct behind the button's instance, which is what he is demonstrating here.
simpint 1 year ago
Where do I download this software please?
snaggypaggy 1 year ago
Why do you want to avoid business logic?
exlova 1 year ago
Hi - In order to improve the ability to maintain, change, and extend the code, business logic should not be combined with the user interface code. Check out our videos on UML for a discussion on how to break an application into classes.
bidwx 1 year ago