While coding in Java recently, I decided to do a little research to see if Java supported the #region directive (or something similar) and found a ton of articles knocking its usage as poor programming style.
Personally, I love the #region directive in C#, as it allows me to keep my code more organized (and yes, I am aware of the exisiting code-folding functionality in Visual Studio). In the files I work with, I’ve become pretty meticulous about organizing the code blocks into regions, partially because I like the organization, and partly because I was previously under the impression that it was good form to keep source files organized in this way. I use the following regions myself, generally:
- Private/Protected Members
- Public Accessors
- Public Methods
- Protected Methods
- Private Methods
- (Anything class specific)
I agree with the sentiment in the articles I’ve read that it is *not* good practice to sweep bad code under the rug by hiding it from the developer in a folded #region, but I think that organizing relatively good code into regions like the ones I’ve mentioned above makes it a lot easier to get directly to the code I want to work on.
What do you think? I’m curious to see justifications for/against this directive, and as always, thanks for reading!
In relation to the last post, here are some starter kits and projects officially listed at Microsoft’s own ASP.NET site (http://www.asp.net/community/projects/)
DotNetNuke is an open source web application framework ideal for creating, deploying and managing interactive web, intranet and extranet sites. The combination of an enterprise portal, built-in content management system, elegant skinning engine, and the ability to display static and dynamic content makes DotNetNuke an essential tool for ASP.NET developers.
TheBeerHouse starter kit enables you to implement a website with functionality typically associated with a CMS/e-commerce site. This website demonstrates key features of ASP.NET 2.0 and is the sample used in the book, “ASP.NET 2.0 Website Programming / Problem – Design – Solution.”
The Small Business Starter Kit provides a sample of a business promotion website suitable for small and medium-sized businesses. It provides a template for customizing and creating a site for your own business out-of-the-box, with advanced features including integration with SQL and XML data sources for content and data management.
dasBlog is a blogging engine that offers elegant visual aesthetics, powerful easy to use features, and a unique application architecture. dasBlog requires no database engine, using file-based content management with an architecture that ensures excellent performance.
Visit the dasBlog Web Site
ScrewTurn Wiki is a fast, powerful and simple ASP.NET wiki engine, installs in a matter of minutes and it’s available in different packages, fitting every need. It’s even free and open source.
Visit the ScrewTurn Wiki Web Site
I started looking for free/open-source ASP.NET applications to run on my development instance of IIS (since IIS is already running on my machine), and stumbled upon this list today:
As a big ASP.NET advocate, I’m loving the recent surge in open source / free ASP.NET applications that are hitting the web – And what’s more because Microsoft have given us some great building foundations with the frameworks like the ASP.NET Membership Provider, a lot of these open source programs are very high quality! More so than some of the paid applications.
I thought it would be a good idea to create an ever growing list of all the open source ASP.NET applications I could find – Obviously I haven’t had chance to download or install every application so I can’t vouch for them
Full list available at:
Update: This application will help you track down which applications are using which ports on Windows – very helpful for debugging if the steps below don’t solve your problem, or if IIS is not the only application answering on port 80: http://winnetstat.zapto.org/
Also, if you don’t specifically need all the features of XAMPP, but would like to run PHP/MySQL applications through IIS, give Web Platform Installer a try. Through WPI, you can choose to install PHP directly within IIS (so that IIS can serve both ASP.NET and PHP applications on port 80, for example) and you can also have a ton of applications installed and configured automatically for you, such as Drupal, WordPress, and Moodle (among many others). However, if you are still looking to run XAMPP specifically, or just run an Apache instance along with IIS, check out the instructions below. Thanks for visiting!
Continue reading “Making XAMPP (Apache) work with IIS on Windows XP/Vista”
Found a great little snip of code online today from csharphelp.com about how to open a new browser window from a C# codebehind:
…but, one of the comments on that thread is that the Response.Write disrupts the page appearance. Any thoughts/suggestions on a better way to open a new browser window from a C# codebehind?
Great post on how to share a solution between VS2008 and VS2005, from stevenharman.net/blog:
One of the things I’m most excited about with Visual Studio 2008 is it’s ability to target various versions of the .net framework, a feature known as multi-targeting.
I recently rebuilt a (hand-me-down) laptop for use at developer group meetings, conferences, and coding from the couch. When building out the machine I decided to only install VS2008 and make use of multi-targeting to work on my various .net 2.0 projects… like Subtext. Today I finally got around to loading Subtext up in VS2008 and I was expecting some heartache.
But I did a little research first and luckily came across Rick’s great post explaining how VS2008 and VS2005 can be made to play nice together, allowing you to work with your projects in either IDE. The gist is, the project files (i.e.- your
.csproj files) will work in either environment, but you’ll need to maintain separate solution files. Not a huge deal as most of the churn is usually in the individual project files, and not the solution.
(via Multi-Targeting VS2005 and VS2008 Web Application Projects, a Gotcha!)