Visualizing C# .NET in a Grid Environment

Download Report

Transcript Visualizing C# .NET in a Grid Environment

Visualizing C# .NET in a Grid
Environment
Getting young girls interested in
Computer Science and other
mathematical based fields
Melea Lann Williams
University of North Carolina Wilmington
Table of Contents
• Background Info
• “The Real World” … Incorporating
Internships into the learning environment
• Master’s Thesis … “The Doll Idea” …
getting young girls interested
• Beginning C# … Code and Samples
• WPF … Windows Presentation
Foundation
• .NET
Background Information
Mayan Math
• Three symbols
Shell = “Complete” or “zero”
Stick = 5
Bean = 1
Mayan Math Example
20 2
(400) * 2
800
20 1
(20) * 15
300
20 0
(1) * 8
8
Total:
1108
Internships
“Life in the Real World”
Reasons to do an Internship
• Applying general computer science
concepts, learned in classroom, in the real
world.
• Gain experience
Experience = better pay
• Get ideas for masters thesis
More exposure = better ideas
• Learn what type of work environment suits
your needs and personality type.
Things Learned
• C#, Visual Basic, Team Foundation Server
• Documentation Procedures … which is a
lot, for the Nuclear Industry.
• Help File System Implementation
• Software Testing Implementation
• Learn / re-learn Chemistry Concepts and
Nuclear Engineering Concepts
Thank God for VPN!
The “Baby Doll” Idea
Getting young girls interested in
Computer Science and other
related fields.
Current Problem
• Most current dolls have everything already
done.
• Most other programming related toys do
not include the younger girl audience.
– Including more familiar role playing games.
• Most current toys for younger girls do not
include many building concepts
• More needed research about women in
Computer Engineering
Solution
• Build a physical doll that interfaces with a
computer through USB port.
• The doll will be able to imitate human
behavior
• The gui interface will be designed with the
intention of “ease of use” for girls between
the ages of 5 – 11.
• Multiple dolls will be able to interact with
each other through grid computing
Problems In Solution
• Security issues --- three to four levels of
security issues
• It takes a ton of motors and controls to
simulate human behavior.
• The weight of the doll.
• Child choosing what the doll would look
like.
• The amount of modeling work involved.
Solutions to Problems
•
Scale down the scope.
– Doll doesn’t have to completely mimic
human behavior, instead, choose just a few
things.
– In order to save modeling time, and for the
actual doll to match what is seen on the
screen, versatility of how the doll looks will
have to be scratched.
– Grid Security limits and boundaries.
How to Implement
• At first, I had decided to use NXT robots to
do the initial making of the doll … this part
has been scratched for now.
• Gather more data on women currently in
the industry through polling and
questionnaires, etc.
• Use proprietary software (Microsoft) to
eliminate possible integration problems.
How to implement (con.)
• Use NGrid as a way to interface between
.NET and grid environment.
• C# will be used for the code.
C#
Background, Code, and Examples
Why C#?
• Since Java was developed first, C# has
had the advantage to capitalize upon the
weaknesses of Java.
• The ability to easily incorporate .NET
components and convert to web services.
• Works very well with XML
• Ability to reference many different
programs of multiple file formats.
So, why not Java?
•
•
•
•
The differences:
C# allows restricted use of pointers.
C# permits low-level access to machine
resources.
C# allows for user defined value types by
using keyword “struct”.
Primitive types can define methods without
separate wrapper class.
So, why not Java? (con.)
Ex: Integer.toString(100); //java
100.ToString();// C#
• C# arrays correspond to an object in the
Array class, whereas, in Java, each array
corresponds to a direct subclass of the
object class.
• C# supports both true multidimensional
arrays, along with jagged arrays. (example
next slide)
Multi-Dimensional Array
Example:
int[,] myArray = new int[4,2]; // makes an
array of 4 rows, 2 columns
Three dimensional array example:
int[,,] myArray = new int [4,2,3];
• Downside --- even though this has it’s
benefits, it can get confusing…
sometimes, it’s easier to use jagged
arrays.
So, why not Java?
• C# allows for partial classes. Partial
classes means that the class definition can
be split across multiple source files. (there
is nothing like this in Java, and can be
confusing)
(example on next 3 slides)
So, why not Java? (con.)
using System;
partial class XY
{
int x;
public int X {
get { return x; }
set { x = value; }
}
}
So, why not Java?
partial class XY
{
int y;
public int Y {
get { return y; }
set { y = value; }
}
}
So, why not Java?
class MainClass
{
public static void Main() {
XY xy = new XY();
Console.WriteLine(xy.X + "," + xy.Y);
}
}
Orthogonal or not?
There are 503 pages in Word format of
language specifications!
• It is orthogonal in nature … just extremely
complex.
• On a good note … tons of tutorials on the
internet.
Screenshot Hello World
Source Code Hello World
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TextHello
{
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello World");
}
}
}
Output Hello World
Windows Presentation Foundation
• Graphical subsystem used within .NET
applications
• Uses XAML mark-up language (Microsoft
version of XML)
• Provides a consistent programming model
by separating the user interface and the
business logic (supposedly)
WPF Hello XAML
<Window x:Class="WPFHello.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Hello" Height="130" Width="297" Loaded="Window_Loaded">
<Grid>
<Label Height="28" Margin="13,12,126,0" Name="label1"
VerticalAlignment="Top" FontSize="12">Please enter your
name:</Label>
<TextBox Height="28" Margin="22,36,115,0" Name="userName"
VerticalAlignment="Top" />
<Button Height="28" HorizontalAlignment="Right"
Margin="0,36,23,0" Name="ok" VerticalAlignment="Top" Width="57"
Click="ok_Click">OK</Button>
</Grid>
</Window>
C# code for WPF Hello
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WPFHello
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void Window_Loaded(object sender,
RoutedEventArgs e)
{
}
private void ok_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hello " + userName.Text);
}
}
}
Conclusion
• Why is it important to learn Microsoft
products / C#? … because large U.S.
based business uses Microsoft.
• There are many similarities between C#
and Java syntax wise, however, there is a
large difference between the structure and
functionality of the language.
References
• http://en.wikipedia.org/wiki/Comparison_of
_C_Sharp_and_Java#Generics
• http://www.java2s.com/Tutorial/CSharp/01
40__Class/0580__Partial-Class.htm
• http://msdn.microsoft.com/enus/library/ms173156.aspx
• Microsoft Visual C# 2008 Step by Step
John Sharp