Your Ad Here
Oct 30

As some of you may have already heard, Enterprise Library 4.1 was released by the Patterns & Practices group at Microsoft. I used to implement application blocks from Enterprise Library’s previous versions in my previous projects. So I decided to take a quick look for personal update.

Installing this version of Enterprise Library is much better than previous installations, as this one gives you the choice to extract AND build the different application blocks at the same time, instead of using a different installer to extract and build the source codes.  The change log for this release is available here (highly recommended to read).  If you’re looking to upgrade your skills with Enterprise Library, I strongly suggest the Hands On Labs and the Getting Started tutorials for each of the application blocks. 

For more information about Enterprise Library (resources, tutorials, news, etc.) I strongly recommend you referring to these sites:
Pieter's Blog on Enterprise Development
Tom Hollander's blog
Patterns And Practices Guidance

Oct 16

Do you have questions regarding Windows Mobile application development that you need answers to?

Spend an hour with Microsoft employees and MVPs who are experts in Windows Mobile application development.

Join us for a live chat and bring on the questions!

This chat will cover your questions about the tools and technologies used to develop both native and managed applications using the Windows Mobile operating system.

Find our Events on the MSDN Chat calendar here: http://msdn.microsoft.com/en-us/chats/default.aspx

Sep 26

For the software, itself, it is easier to discuss its quality by measuring its performance, memory usage, number of the bugs etc. But what if we talk about the code file, how can we write code that we are proud of.

  • Clarity
  • Number of Lines
  • Performance
  • Comments
  • Exception Management

 

And many other topics can be added to this list for code quality measurement. But we will focus on these five now.


Clarity

Probably you have seen a really “smart” code like the one below:

   1:    public static int GetNextSize(int i)
   2:    {
   3:      //multiply it by four and make sure it is positive
   4:      return i > 0 ? i << 2 : ~(i << 2) + 1;
   5:    }


At least we have a comment line; well we will discuss the comments later on. But as you see you should really focus and evaluate the code before understanding what it is doing. So hiding the code in this way, especially if you work in a team, will create big headaches for your team members and after a while, for you, too. Code should always be clear and transparent for everyone just like the one below.

 

   1:    public static int GetNextSize(int i)
   2:    {
   3:      return Math.Abs(i * 4);  
   4:    }

Steve McConnell : "Good code is its own best documentation."
 

Number of Lines 

Some developers are proud of their big number of code lines. Because this is a proof to show how big the project is. But in the other hand, this is not true. Because more lines of code means more complex, harder to maintain code base or even worse; a sing to the wrong implementation of object orientation or code reuse.  

If you consider two software which function the same, the well structured one has always the less lines of code. The one has less lines of code is easier to maintain and fix the bugs. Which means the lighter is the better. Let me quote Bill Gates: “Measuring programming progress by lines of code is like measuring aircraft building progress by weight“. 

Performance  

Of course a fast functioning program is better than its slow versions and the performance considerations are always in the front lines of the development process. But changing a clearly readable code to its complicated and fast equivalent lines is not always the brilliant idea and there is always a way to implement the same algorithm in a clearer way.  

Well, I don’t mean don’t think about performance optimization but there is always bigger chance in the overall system to optimize. It is more important to focus on the big picture and solve performance problems that are system wide, or refactor code so that changes can be made much faster, than it is to solve a performance problem in a single line of code...unless of course that line of code is being called millions times. 

Comments 

Again I am pretty sure you have seen so many uncommented or not enough commented codes. Even code, itself, is readable or not, comments are important substances. You should always keep in mind to write clear comments like telling it to someone else. Don’t type them in your way but in a common language. 

Exception Management 

Although we are just focusing on the code quality (not the architecture or the software quality) still we need to discuss the exception management. Any unexpected situation can cause the exceptions. Normally the newly started developers go to the solution directly but prefer not to think about any abnormal situation can occur in their solution. So any missing control or a direct assumption can cause a crash in your application.  

In the worst case (probably the simplest) you can catch any exception on Application Domain level and show a common error message screen. But in any case, you shouldn’t let your software crash!  

As you already figured it out, it is not really easy to balance and find the most correct way of coding. If you don’t like the code you’ve written take a step back, review it, fix it, refactor it till you are proud of. Fixing the problems in early stage will have massive returns in the long term.  Searching for the perfect coding will lead you to a better understanding of what you are doing.  

And one more quote from Martin Fowler : “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
 

credits goes to CodeThinked

kick it on DotNetKicks.com
 
Tags:
Aug 08

Microsoft has announced a free tool for Windows Mobile programmers that can take stock of what resources applications are using. The "Windows Mobile API Usage Tool" performs static analysis of selected binaries, then reports on their usage of APIs (application programming interfaces) and other resources, the company says.

As a new posting on Microsoft's Windows Mobile Team blog notes, some APIs in Windows Mobile have been deprecated and may not be present in future versions of the operating system. Therefore, it's important to be aware of all the APIs an application is using.

The Windows Mobile API Usage Tool is designed to run on desktop computers running Windows Vista or XP, and requires Visual Studio 2005 or 2008. It is a command-line utility that allows selecting either a Windows Mobile application (in .CAB or .MSI format), or a directory containing multiple applications, as input. It will examine the selected code, then create a report listing its system dependences, optionally including any deprecated APIs, says Microsoft.

The tool saves its output in a SQL Compact Edition database (.SDF) file, and is said to be capable of creating a collection of useful reports. The Windows Mobile Team is encouraging developers to examine their applications with the tool, then send in copies of its reports to the company. This will aid in planning the future evolution of Windows Mobile, according to Microsoft.

To read the Windows Mobile Team's posting about the Windows Mobile API Usage Tool, see its blog, here. To obtain further background and download the tool, go to the Microsoft website, here.

kick it on DotNetKicks.com
Aug 07

As most of you know, a very nice series is going on dev102.com site for a while. Instead I was following the questions; I couldn't find any time to answer them till now. Here is this week's question “Point In Polygon” and below is my answer.  

   1:  //Solution : assume we draw a line parralel to x-axis. on CheckPoints y value, 
   2:  //from left side of the polygon to the point. 
   3:  //we need to count number of the borders intersects with this new line.
   4:  //if the number of intersections is odd, the point is inside
   5:  //if even then it is outside.
   6:  Point p1, p2;
   7:  int IntersectionCount = 0;
   8:  for (int i = 1; i < Polygon.Count; i++)
   9:  {
  10:      p1 = Polygon[i - 1];
  11:      p2 = Polygon[i];
  12:      //Check to draw the line from -infinity to the CheckPoint.
  13:      if ((p1.x < CheckPoint.x) && (p2.x < CheckPoint.x))
  14:      {
  15:          //Check if any intersection
  16:          if ((p1.y <= CheckPoint.y) && (p2.y >= CheckPoint.y))
  17:  IntersectionCount++;
  18:          if ((p1.y >= CheckPoint.y) && (p2.y <= CheckPoint.y))
  19:  IntersectionCount++;
  20:      }
  21:  }
  22:  if (IntersectionCount % 2 == 0)
  23:      Console.WriteLine("Outside");
  24:  else
  25:      Console.WriteLine("Inside");

Download the source. Program.cs (2.04 kb)

Tags:
Aug 06

As you see on the right side I’ve many widgets and planning to add some more. But I think having so many widgets, especially if they are tall, is not visually so nice and effective. I searched for anyone who had the same problem and found Chris’s blog and his a brilliant solution,  Collapsible Widgets”.

The idea is really nice but on the other hand, setting the display style directly to none or block causes sharp and graceless transition. Hence there are many js codes for animated div transitions; I decided to go for another solution to collapse/expand the widgets with animation. After a quick search I found a handy animation on DynamicDrive.

The rest of work is just to place these js files correctly into BlogEngine and configure it. To do this, fist; add these two js files into js folder (create a new folder named as js in the webroot ) in your webapplication’s root.


Then we need to add these js files into the generated pages on runtime. BlogEngine has a nice page structure and so easy to add js files with the
AddJavaScriptInclude function in BlogEngine.Core/ Web /Controls/ BlogBasePage.cs file. Add the following lines to the BlogBasePage.cs in line 89.

 

   1:  //add JS files for animatedPanel
   2:  AddJavaScriptInclude(Utils.RelativeWebRoot + "js/jquery-1.2.2.pack.js");
   3:  AddJavaScriptInclude(Utils.RelativeWebRoot + "js/animatedcollapse.js");
   4:   
   5:  //and the original code goes on
   6:  AddJavaScriptInclude(Utils.RelativeWebRoot + "blog.js");
   7:  if (User.IsInRole(BlogSettings.Instance.AdministratorRole))


Then, we need to configure widgets to toggle theirselfs to collapse/expand. Editing App_Code/ Controls/ WidgetBase.cs as following will be enough to complate our changes.

 

   1:  if (ShowTitle)
   2:     //Change the title text to an active link to toggle collapse/expand toggle
   3:     sb.Append("<a href=\"javascript:animatedcollapse.toggle('widgetContent" + WidgetID + "')\"><h4>" + Title + "</h4></a>");
   4:          
   5:     //old title
   6:     //sb.Append("<h4>" + Title + "</h4>");
   7:  else
   8:     sb.Append("<br />");
   9:   
  10:     //Change the contentDiv and give the id starts with widgetContent
  11:     sb.Append("<div  id=\"widgetContent" + WidgetID + "\" class=\"content\">");
  12:   
  13:  writer.Write(sb.ToString());
  14:  base.Render(writer);
  15:  writer.Write("</div>");
  16:  writer.Write("</div>");
  17:   
  18:  //Initialize animatedcollapsepanel for widget.
  19:  writer.Write("<script type=\"text/javascript\"> animatedcollapse.addDiv('widgetContent" + WidgetID + "', 'fade=1'); animatedcollapse.init();</script>");


That’s all, you can see the result on my widgets by clicking their titles.

I think having smooth UI transitions and animated stuff in your webpage is not bad :)


Download the codes
: AnimatedWidgets-BlogEngine.NET.rar (21.97 kb) 

kick it on DotNetKicks.com
 

Aug 05
A while ago I was working on Web Parts and their personalization futures so I worked with custom editors and editor zone. As you know, editor zone is displayed at a fixed location. But for users it is really handy to have editor zone on top of the each corresponding webpart, please check your igoogle page and try to edit one of the widgets. You will see what I mean.  

So at the beginning I searched for injecting editor zone into webpart. But after really complicated and dirty code, it didn’t work efficient. Later on I made a little investigation on rendered HTML page with IE Developer Toolbar. I found out that every webpart has a table identified as “WebPart_” + WebPartID. So if we have an HTML table than it is a piece of cake to inject a div (editor zone) into it with javascript.  

Here is the javascript that positions the editor zone on the selected webpart.

<script language="javascript" type="text/javascript">
          function PositionEditor(part) {
                if (document.getElementById('EditorZone2') != null) {
                       
var tr = document.getElementById('WebPart_' + part).insertRow(1);
                        var td = tr.insertCell();
                        td.appendChild(document.getElementById(
'EditorZone2'));
                      }
          }
</script> 
 

And for sure, we need to register that function call on the page render as fallows: 

protected void Page_Prerender(object sender, EventArgs e)
{
    
if (WebPartManager1.SelectedWebPart != null)
            
ScriptManager.RegisterStartupScript(this, typeof(Page), Guid.NewGuid().ToString(), "PositionEditor('" + WebPartManager1.SelectedWebPart.ID + "');", true);
}


That’s it.


kick it on DotNetKicks.com
Tags: | |
Apr 02

OpenXML artık bir ISO standardı . 87 Üye Ülkenin katılımıyla gerçekleşen standartlaşma süreci bugün itibarıyla nihayete erdi ve Open XML açık dosya saklama standardı olarak ISO tarafından onaylandı. Open XML 87 Ülkenin %86'sı gibi büyük bir çoğunluğunun desteğini aldı.

ECMA'nın konuyla ilgili açıklamasına http://www.ecma-international.org/news/TC45_current_work/ISO_and_IEC_approve_Office_Open_XML.htm linkinden erişebilirsiniz.

Microsoft'un basın duyurusuysa http://www.microsoft.com/presspass/press/2008/apr08/04-01OpenXMLVotePR.mspx linkinde yer almakta.

Tags:
Mar 04

While Microsoft's Flash competitor Silverlight is still not available for Windows Mobile (except Microsoft internal Betas), Nokia today announced plans to make Microsoft Silverlight available for S60 on Symbian OS smartphones as well as for Series 40 devices and Nokia Internet tablets. Adding support for Silverlight will extend opportunities for developers to create rich, interactive applications that run on multiple platforms in a consistent and reliable way.
Silverlight is a cross-browser, cross-platform plug-in for delivering next-generation media experiences and rich interactive applications.

Silverlight is already powering thousands of applications around the world and organizations including Entertainment Tonight, the NBA and NBC Universal to deliver superior Web-based experiences to their customers. The arrangement with Nokia will substantially extend the reach of Silverlight by making the platform available for hundreds of millions of devices, including S60 on Symbian smartphones from a range of manufacturers, as well as Nokia Series 40 devices and Nokia Internet tablets.

Microsoft will demonstrate Silverlight on S60 during the opening keyote at Microsoft's MIX08 conference on March 5 in Las Vegas. Silverlight is intended to be available to S60 developers later this year with initial service delivery anticipated shortly thereafter for all S60 licensees. This will allow S60 application developers to use an even wider range of development environments for S60 on Symbian OS than today. Today S60 developers can use: C++ (using native Symbian OS APIs and Open C providing subset of standard POSIX libraries), S60 Web Run-time (supporting standards-based web technologies such as Ajax, JavaScript, CSS and HTML), the Java language, Flash Lite from Adobe, and Python.

Microsoft Silverlight availability for Nokia Series 40 devices and Nokia Internet tablets will be confirmed later. When will Microsoft announce Silverlight's Windows Mobile availability?

Jan 13

  Facebook has become a huge phenomenon in social networking. The site exposes a developer API to support Web and desktop applications. In this article you will explore making use of this functionality from a smart device application. The source code to accompany this article demonstrates working with key aspects of the Facebook API and tightly integrating with Microsoft® Windows Mobile®–specific APIs.

Jan 04

21.11.2005 tarihinde yazgelistir'e AJAX kullanarak Google Suggest Box tipi kontrollerin gelistirilmesi ile ilgili bir makale yazmistim. O zamanlar ancak ClientCallBack'ler ile islemlerimizi yapabiliyorduk. O gunlerden bu gune cok sey gelisti. Atlas'tan AJAX'a, yepyeni kontrollerimiz var artik.

Yine de, benim makaleme 
    http://www.yazgelistir.com/Makaleler/1000000796.ygpx  linkinden
yeni kontroller ve Ajax Tool Kit kullanilarak gelistirilen bir ornegine ve detayli makaleye de
    http://mattberseth.com/blog/2007/12/creating_a_google_suggest_styl.html
adresinden ulasabilirsiniz

Tags:
Jan 03

I developed projects with NHibernate in couple of years before and at that time I searched and read many articles on advantages or disadvantages of ORM or ADO.NET / Stored Procedures. There were so many technical discussions and comparisions between those technologies.

Later on when I started to study on LINQ I thought the performance and any comparisions between those three. But I hadn't got enough time to test. I have just found a guy, Maximilian Beller, has written two nice articles compare the performances and properties of those technologies.

Recommendation: NHibernate, Linq or ADO.NET?

Performance comparison between Linq, NHibernate and ADO.NET / Stored Procedures
Tags: |
Jan 02

VSTS has unit testing. Is NUnit obsolete? I saw that post in NUnit blog, really interesting. Read.!

Tags:
Jan 02

New vesion of NUnit has been relased. Get it now.!

Tags:
Dec 26

Tom Hollander started an interesteding thread on code generation. He points out challenge of customizing generated code, which comes up often because generated code is usually not exactly what you want. He also brings to light the trade-off between generator flexibility and complexity: the more flexible a code gen template is, the more complex and difficult to configure it becomes. Check out his post at:

http://blogs.msdn.com/tomholl/archive/2007/11/17/code-generators-can-t-live-with-them-can-t-live-without-them.aspx

The post includes some great comments too. Wojtek Kozaczynski posted some additional thoughts on the topic at:

http://blogs.msdn.com/wojtek/archive/2007/11/18/code-generators-when-can-you-live-with-them.aspx

 

Tags:
Dec 24

Team Foundation Power Tools for VS2008 is out. New in this Release:

• Find in Source Control tool is an addition to the Team Explorer menu that provides the ability to locate files and folders in source control by the item’s status or with a wildcard expression.

• Open a selected folder in Windows Explorer straight from Team Explorer. This feature allows you to jump straight to the mapped folder location from within Source Control Explorer.

• Quick Label feature that allows labels to be easily applied to a given selection of files and folders in the Source Control Explorer.

• Build Notification tool that runs in the Windows task bar notification area monitoring the status of the build definitions you have specified. It can be configured to show notifications when builds are queued, started, or completed for multiple build definitions spanning multiple Team Foundation Servers.

• Additional TFPT.EXE commands for configuring Team Explorer connection settings (tweakui) and for destroying Work Items and Work Items Type Definitions (destroyWI, destroyWITD).

• Updates to the TFS Best Practices Analyzer for use with a Visual Studio Team System 2008 Team Foundation Server deployment.

• The Process Template Editor is updated for use with Visual Studio Team System 2008 Team Foundation Server. It also has several improvements, including: the ability to launch standalone w/o a Visual Studio installation, performance improvements, improved discoverability and bug fixes.

• Bug fixes and removal of Power Tools that are now included within Team Foundation Server:

• Annotate and Treedif are now included in Visual Studio Team System 2008 Team Explorer; however, Annotate remains is still available in the command-line tool (TFPT.EXE).

• TestToolsTask is included in Visual Studio Team System 2008 Team Foundation Server as part of Team Foundation Build.

 

from Brian Harry's blog

Tags:
Dec 20

Parallel Extensions to the .NET Framework is a managed programming model for data parallelism, task parallelism, and coordination on parallel hardware unified by a common work scheduler. Parallel Extensions makes it easier for developers to write programs that scale to take advantage of parallel hardware by providing improved performance as the numbers of cores and processors increase without having to deal with many of the complexities of today’s concurrent programming models.

Microsoft Parallel Extensions to .NET Framework 3.5 is almost ready and CTP can be downloaded here

Tags:
Dec 17

There is a new site that focus on software factories, domain specific languages and Visual Studio Extensibility.

http://sf.devrevolution.com/

Tags:
Dec 14

A post on Microsoft's .NET Compact Framework (.NET CF) blog brings word of some interesting new tools for programmers. Included in a download called "Power Toys for .NET Compact Framework 3.5," they're intended to evaluate performance, obtain diagnostic information, and help with configuration, according to the company.

The six tools said to be included in the package are:

  • Remote Performance Monitor and GC Heap Viewer
  • NETCF CLR Profiler
  • App Configuration Tool (NetCFcfg.exe)
  • NETCF ServiceModel Metadata Tool
  • Remote Logging Configuration Tool
  • NETCF Network Log Viewer

According to information provided on the PowerToys download page, the Remote Performance Monitor and GC Heap Viewer provides real-time counter data (ranging from Garbage Collector activity to type loading info) on a running .NET CF application. The GC Heap Viewer feature allows you to capture the managed heap at any moment your app is running to view live references, and allows you to compare multiple snapshots to find memory leak issues.

The NETCF CLR Profiler is said to be an instrumenting allocation profiler for .NET CF applications. It provides detailed allocation visualizations, allocation callstacks visualizations and useful for diagnosing memory management issues.

The App Configuration Tool (NetCFcfg.exe) is described as an on-device tool for specifying what version of the .NET CF runtime an application will run against, displaying installed versions of .NET CF and displaying info about DLLs.

The NETCF ServiceModel Metadata Tool (netcfsvcutil.exe) allows creation of a Windows Communication Foundation (WCF) client proxy to help developers consume WCF services on device, according to Microsoft. Like svcutil.exe, which is the desktop version of the utility, netcfsvcutil.exe is a command-line tool that generates service model code from metadata documents, and generates metadata documents from service model code.

Finally, the Remote Logging Configuration Tool enables users to easily configure logging options on a .NET CF device, including loader, interop, network, error and finalizer logs. The NETCF Network Log Viewer is described as a utility for viewing .NET CF network log data.

To read or comment upon the .NET Compact Framework Team's post, go here. To go directly to the download of the Power Toys for .NET Compact Framework 3.5, go here.

Tags:
Dec 12

The preview version of ASP.NET 3.5 Extensions is released. The Extensions are a new set of tools and controls that will be added onto existing release of ASP.NET with .NET 3.5. This will make possible for web developers to get the latest updates on ASP.NET without having to wait 1-2 years more for the next release of .NET Framework.
It also includes ADO.NET Entity Framework Beta 3, which you can also download as a separate file here (you do not need to download it if you have ASP.NET 3.5 Extensions Preview installed already).


What’s in the Extensions Release?

ASP.NET MVC
ASP.NET MVC provides model-view-controller (MVC) support to the existing ASP.NET 3.5 runtime, which enables developers to more easily take advantage of this design pattern. Benefits include the ability to achieve and maintain a clear separation of concerns, as well as facilitate test driven development (TDD).

The ASP.NET MVC Toolkit provides HTML rendering helpers and dynamic data support for MVC.

ASP.NET Dynamic Data
ASP.NET Dynamic Data helps developers build a fully customizable, data-driven app quickly. It provides a rich scaffolding framework that allows rapid data driven development without writing code, yet it is easily extendible using the traditional ASP.NET programming model.

ASP.NET AJAX
New additions to ASP.NET AJAX include support for managing browser history (Back button support).

ADO.NET Entity Framework
ADO.NET Entity Framework is a new modeling framework that enables developers to define a conceptual model of a database schema that closely aligns to a real world view of the information. Benefits include easier to understand and easier to maintain application code that is shielded from underlying database schema changes.

ADO.NET Data Services
ADO.NET Data Services provide new services that find, manipulate and deliver data over the web using simple URIs. Benefits include an easy and flexible way to access data over the web, while enabling the separation of presentation and data access code.

Silverlight Controls for ASP.NET
You can integrate the rich behavior of Microsoft Silverlight into your Web application by using two new ASP.NET server controls: a MediaPlayer server control that enables easy integration of media sources such as audio (WMA) and video (WMV) into your Web application, and a Silverlight server control that allows an ASP.NET page to reference both XAML objects and their event handlers.

Tags:
Nov 30

Here is a very nice acticle from msdn on Service Factories.
The Web Service Software Factory: Modeling Edition (also known as the Service Factory) is an integrated collection of resources designed to help you quickly and consistently build Web services that adhere to well-known architecture and design patterns. These resources consist of patterns and architecture topics in the form of written guidance and models with code generation in the form of tools integrated with Visual Studio 2005.

check that link :  http://msdn2.microsoft.com/en-us/architecture/bb931187.aspx

 

Tags:
Sep 20

Mistakes are not always a bad thing. Making mistakes is a natural way to learn. However, the cost of such 'learning' in the development cycle can be pretty high. This is especially true for mobile applications, where a programmer battles against so many issues that desktop developers can't even remember any more.

There are a number of things that are most harmful for mobile developers to do. I present several of the most common troubles worth reviewing in this article. I start with strategic issues.

Different Platforms are Different

The very first and probably most important fact mobile developers must remember is that Windows CE operating system is by far not like its big brother the desktop operating system. They have common features and share common philosophy, but there is a big difference in development approaches used for each. This is due to different form factors, resources that are available, supported APIs and so forth. Regardless of whether you use C++, Visual Basic, Java or C#, you will be lucky if the same code will run on both the desktop and on a PDA in the same way. Thus if you're considering the porting of your existing desktop application to WinCE or considering the development of new applications, remember that the mobile operating system is not the same as a desktop operating system.

Operating Systems, Devices and Frameworks

In addition to knowing that mobile operating systems are different from desktop operating systems, you should also note that there are different mobile operating systems as well as different devices and frameworks. You need to properly plan for the device types and operating system you would like to target.

For example, if you have developed an applications for devices using Windows Mobile, then your application might not run good on PDAs with CE.NET inside. This lack of support could cut your target devices in half. Similarly, if your product uses specific features of a specific device, then there may be devices that can't support your application as well. For this reason, you should ask yourself if targeting specific device features is a right decision. Of course, if you are device vendor, such problems are out of scope! For application developer, however, generic code you produce as better for the whole project, i.e. you application will be able to run almost everywhere.

Another issue from the same family is the use of various frameworks, libraries and technologies. For example, the Pocket PC SDK contains MFC library but the Smartphone SDK does not. As such, if you want to target both Pocket PC Devices and Smartphone devices, then you need to think twice. Another example can be seen with ADO CE. In addition to many differences with desktop version, Microsoft has decided to discontinue its support in Windows Mobile 5.x. So be double careful there!

Application Structure

That is enough regarding issues with strategy, now consider the structure of a mobile application. There are at least two polar approaches: to make an application solid -- do you always have the one and only executable or do you divide your application into a main executable and number of DLLs?

Both structures have well-known pros and cons. I've seen many projects (very complicated and fat enough to be honest), which used COM objects and huge number of DLLs. I have to state here that such approach doesn't work well on Windows Mobile platform. One executable and few DLLs are ideal though. This is obviously true for desktop systems as well, but there you are in much more comfortable situation with resources. In case of Windows CE application performance will be reduced dramatically.

Another issue with DLLs on Windows CE is that if you store resources, (e.g. to support multiple languages in your application), it may cause significant problems because the application may switch resource handles at runtime. The resulting behavior may be quite unpredictable. Eugene Tilman and I have spent a number of sleepless nights trying to detect why a big application sporadically crashes on a device but works like a charm in desktop emulation. There are different methods for avoiding the need for many DLLs. For example, when implementing internationalization, you might 'translate' resources within the executable rather than keep them in a separate DLL. There are a number of references on the web describing similar techniques.

Application Configuration

How you configured your application is also important for avoiding mistakes. Again, there are many different ways to configure a mobile application, so we will not dig into specific mistakes. Rather, there are two possible configurations issues you should consider: Registry use and code reusability.

There are big desktop systems which use the Registry in much the same way as a database in that it is used to store hundreds (if not thousands) of parameters. For Windows Mobile application such tricks just won't work due for a very simple reason: mobile devices suffer from hard resets from time to time. If a hard reset occurs, you have a good chance that all data in the registry will be reset as well and thus lost. Regardless, maintenance of such configuration storage can be a real nightmare, although it can be done by purchasing additional tools such as Pocket Controller .

If your application needs a lot of parameters then consider suitable method to store them -- a method such as XML, binary files or something else.

One of the best things in development is code reusability. That's why we all create libraries, frameworks and so forth. This helps us to develop faster, better, ... (you can continue as much as you want to).

You have to be careful using such libraries. For example, the MFC framework can cause you problems when used incorrectly on mobile devices. No doubts, it helps a lot where you can utilize it; however, there many classes that are implemented for mobile usage with much less efficiency than in desktop version. This includes classes like CSocket and the WinInet stuff. Additionally, some functionality available through the API are unavailable for mobile usage. But this is not the worst trouble. Such problematic parts of the library are obviously subject to improve. Programmers simply do not use ineffective classes. Hence, Microsoft has decided to discontinue some of them in newest MFC version for Windows CE. For example, the WinInet classes are being discontinued. If you've the bad luck to have used them in your projects, then you will have to rewrite them. In rarer cases, some GUI classes may be dropped, but I believe it should be treated as an accident rather than common case.

I/O, Memory, Stack & Co.

Finally, there are programming issues that can be the cause of mistakes in mobile applications.

I/O operations are the very first point to talk about from a performance and device resources point of view. For desktop systems the normal receipt is simple: read by blocks rather than by bytes. For mobile applications it is not as straightforward. If data is stored on a flash card (SD, CF etc.), then access time may be painfully long. Suppose that data is kept in a flat files with no matter binary or text (like XML). It is a good thing if you can read it all in one shot to memory and then process as needed. In the case of huge amounts of data, however, this is simply impossible. In those cases, you have to allocate chunks here and there. It is a really bad thing that memory allocation strategies may vary from one version of an OS to next one. You can easily test on a Pocket PC 2002, 2003 and Windows Mobile 2003 SE. On Pocket PC 2002 you benefit from big allocations, but on later versions smaller chunks are allocated faster. With Windows CE 5.0 the situation changed once again, because there is no RAM anymore. Storage Cards are still there, but as you see, it might be a particular magic to choose the best method to reach the best I/O performance.

Not all PDAs are loaded with resources or have lots of resources available. This fact hits you first of all with the stack size that is available for applications. Many mobile applications uses Dialog-based architecture because it is simple. It is well-known that big allocations on the stack, e.g. BYTE arr[65536], are inapplicable because you have by default only a 64KB for stack. Less intuitive effects can occurs when you have a number of dialogs created on the stack and open simultaneously. It appears that critical number is balancing on the boundary of 3 to 4 dialogs only. If your program tries to pop up more, a Stack Overflow exception will be the best thing you can get. Usually it just crashes at some arbitrary place.

The last but not the least thing regarding programming mistakes is in exception handling. Earlier versions of Windows CE did not support exception handling extensively. Now the situation is quite different. Normal C/C++ handling is allowed, TRY and CATCH macros may be forgotten. Exception handling is extremely important for mobile applications, because an environment is less friendly than the desktop. Applying exception handling in the correct way will make your product much more robust, but don't be too excited with it, otherwise you can loose the performance.

In Conclusion...

You've now seen many of the biggest mistakes! I hope reviewing them will help you to avoid them and thus lead to better decisions in your own mobile applications. With mobile technology growing so rapidly, doing mobile development is getting better with every new operating system release. So who knows, maybe soon mobile programming will become as regular as desktop development.

Source : http://www.developer.com

Tags:
Aug 13

Bugunlerde biraz "coding for fun" arastirmalari yapiyorum. Windows Mobile 5.0 icin gercekten hosuma giden bir Channel 9 videosunu sizlerle paylasmak istiyorum. http://channel9.msdn.com/ShowPost.aspx?PostID=209787

Tags:
Jun 11

LINQ implementation on a completely different domain other than DB, XML or Web which is LINQ To Google desktop. Check here.!

Tags:
May 25

One of my best friends needed some help about componentware for his research. Here is the text that I wrote for him. Hope to be helpfull.

Do you know, what do the Volkswagen Golf, New Beetle and Audi TT have in common? They all share the same chassis. From the outside, they appear to be very different vehicles but the platforms are the same. Mass production demands standardized parts across the entire automobile industry. By standardizing production of components, they have been able to lower production costs and time. And often eliminate testing for many items that have already proved to be used in widespread. So, what may we learn from automobile industry?

In early ages of software develepment; firms wrote their own “Libraries” which were ready codes written in any languages. Later on, as object oriented languages became more popular, prewritten modules expanded to class-libraries. Class Libraries were generally written in C++. Modern component software is often language-independent. It is possible to build program in whatever language you have elected to use. COM, .NET DDL’s, Java and ActiveX technologies achive the purpose of components. Componentware is the name for these ready to use software modules. Componentware stands by being attractive to the widest number of developers. This requirement also ensures that prefabricated routines have the longest life span.

Here is some reasons why you should use components:

  • Production is simplified
  • Programs take less time to develop
  • Less to test
  • Their reliability is proven
  • They have higher quality than you may afford
  • They can be reused on a range of products
  • Costs can be spread across development
  • Development overheads are proportioately reduced

Componentware enables latecomers to assemble major sections of rival program with lightning speed. This gives the developers time to concentrate on the business logic of the project and make sure it works more reliable, has sweeter interfaces, etc. as the components in automobile industry.

Tags:
Software Blogs TopOfBlogs