|
|
Sunday, October 12, 2008
The Useless Introduction You Used To :)
This post has taken so long to be started in writing. I’ve been busy with many events in my life lately. Suffering from frequent limited internet access lately, and, all this moving between companies thing has been eating me. And yes, I admit, I' have been as tired and more honestly lazy as you expected me to be!
Hey, there’s a little warning. This post is not exactly for my usual audience. I’m sorry, but introducing Domain Driven Design is not one of the goals for this post. There’re many interesting resources and books (even FREE: InfoQ, Domain Driven Design Quickly) on the topic. However, if you leave me a comment telling me to make a write-up on the topic, of course I will :) :).
One more thing. Another reason I’m working on this is that I’m preparing for an internal session here in Raya about Practical Lightweight Domain Driven Design. This session is truly internal yet. It should be recorded though but I’m not sure whether it’ll be possible to publish the videos (Yeah, I will see how we can have our public sessions of possible sure!). If you have a user group and would like me to give this session in a group meeting, I’ll be glad to do.
Introduction Still: The Messages, The ORM
This post was originally a couple of messages I’ve sent recently to the ALT.NET Yahoo Group. In which I discuss using Domain Driven Design with an ORM, more specifically, my favorite ORM, LLBLGen.
Quoting from the first message:
For now, we're going towards LLBLGen Pro 2.6 for DAL generation and such (using Self-Serving mode probably). Yes, we're going for database first design, and not using NHibrernate. I'm hoping that we can keep those two issues for other threads :).
Right now, I'm going for other Domain Driven practices. I want to make sure using POCO classes is worth it, and then see how to have those in LLBLGen (which -LLBLGen main template- is in its internal not much different design than Active Record, which in many times is handy, it's VERY rare t change DAL when one fits different DB providers with good performance), and what are common patterns to do Domain Driven Design at all when having LLBLGen as DAL (if it makes any difference - again: and if effort to make it encapsulated enough to make no difference is worth it).
Making this choice alone is worth its own article. Maybe should title it “In Search For The Perfect ORM” as well :-D.
UPDATE: Frans Bouma has a nice write-up about what is an ORM and different types on an ORM. It's quite old (2004), but the concepts themselves are still valid.
My original question was:
So, is anybody here doing DDD and uses LLBLGen as DAL generator ?How does the experience look like ? What are common practices across all projects and what have been pitfalls ? etc... These are the kinds of questions I'd love to see somebody here with something to share about.
Domain Driven Design At Work
This is not really an LLBLGen issue. It is questioning the Domain Driven Design productivity itself. I like DDD. I see it as the natural next step after 3-tier deisgn. This whole separation of concerns, models, repositories, factories, infrastructure, and services paradigm just fits my mentality and view of how the world looks like. However, not all the practices in DDD are similar in terms of return of investment, the customer business value that Agile emphasizes. The trick is to know which are and which aren’t, and how to do the balance.
In the second message, I go through an example of typical usage for DDD that has tried just a little bit to be lightweight in some areas but not others, and my own overview about what needs improvement:
I've been on a project that leverages DDD once before myself. The project has been frozen for a while for other priorities, etc...Maybe I start with my own take on the subject!!
We've been using the "Adapter" model. I thought it was for seeking some sort of more control/flexibility. Reading Fran Bouma’s blog (http://weblogs.asp.net/fbouma, the creator of LLBLGen), I see how he's so much of an "Entity Design" guy. Well, makes sense, he owns the best entity design I've seen so far having considered EF and CSLA.
Clearly he sees the "Self Servicing" as the core for entity design rather than model design. You know, the "entity.Save();" style. This makes me have two thoughts at a time actually. 1- That "Adapter" model is the right choice for DDD (I'll get to that just below), 2- That maybe DDD fully is not what I really want (the entity Self Servicing style is so powerful. It has saved my day so many times before).
Looking at the project I've been working on, We had something like those namespaces / VS projects (and others … ):
Company.Project.Adt (for models that may be reused in other projects, like Language, Currency, ...)
Company.Project.Model (for project business domain specific models)
Company.Project.Data (for LLBLGen stuff, we have also "DataDBSpecific" and such related to Adapter mode)
Company.Project.Repositories (have interfaces and implementations for repositories, let's put aside why the two in one project for now)
A repository load method could probably look like:
Category Repository:
public static ReadOnlyCollection<Category> LoadByShop(Shop shop, bool includeDisabledCategories)
Or for internal use:
Shop Repository:
internal static Shop Load(Guid shopKey, bool loadCategories, bool loadProducts)
What I want to highlight here is the "include...", "load..." parameters. I'm not sure whether this is the best way to do it.
Also, what really hits me is the mapping. You know, from LLBLGen entities to our domain models. We have been doing this in factories which live in the Repository space. Each factory had methods similar to this:
public static Shop CreateShopModel(ShopEntity entity)
public static ShopEntity CreateShopEntity(Shop shop
Regardless of the "public" access modifier (this is all very well hidden behind a service layer, but let's put the whole issue aside as well), the idea of having to go through all the mapping has been just a boring ugly task, that has been there for long.
To be honest, we didn't get so much benefit of it. It should have good promises, but how good compared to the cost of implementing them for complex object graphs ? That is the question!
Things got just worse when we wanted to implement our service layer. That's a service in the classic sense of "web" service layer (REST), we wanted to created DTOs that can correspond to XML and JSON responses of our choice, and again, we had to do the mapping from and to the domain models and DTOs. Want more ? The DTOs wouldn't convert to XML strings automatically (to JSON it would), we had to have another mapping layer from and to the DTOs and the actual XML.
Of course we had much time defining XML specifications and writing so many unit tests for this. I know not every project can go in this direction to this extent, but, I wanted to show where going in this path can take you.
So, even without service layer complications. You still have the model mapping tasks that (and this is what worries me) in many situations does not correspond to a "business" need. Note that I want to be doing Agile as well, and this makes the issue of delivering business value a true concern.
You can talk about automated generation for mapping. This may be something. We know it'll not be this direct or one to one of course anyway, but it may help.
Would you do Domain Driven Design with "entity" models assuming the developers will stick to calling the repository's "Persist" method instead of "entity.Save();"? You just can't do that! How about new developers ? How about inconsistencies ?
Is mapping really that bad and much of an effort ? First look at it, I say it isn't. But given complex scenarios I've been though I have to wonder about things like "complex object graph" and "caching" (in memory, on different levels, etc...).
It's all about trying to calculate the costs indeed.
That’s what I’m trying to make out of this, the trick for the right cost.
Conclusion: How About YOU ??
Let me repeat the end of those messages:
Anyway, would love to hear your takes and what you have :) :) :).
If you have any thought on the topic, those will be most appreciated. You can comment here or in the topic messages page on ALT.NET Yahoo Group. This is an open discussion area, and I do not expect it to be closed soon.
Same, if you want to hear more ramblings on the topic, or just want me to shut it up all, send me a line.
Would love to see what others have to say about this….
Technorati Tags: .NET, Domain Driven Design, DDD, AlT.NET, AltNET, altnetconf, agile, ORM, LLBLGen, Frans Bouma, Mohamed Meligy, Local Events
Cross posted from weblogs.asp.net/meligy
Wednesday, September 17, 2008
I'm joining RAYA Software starting next month (October), part of RAYA IT, a business line of 3 main business lines that form RAYA Crop., a well known name in the IT industry over the Middleeast. My role is very interesting. The entire company is interesting to me, not just for the size and brand, but for the nature of how things are going in there nowadays, which makes RAYA the perfect place to join at this specific time. About the role I'm joining RAYA with the same title I hold current, a senior software engineer, yet, I'm going to be a member of a team of only 3 guys, M. Yosry, whom I haven't met but is said to be a real guru by all guys I met in RAYA, M. Zahaby, an ex-RAYA returning in it recently and a personal friend of mine whom I had technical chats with and even worked with in a single freelance and knew what kind of a geek he really is, and myself! The team is very special inside RAYA Software. We as team are responsible for helping other teams standardize coding practices all over the company (well, this is all within Microsoft technology development teams, I know nothing about Java technology department), and help other team leaders and members implement agile processes (specifically Scrum) in the way that fits work nature in RAYA. We stand with other teams in design sessions and researches/investigations required for specific projects, and we help create and enhance a rich toolset, reusable components and modules over applications. We work with all other teams and report directly to the "Microsoft Partnership Manager", El-Mohanned, who is like the CTO for Microsoft technology development, and a very interesting guy as a boss. Both very respectable, and still having his geek nature deep inside not affected by his current high management rank! About the company RAYA is a well known name in the software industry. Like many big companies, it had its special advantages, and eve problems. These days, the guys at the company starting from junior developers, the the GM, Aly Zweal (not sure of the spelling), whom I really enjoyed meeting him as a part of my recruitment process. The guy has a great smart mentality that measures the technical aspects to the business aspects for just the right balance, and whose meeting was as well as El-Mohanned's description of the interesting job duties some of the main reasons I accepted the job offer. Right now RAYA is going through some really revolutionary changes. The smallest of those are switching to Scrum and migrating many projects to using latest technologies and having a big yet very precise recruitment campaign. The company's line of business is rebuilding itself for more progressing forward, which makes it the perfect time to join and share in this building, especially when the role allows more impact on this process. Regarding Agile, it's cool how El-Mohanned's first communication with me included a link to one of the two videos he uploaded to YouTube, "Raya Software Goes Agile": This is the technical part, which is for someone like me a must-have base for having talks about anything else. But still, there's more about RAYA Corp. in general. Belonging to a big corporate is another paradigm that I lived some of its blessings in my previous company GNS (Gulf Network Solutions). Now, I'm into the full experience of living within a corporate environments. It just helps you think differently about your entire life, and opens new areas to think about. A worth-it experience indeed that many people once taste find it very hard to change. Vacancies Oh, yeah, by the way again, RAYA is hiring! I mean it. THERE ARE OPENINGS. There're openings for junior and senior developers, team leaders, and testers. You can check the careers page, and send your CV to the email mentioned under each vacancy, or to El-Mohanned, or simply to me! Hey, make sure to specify the position you are applying to in the email subject please. This is the rule, isn't it? :D What about SilverKey? That's what SilverKey is to me:  
 
   Geeky days and even nights, company kitchen talks, volunteering entire public BIG free DemoDay events, pre release tools and platforms, varying nationalities, cultures and mindsets, wedding and birthday and even farewell parties, virtually wearing multiple hats at work(roles), analysis and design negotiations. launch celebrations treats, Scrum process customizations, teamwork, Dody and Alia's guitar, having breakfast in Ramadan tent, ... There's much about SilverKey that I cannot explain by just saying. It used to be almost my house for more than two years now. I think I know about some of the people there more than I know about my own family and maybe same for them. There're people who sure have made a difference during this period, Dody and Kent come on top of those. There're guys who make for best friends like M. Nour. There're some special personalities that are hard to meet occasionally like Amir Magdy, H. Zein and M. Tayseer. There're people who are not just interesting as techies but have their own other interests like Ahmed El Malt and Tamer Zaki and Karim Ennarah. There're fun foreigners like Sharron, Tosin, and, very quiet yet still really fun foreigners like Brian, Chris, Luke, David, and Olivia. There are very passionate and promising guys like Kariem Soudy and Amr Ali, There're true fun guys like Mostafa Murad (AKA, TATA beik), M. El Sayyed (AKA, SAYYYED), Emad (AKA, iMAD), and M. Alaa (AKA, Developers friend). There're kind guys like Ibrahim Marzuk and Taher. There's an old buddy and community partner, Mohamed Hossam (AKA, BASHMOHANDES), business guys like Adam and Farid. And there's for sure M. Kassem and Ahmed Ali and so many names that it's easy to miss a lot of those over different generations (by the way, no categorization intended!). Although not so many of those names are still there today that most guys will not recognize the rest of all other names, this is much to carry for the company itself. If it was only that I met Mona, my lifetime love, current fiancee and soon my wife (God Willing), and, the girl I believe is the best to exist in our world today, I met in occasions all related to SilverKey, that would be enough. So, technically I'm not leaving SilverKey completely for the upcoming while. Afterwards, who knows,, most likely the new generation will take over on its own afterwards (God willing). DISCLAIMER The thoughts and states expressed in this post and entire blog are solely mine. Neither of my past/current/future employers nor any of their employees/owners hold any kind of responsibility for or commitment to any of them, even if mentioned in behalf of this employer.
Cross posted from weblogs.asp.net/meligy
Thursday, September 11, 2008
Although I hate to quote that often, but, this one is totally worth it: Brad Abrams recently wrote a reference to this great "Evolving a .NET 3.5 Application" white paper, about the common scenario of migrating a .NEt 2.0 project to .NET 3.5. The white paper is available in PDF format here (direct link). About which I quote Brad's words: I reader recently forwarded me an interesting case study that covers a very common scenario: Porting a .NET Framework 2.0 based application to .NET Framework 3.5. The paper does a nice job of providing resources to get started with, how to learn what is new in .NET 3.5, etc. As well as details on why this project made decisions it did around using WPF, WCF, etc. I don't claim to agree with all the assertions made here, but all in all it is a very balanced, pragmatic view of what some of the common choices you will have. The project uses client and server components and the paper talks about not only the design process but how to build AND test these. They talk about ViewModel in WPF, IoC, NUnit and VSTS, etc Enjoy! Yeah, Enjoy :).
Cross posted from weblogs.asp.net/meligy
Wednesday, September 03, 2008
It is a VISUAL STUDIO 2005 PROJECT! Of course we're talking about the Windows version here :).
See short note...

More Information
Source: CodeProject Lounge Post.
Cross posted from weblogs.asp.net/meligy
Monday, September 01, 2008
Slideshare is quickly becoming the defacto standard for sharing presentation slides, just as YouTube for videos, and Flickr for images. I recently got into the habit to share my presentations there and use the embed feature to include it in my weblog, and this was the same for the "Design Patterns Via C# 3.0" session. This morning I got this email from SlideShare Hey Mohamed_Meligy! Your slideshow Design Patterns Via C# 3.0 has been featured on the SlideShare homepage by our editorial team. Cheers, - the SlideShare team WOW .. I couldn't believe it until I went to SlideShare.net and saw it myself ...  Thank you SlideShare. I never expected the slides to be interesting to that extent :D :D :D.
Cross posted from weblogs.asp.net/meligy
Yesterday was my 2 part session about Design Patterns as part of dotNETwork 7th gathering. Thank you all guys for being there, There was so much interesting stuff about the audience. The conversation we all had even before the session starts, the interaction with all parts of the session, and the great questions. Thank you all. You can find the slides for the 2 parts combined in single downloadable file. For the code examples/demos, you can find them in single ZIP file as well. I hope you enjoyed the session. Related Links Technorati Tags: design patterns, patterns, gof, gang of four, oop, object oriented programming, ddd, mvc, C#, C Sharp, C# 3, C Sarp 3, C# 3.0, C Sharp 3.0
Cross posted from weblogs.asp.net/meligy
Saturday, August 23, 2008
dotNETwork, the most active offline user group in Egypt is having its 7th gathering next Saturday, August 30, which will have two parallel tracks for the first time in the group gathering. BizTalk Introduction, and C# 3.0 Design Patterns, which I will be delivering! If I were you to attend the event, it would have been a hard choice too (unless you go simply for BizTalk) ! BizTalk beginner introduction as a topic was not delivered in public sessions before. The only BiTalk sessions I know of were either advanced ones or introducing newer version to those familiar with old version. If you are my friend or you are pretty much into patterns, you may want to give what I have to say a look. The session parts were primarily intended to be in a couple of dotNETwork gatherings. Now that dotNETwork decided to try out the parallel tracks model having two sessions in the same topic in each track (which is a decision I really like, except that I'd love more distinction between the topics), it was logical to have them in the same gathering / track. I have been thinking whether this should go for the simplest level possible ever, then, decided to stick to the original plan, and even use the long time available for the presentation (1:30h for each part) to go say more about related topics, as I have so much interest in delivering this in certain way for long time now. About the Session I'm still messing around with the agenda / exact sequence of the components to be delivered in the session, but I'm going for making an intro to so many topics. The session is meant to target a very wide range of developers. Pretty much anyone who knows a little about C# 2.0+. I'll start by identifying what a "pattern" means, and then go talking about different object oriented design principles, meaning things like OCP "Open Closed Principle", not "what's the different between class and interface?" or "what are abstraction, polymorphism ?" stuff) assuming basic knowledge of the latter but still going through it. I'll present around 2 examples of each category of the gang of four object oriented design patterns, and probably a couple more from other sources, highlighting few C# 3.0 features using examples from O'reilly "C# 3.0 Design Patterns" book. Building on the object oriented patterns and principles, I'll go introducing some enterprise patterns (yeah, pretty much Martin Fowler work), and end with a small introduction to "Domain Driven Design", which I plan to deliver in a long session (may another two part one, with dotNETwork or maybe ITWorx CuttingEdge Club or public SilverKey DemoDay - if any) with respect to ASP.NET MVC framework in similar manner to Rob Conrey's StoreFront series. This can move the range of fresh and classic developers knowing just the basic language features and getting that to work in small project to see the trends in the software industry world wide, and in the same time provide some exciting topics for the experienced developers willing to know more about the rarely discussed topics in Egypt developers community. Needless to say, the key to the session is audience interactivity. I'm dying for questions and discussions from now already. Of course this is not going to be fully covering any of the topics. After all, this is still a presentation, not a course! About the Day The event will be next Saturday, August 30th at the Canadian International College, in "El-Tagamo3 El-5ames". There will be buses at Nady El-Sekka (11:00 AM - 11:30 AM) Remember, this is a FREE event. Agenda: | 12:00 - 13:30 | Tec-Talk Wiz BizTalk (Part 1) Tamer Mohammad Fathy AL-Khouly, Mohammad Yousri El-Farsi. | Design Patterns via C# 3 (Part 1) Mohamed Ahmed Meligy. | | 13:30 - 14:00 | Break | | 14:00 - 15:30 | Tec-Talk Wiz BizTalk (Part 2) Tamer Mohammad Fathy AL-Khouly, Mohammad Yousri El-Farsi. | Design Patterns via C# 3 (Part 2) Mohamed Ahmed Meligy. | Sessions will be video recorded. Good that I'm not missing the BizTalk track completely :). Related Links Note Please drop me a comment here or email via blog contact page if you intend to come and have certain tip / suggestion for the session. Technorati Tags: .NETfx3.5, dotNETwork, NET, C# 3.0, Cairo, Egypt, Local Events, Meligy, Design Patterns, OOP, OOD
Cross posted from weblogs.asp.net/meligy
Saturday, August 16, 2008
Mostafa Murad, a great UI designer whom I've worked with in two companies, was having a BIG dish party yesterday. Maybe in the occasion of himself recently becoming a team leader in ITWorx or just out of hospitality. He put few simple rules (I'm quoting him here): - It is not solely barbecue anymore, you are free to bring whatever food you like.
- You are free to invite your friends or family members. Many people will bring their spouses and children. There is a big clean garden which is very suitable for children.
- We'll have football competitions etc
He made a Google Spreadsheet Guest book, where you put your name, your favorite food, whether you have a car or not, how many friends/family members you are getting with you, and, how many kids are coming with you as well. It was GREAT. The garden was SO BIG. There were over 50+ guys out there: .NET/Flash developers, graphic/web/UI designers, QA, Project Managers, and many other roles, from a number of well known software companies in Egypt, like ITWorx, LinkDev, ITS, SilverKey (myself), and other companies I guess. All the guys were very cool. The day started with all cars meeting in 2 queues at start place from 10 to 11 AM to pick the guys with no cars (like me) and move together. The queue I joined consisted of around 4+ cars.The guys I joined had good taste in music that I enjoyed selective choices for Mohamed Mounir and Fayrouz along the way to the farm where the party did go. The way itself was pretty interesting and unfamiliar to number of us! Mostafa Murad, Osama Murad (my ex-team leader in GNS, currently working in LinkDev), and some kind family lady did a superior job in hospitalizing the crud. We had around 5 kinds of breakfast food, then, went to Friday Prayer (Gomaa) in the near mosque, coming back to play word games, some moved better than the rest to play football and Tennis, afterwards, grilling around 4 kinds of meat and 2 or more kinds of flies, while the family ladies were working on some other 4+ other kinds of dishes. It was AMAZING. You can see a bunch of the the hungry near the END of distorting all the food! After the food, we managed to take care of around 6 kinds of drinks (apart from tea and coffee, those were available all day long), and around 6 kinds of fruit and later some huge amount of oriental sweets and some tasty cake. It's funny to see that we are the same guys who were praying Aasr just before the attack! Of course this is not all of us. There was number of Christians, number of girls, women and children, and other Muslims who didn't catch this line by the time of the picture. As I mentioned, we had much fun. We just went mad all over figuring out something to play, playing with each other either word games or sports, and playing with the VERY CUTE little kids that were there (especially Yasine, this little hero rocks!). We had different talks about general stuff in Egypt, and -of course- our software industry and career talk and stuff. It was hard to resist the idea of going in starting our own company having people of all needed roles there already. Some guys suggested that we can call it "El Mazra'a" (the farm) company! The farm itself was sooo great place to rest in. Very comfortable. I do not know how this can be described, but, they say a picture is worth thousand words: I think I fell asleep sometime near by "El Maghreb" prayer! It was very great to find this great place to just forget about everything and have some true rest. Actually, the whole thing was pretty new to me. This is a little near the number of guys we had in the first SilverKey Public DemoDay event. It really felt like an event to me, not only including certain category of people (developers, designers, ..), but, all over the various industry roles. I tend to believe that hardly any other person than Mostafa Murad and his fame (with the great aid of Osama Murad and other Murad family members) would be able to gather all this amount of people in one place. This is such a TRUE community activity going around, and a HUGE step that any community activity in Egypt should consider. Thanks a lot Mostafa and Osama for this great day and the great hospitality. It was a great day and a very nice move from you all. Technorati Tags: Local Events, Egypt, Mostafa Murad, designrific, Osama Murad, ITWorx, LinkDev, ITS, IT Soft, SilverKey, SilverKey Tech, Community, dish party, Barbecue
Cross posted from weblogs.asp.net/meligy
Tuesday, August 12, 2008
Very Quick Note: Visual Studio 2008 Service Pack 1 was released finally (in combination with .NET Framework 3.5 Service Pack 1 of course). To sum up for some people, note that VS 2008 SP1 includes ADO.NET Entity framework (and its designer) as well as ADO.NET Data Services, but NOT ASP.NEt MVC framework (but does include ASP.NET Dynamic Data & ASP.NET AJAX history control and script combining). It also includes some WCF enhancements as well as major VS performance and scalability fixes. P.S. SQL Server 2008 also was released earlier last week. See official page for SQL Server 2008: http://www.microsoft.com/sqlserver/2008/en/us/default.aspx Technorati Tags: VS, VS 2008, isual Studio, Service Pack, SP, SP1, .NET, .NEt 3.5, .NET3.5, netfx3.5, Visual Studio 2008 Service PAck 1, Visual Studio 2008 SP1
Cross posted from weblogs.asp.net/meligy
Sunday, August 03, 2008
Background (skip if you know Web Application Projects) In VS 2002/2003, the web project model for a website was similar to "class library" projects, where you have a .CSPROJ or .VBPROJ file that keeps track of files "included" in the project, and compiles all the pages and controls code behind to a single assembly under "\bin". Each page/control has an automatically generated .DESIGNER.CS or .DESIGNER.VB file, which contains objects mapping to the server controls in the page/control markup (the generation of those files was not always in synch with markup, and that was problematic). With VS 2005, there was a new "website" model for web projects that compiles each page/control individually as a separate assembly (or each folder, depending on optimization features), and applies this to all files in a given directory and its sub folders. This was a total mess in most "real world" projects, as VS takes so long to build the entire website, and even at deployment, you get sometimes many problems when you have pages that "reference" other pages/controls when IIS it trying to dynamically load the right assemblies to reference, and many other problems. So, Microsoft came with a new add in to VS 2005 called "Web Application Projects". This is typically the same old VS 2002/2003 project model with no problems in generating DESIGNER files and with integration with both IIS and ASP.NET development server that comes embedded in VS 2005/2008. It was later merged with VS 2005 SP1, and shipped as part of VS 2008 (without removing the "website" model). Note that most stuff that has to do with Microsoft like ASP.NET AJAX Toolkit Sample website and so are actually "web applications" not "websites". The problem Typically, when you are converting any project from VS 2003 to VS 2005 SP1, it converts as "web application" not "website". You can also convert a "website" to a "web application". There's an option "Convert to web application" to look for. In my company, all our web projects are "web applications", well, except that other web project I was code reviewing and helping with its deployment! After spending number of days with the brilliant team and not finding as many items to code review and getting sick of some problems at sometime in deployment, I cried to them to convert it to to "web application" (maybe I was looking for some job to be doing :D). Very confidently, I said, " remember the option exists and I did conversion before in VS 2005. All it takes is a right click on the 'website' root node in solution explorer in VS 2008 and 'Convert to web application'. It almost never causes any problems, and we have our source control anyway". They believed they had time to do it, so, they went to look for that menu item "Convert to web application" and guess what ? They didn't find it! They tried resetting VS 2008 settings and everything, and still, nothing there!!! Yeah, it was embarrassing :D :D :D Workaround, or, how to convert a "website" to "web application" in VS 2008 Well, it turns out that the option "Convert to web application" does NOT exist for "websites". The option "Convert to web application" does exist only for "web applications" !!!! So, here's the deal, to do the conversion, you need to: - Add a new "Web Application" to your VS 2008 solution (File->Add->New Project->C#->Web->ASP.NET Web Application).
- Afterwards, you copy all the files in the old "website" to your newly created "web application", and override any files created in it by default
- The next step is the most ugly, you need to "manually" add the references in your "website" to the new "web application". I thought the VS 2008 PowerCommands toy would do this for me as it does copy references from other project types, but it didn't. You have to do it by yourself, manually, and you have to be cautious in this step if you have multiple versions of the same assembly (like AJAXToolkit in my case) or assemblies that have both GAC and local versions or so.
- Keep repeating the last step and trying to build the "web application". You'll keep getting errors like " '....' is unknown namespace. Are you missing an assembly reference? ". Make sure you have none of those except the ones where '....' is replaced by the IDs of the server controls you use. In other words, keep adding references and building the project until only the errors that exist because of missing .DESIGNER.CS or .DESIGNER.VB files.
- Afterwards, go to the "web application" root project node in VS 2008 solution explorer, and right click it, then you WILL find the option "Convert to web application". What this option does is actually making small changes to the "@Page" and "@Control" directives of pages and controls, and creating the required .DESIGNER.CS or .DESIGNER.VB files.
- Try building the "web application" again. If you get errors, see what references may be missing and/or go click the "Convert to web application" again. Sometimes, if there's any error other than those caused of missing DESIGNER files, not all the pages/controls will have those DESIGNER files created for them. Fixing the non DESIGNER problem and clicking "Convert to web application" again should do the job for this.
- Once you are done successful VS build, you should be ready to go. Start testing your web application. Optionally, you can right click the "web application" root project node in VS 2008 Solution Explorer and click "Properties" then go to the tab "Web" to set the "web application" to a virtual folder in IIS (you can create new virtual directory from there in VS). If you want to use the IIS virtual directory that the old "website" used, you need to remove that from IIS first.
- Update: When testing your pages, pay MOST ATTENTION to classes in "App_Code" folder, especially those with NO NAMESPACE. Those can be a big trap. We had a problem with two extension method overloads in the same static class that had no namespace,one extends DateTime? (Nullable<DateTime>) and calls another overload that extends DateTime itself. Calling the other overload as extension method passed VS 2008 compilation and gave us a compilation error ONLY IN RUNTIME (With IIS). Changing the call to the other overload from calling it as extension method to calling it as normal static method (only changing the call in the same class, calls from other classes remained extension method calls) did solve this one, but clearly, it's not as safe as it used to be in VS 2005. Especially with classes with no namespaces.
- Update2: During the conversion, VS 2008 renames your "App_Code" to "Old_App_Code". This new name sounds ugly, but DO NOT RENAME IT BACK. In the "web application" model, all code will be in one assembly. In runtime, the web server does not know what web project type you are using. It does take all code in "App_Code" folder and create a new assembly for it. This way, if you have code in folder named "App_Code", you'll end up with RUNTIME compilation errors that the same types exist in two assemblies, the one created by VS, and the one created by IIS / ASP.NET Development Server. To avoid that. leave the "Old_App_Code" with the same name, or rename it to ANYTHING EXCEPT: "App_Code". Do not place any code in such "App_Code" folder and prefereably do NOT have a folder with such name in your "web application" at all.
I know this since before but forgot it now as I have not used "website" model for long :(.
I hope this helps anyone to avoid my embarrassment, and still get rid of the weird errors of "website" model :).
Cross posted from weblogs.asp.net/meligy
Saturday, July 26, 2008

Introduction
In Egyptian Developers Conference (EDC) 2008 this April, my geek network noticed a very nice, cute, and sweet little girl with me that I was very proud to introduce not just as one of the cleverest developers in SilverKey, but also as my life mate, my fiancée. Not sure if any of you noticed that by then, although being engaged, we were not wearing rings, yet!
Well, WE DID FEW HOURS AGO! Yes, I now wear a ring with Mona's name on it. What a pleasure that is? To understand, you just need to meet her once. I'll try to give a VERY limited summary of it.
Getting deep into the picture
Mona is a solid geek who just "gets it" when it comes to C# 3.0, jQuery or ASP.NET MVC and all this patterns stuff. That's easy to guess about my fiancée and is very true about Mona. However, this is a VERY MINOR great thing about her, and didn't get much of my attention because it is one of near infinity (at least I'm discovering new great thing every other situation/talk). Besides being so smart and having this great look that makes you feel so calm and comfortable when seeing her, she also has a TRUE pure soul that accepts no harm to anybody on earth and perfectly matches her soft but not easily to be broken nature. Somehow, she merges all this with such a cool nature with a great sense of humor, all this with a very admirable respect to herself being a moderate Muslim.
She has an impossible combination of great talents, skills and natures that I only mentioned the very basic ones of. You can add to that impressing wisdom, talk about a hundred type of kindness, or go talk about the sweetness that shows in every movement or word that comes out of her. I'd dedicate a series of blog posts to talk about each of her greatness as I "mentally" measure them vs. tons of other people I met in my life, counting males and females of all ages, starting at age 8 and above (say in cuteness/sweetness, …) going through 20s to 40s (say in beauty and humor, …) to 50s and counting (say in kindness and wisdom, …). This got me to a conclusion that such person is very rare to happen to exist in the entire world not just in my life.
The Big Pre-Event
So, now that such a rare existing person accepted to spend the rest of her life with such a normal guy whose only good thing is being just another geek of thousands around the world and in Egypt, that is something that makes me so proud.
Having the symbol of it in her hand having my name on it is a true charm that will help me wait the months it takes till we are married and living in the same house. Another wonderful thing is that I now "wear her name" in my hand represented by the ring that has just few hours ago got into my right hand and will hopefully soon move to the left one.
Thank you very much, Mona, for showing yourself in my life. Thank you way more for accepting sharing your valuable life with me. This is the favor of my entire lifetime. I know I cannot reward you for it whatever I do, so, all promise is to still try my best.
I love you, my little sweet cute smart girl.
Thanks again.
Cross posted from weblogs.asp.net/meligy
Monday, July 07, 2008
I found this great article that tells you how to do testing for WCF services exposed as web services, especially REST services (like the ones we create in my company for the project I work on now). What’s the problem ? Typically, for HTTP GET services, you can just put a URL that matches the URI template of the service (the template of the URLs that call the service) in the browser, and simply see what comes back in the browser itself However, when you want to test a service with other HTTP verbs than GET (Say POST, PUT), you need a console that creates the HTTP request with headers and request body and such, because a browser normally has no way of making you create a new customized request (because it creates them for you and encapsulates the entire process of request/response). Usually you write that console on your own. We wrote one for the current project but it didn’t serve all our needs. The solution There’s a program called “Fiddler” (Microsoft Freeware). This program works as proxy server that allows you to intercept and inspect requests and responses for all the web calls you do from your machine. This is very useful but as Firefox extensions do this for us, I haven’t personally installed it for a while. However, Fiddler has a great feature called “Request Builder”. This is where you can construct your request with all parameters and such and change any part of it (headers, body, raw request) and see the response in multiple views (Raw, Text XML, …). You can put the URL of your service in it, choose (or type) the HTTP verb and HTTP protocol version (by default 1.1) it uses, and then check the result to see whether it is what you expect or what. Notes on usage - With Vista or IPv6 supported OS, this fails sometimes especially when your service is hosted with ASP.NET development server (that’s included in Visual Studio). To fix that in Fiddler, go to Tools->Fiddler Options and then uncheck “Enable IPv6 (If available)”.
- This is how Fiddler looks like in sample test
Note that: - The part to the left is the previous HTTP connections. You can fill the request builder parameter by dragging any of them.
- The “Content-Length” header is filled with the right value automatically for you by Fiddler itself.
- An important part to enter in your requests is the “Content-Type”. Many services would behave differently according to that. For an XML web service, that’s typically a new line with “Content-Type: application/xml” in it.
- Fiddler configures itself as proxy for IE automatically. Firefox by default does not use a proxy server. To make Firefox it use Fiddler, from Firefox go to Tools->Options, then the “Advanced” tab, then “Network” sub-tab, then in the part “Connection” click “Settings”. Then
- Click “Manual proxy configuration”
- Enter 127.0.0.1 in “HTTP Proxy” (and “SSL Proxy” if you want this for HTTPS) and then “8888” (default port for fiddler, can be changed from it) in the “Port”.
- Clear the “No Proxy for” textbox to be able to test URLs on “localhost”.
You can alternatively keep it and use http://MachineName instead of http://localhost when testing.
 The One Resource for This This is coming from a great article that talks about the topic (but not with all the notes). The article also shows a VERY NICE example of creating a REST web services WCF project to be hosted in IIS. Go read it right away. Technorati Tags: WCF, REST, RESTful services, Fiddler, POST, HTTP Verbs, webservices, WCF service, WCF services, Firefox, testing
Cross posted from weblogs.asp.net/meligy
Sunday, July 06, 2008
I discovered just now that this blog post was not correctly cross posted from my new weblog to this one.
Trying to copy it manually also does not work (tried in Firefox 3 as well as IE 7). It looks like a timeout or something (warning: yes, it is a big post).
Anyway, if you are interested in my coverage of SOA Anti Patterns session in dotNETwork 5th gathering, you can find it here:
dotNETwork 5th Gathering – Really enjoyed that Silverlight & SOA Anti Patterns Mix (Part II / II)
In my company, we agree on certain subject macros for articles, news and similar non work related messages. Each of us creates his own Outlook 2007 Rules to move those to specialized folders. The drawback of this is that new messages that get moved to other folders than Inbox do not have the desktop alert:  You do not know whether you got a new message or not. This might be OK for messages flagged [fun], but as I have been in the company for long, I used to have folders for each of my complete projects messages in case I get a maintenance message or so. The project I work on right now has its own mailing list, so, I move its messages to a dedicated folder. I cannot afford missing instant note of an email in the project I work actively on right now!! If you face a similar situation, it has an easy fix to get the desktop alerts for all the messages you need it for. Actually it’s no more than creating another Outlook folder :). Let’s see how easy it can go: Start by going to Tools-> Rules and Alerts …  Then click “New Rule…”  Make your selection as below and click “Next”  See if you need to apply this to only certain messages, typically just click “Next” You may get a confirmation message. Just click “Yes”.  The last step is to select “Display Desktop Alert” and click “Finish” and "OK" to next messages.  Hope this helps anybody in similar situation.
Cross posted from weblogs.asp.net/meligy
I’ve have just sent this email to the developers exchange group in my company: I think you all know the routing engine that works with ASP.NET MVC framework to enable customizing URLs and mapping those to the corresponding controls, actions and their parameters. Some of you may know too that the routing engine is not just for ASP.NET MVC, but ASP.NET in general. If you happened to download the source code of the ASP.NET MVC framework (any preview), you’d have noticed that the routing comes as DLL not in source code format like other parts of the ASP.NET MVC framework. I have found an interesting series of articles going through the routing assembly that I thought you might be interested in: I found them at: http://msmvps.com/blogs/luisabreu/archive/2008/07/04/the-routing-series.aspx Regards, Mohamed A. Meligy SilverKey Technologies - Egypt Senior Software Engineer Hope that helps somebody. I feel shamed for not writing genuine articles for long. This is to come soon (God Willing). Maybe in two weeks or hopefully less. Technorati Tags: ASP.NET, ASP.NET MVC, aspnet, aspnet mvc, aspnetmvc, routing, routing engine, url rewriting, asp.net routing, asp.net routing engine, link list
Cross posted from weblogs.asp.net/meligy
Saturday, July 05, 2008
“Foundations of Programming, Building Better Software” is a new eBook by Karl Seguin. The book does not say in its introduction that it’s all ALT.NET-ish, it starts by introducing what ALT.NET is, it's goals etc, afterwards, all the topics the book covers are inspired by ALT>NET frequent topics. This includes Domain Driven Design (DDD), Dependency Injection (DI), Object Relational Mapping (ORMs), Mocking, etc… Here’s what Channel9 had to say about it (which is how I originally found it too): Karl Seguin recently released a great free 79 page eBook for .NET developers covering design patterns, unit testing, mock objects, memory management, object relational mapping, and more. Get it while it's free! No |