1 / 30

Source Code Inspection and Software Reuse

Source Code Inspection and Software Reuse. Chapter 7 – Digging into source code Coder To Developer - Mike Gunderloy Respected Professor: Dr. James Fawcett Presented By: Ghanashyam N. Digging Into Source Code.

devon
Download Presentation

Source Code Inspection and Software Reuse

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Source Code Inspection andSoftware Reuse Chapter 7 – Digging into source code Coder To Developer - Mike Gunderloy Respected Professor: Dr. James Fawcett Presented By: Ghanashyam N

  2. Digging Into Source Code • Looking more deeply at available code can clarify several details that are not immediately evident regarding this code’s functioning • Code inspection helps us use existing code efficiently • Seeing how someone else solved a particular problem can be very helpful in producing more elegant and efficient code

  3. .NET Fundamentals • All .NET code is executed by the CLR • Each of the .NET language compilers (C#, VB .NET, Managed C++ etc.) convert source code into MSIL (and Metadata) • CLR understands only MSIL code and knows nothing about the .NET language that was used to generate this MSIL code

  4. .NET Code Is Open • There are several utilities (Ildasm, .NET Reflector etc.) that allow you to work on MSIL code directly • Thus it is possible to find out quite a bit about .NET code for a library or an application even if its source code is not available

  5. .NET Code Is Open • All the code for .NET FCL is present in the form of MSIL (and Metadata) on any machine that has .NET installed • Thus it is possible to look more closely at the implementation of the .NET FCL • Looking at code for the .NET FCL can prove extremely useful especially when the documentation for a certain FCL class or method is obscure

  6. Using Ildasm • The .NET Framework SDK comes with a tool named Ildasm that allows you to work directly with MSIL code • It displays MSIL code in a somewhat human readable format • Ildasm’s output cannot be easily deciphered even though it is much more readable than MSIL itself

  7. Using Ildasm • Ildasm • Start Menu ► Programs ► Microsoft Visual Studio .NET 2003 ► Visual Studio .NET Tools ► Visual Studio .NET 2003 Command Prompt • Type ‘ildasm’ on command prompt and press enter

  8. Using .NET Reflector • .NET Reflector is available at http://www.aisto.com/roeder/dotnet • It is much easier to use than Ildasm since it displays the source code that was used to generate a supplied .NET assembly • It also has many useful features like decompilation to either C# or VB .NET and display of call trees for any selected method

  9. Reflection | Obfuscation • MSIL, Metadata and Reflection make it possible to do a deep analysis of any .NET application or library, even without source code • Obfuscation aims at protecting intellectual property by taking source code and automatically changing it to make it difficult to understand • Obfuscators typically change class names, member names etc. in the source code to make it very difficult to decipher the assembly generated using this code

  10. Some Obfuscators • Demanor for .NET http://www.wiseowl.com/products/Products.aspx • Salamander http://www.remotesoft.com/salamander/obfuscator.html • Dotfuscator http://www.preemptive.com/dotfuscator/index.html • Species .NET http://www.9rays.net/cgi-bin/components.cgi

  11. Experimenting With Code • There are times when you need to actually run the code to gain a complete understanding of its functioning • But writing a complete VS .NET solution to test the behavior of a simple component is a lot of work

  12. Experimenting With Code • Snippet Compiler http://www.sliver.com/dotnet/SnippetCompiler/ • An IDE that allows you to write code to exercise some small piece of code with minimal overhead • Supports C# and VB .NET • Supports Winforms and ASP .NET • Modest set of features • Gets code up and running quickly

  13. Software Reuse • Try to avoid “reinventing the wheel” • Try and find code that you don’t have to write • There is an astonishing amount of free, high-quality, reusable code out there

  14. Software Reuse • Make full use of the .NET FCL • Code for most of the common programming tasks already exists in the FCL • Hashtables, queues etc. – System.Collections • Event log, performance counters – System.Diagnostics • WMI – System.Management • XML – System.XML • Sending SMTP mail – System.Web.Mail • Reqular Expressions – System.Text.RegularExpressions

  15. Software Reuse • Some Libraries • SQLXML Library http://www.msdn.microsoft.com/sqlxml/ Add-on XML functionality for Microsoft SQL Server 2003 • WSE (Web Services Enhancements) http://www.msdn.microsoft.com/webservices/building/wse/default.aspx Set of implementations of web services specifications such as WS-Security, WS-Routing, WS-Referral etc.

  16. Software Reuse • Some Libraries • Logidex .NET Library http://www.msdn.microsoft.com/sqlxml/ Add-in to VS .NET that lets you locate and download .NET patterns and sample code from within Visual Studio .NET

  17. Software Reuse • More sources of free code • The Code Project http://www.codeproject.com • GotDotNet User Samples http://www.gotdotnet.com/Community/UserSamples

  18. Evaluating Code • Using FxCop http://www.gotdotnet.com/team/fxcop • A code analysis tool that checks .NET managed code assemblies for conformance to the Microsoft .NET Framework Design Guidelines • Can check conformance for third party libraries as well as own classes

  19. Thank You

More Related