Description |
C# Overview
Read this
paper first, and answer the following questions:
- Explain features which make C# a better solution than Java for writing performance-intensive software. Explain the work-arounds in Java for those features.
- For each of the following sections in the paper: polymorphism, interfaces, versioning, enums - give an example of a possible mistake a programmer can make in Java, but can’t make in C# thanks to the way that feature was designed there.
- Some of the features that C# has and Java 1.4 didn't have been added to Java in JDK
5.0. Some other features that Java has and C# didn’t have been added to C# in Visual Studio.NET 2005. What are these features for each language? See:
http://java.sun.com/developer/technicalArticles/releases/j2se15/ and
http://msdn.microsoft.com/vcsharp/default.aspx?pull=/msdnmag/issues/04/05/c20/default.aspx
Serialization
Read this
paper and this one,
and answer the following questions:
- What are the design considerations for declaring a class as
implementing
Serializable ,
Externalizable , or none of them? Give an example
for each case.
- Is object serialization "shallow" - copies only the value fields
of a given object - or "deep" - copies references objects recursively as
well? How would you write a class that serializes and de-serializes itself
using the behavior that is not the default one?
- Compare the Java object serialization and with the C# one, as described in these articles.
In your answer address the issues of ease of use, efficiency (or overhead) and customization of the
serialization.
The
Java Serialization Specification is also recommended reading, although not
required for this exercise. In particular, it covers the subjects of versioning,
the stream protocol and security in more detail. It's shorter and easier to read
than most formal specifications, so give it a try :-)
Annotations and Custom Attributes
Read this paper
about custom attributes in C# and
this summary about Java Annotations , and answer the following questions:
- For each of the four presented uses of custom attributes in C# - user
attributes, runtime attributes, compile-time attributes and Extensible C# -
explain how the same problem would be solved if the language didn't support
annotations, and what is the advantage of using annotations to solve the
problem.
- Write a Java annotation class to define the attribute @Transient, which can
be applied to a data field in a class, similar to the Java keyword transient
(here's an explanation about it).
Write a method which receives any Java Object, and using Reflection sets
all its @Transient fields to their default values (null for references, false
for booleans and zero for all numeric types).
|