Re: [OT] Of Java and C#




"LX-i" <lxi0007@xxxxxxxxxxxx> wrote in message
news:3894e$45bbfa7f$454920f8$9297@xxxxxxxxxxxxxx
Pete Dashwood wrote:
Hi Daniel,

not sure if this is the Rogers Cadenhead book I recommended or not.. I
thought it was Java 2 in 24 hours... Whether it is or not, very pleased
to see you have found something that was of use and shared it with the
group.

Heh - well, he did both. The "Java 2 in 24 Hours" (according to Rogers)
is for people who come from a blank slate as far as software development
goes,

That's right, I remember now... I bought this book some years ago and
decided I wanted to approach Java as a complete newbie. I absolutely loved
the book and still think it is the best "Teach Yourself Programming" book I
have ever come across.


while the book I named is geared more towards folks who already
know programming to some extent. (That's what he said in Appendix A.) It
does seem to move at a pretty good clip, though - there have been sections
I've had to go back and read again, the do the example program, then go
back and read it yet again. However, that technique usually makes the
point apparent. :)

Here are the topics, by day, with the appendices...
Week 1 - The Java Language
- Day 1 - Getting Started with Java
- Day 2 - The ABCs of Programming
- Day 3 - Working with Objects
- Day 4 - Lists, Logic, and Loops
- Day 5 - Creating Classes and Methods
- Day 6 - Packages, Interfaces, and Other Class Features
- Day 7 - Threads, Exceptions, and Assertions
Week 2 - The Java Class Library
- Day 8 - Data Structures
- Day 9 - Working with Swing
- Day 10 - Building a Swing Interface
- Day 11 - Arranging Components on a User Interface
- Day 12 - Responding to User Input
- Day 13 - Using Color, Fonts, and Graphics
- Day 14 - Writing Java Applets and Java Web Start Applications
Week 3 - Java Programming
- Day 15 - Working with Input and Output
- Day 16 - Serializing and Examining Objects
- Day 17 - Communicating Across the Internet
- Day 18 - JavaSound
- Day 19 - Creating and Using JavaBeans
- Day 20 - Reading and Writing Data Using JDBC and XML
- Day 21 - Writing Java Servlets and Java Server Pages
Appendices
A - Choosing Java
B - Using the Java Development Kit
C - Programming with the Java Development Kit
D - Using the NetBeans Integrated Development Environment
E - Writing Java 1.1 Applets
F - Creating Web Services with XML-RPC
G - Regular Expressions
H - Where to Go From Here: Java Resources
I - The Book's Website

Excellent! Looks pretty comprehensive.

I have just received "C# in a Nutshell (second edition)" from O'Reilly. It's
the first book I've had on C# and is kind of a quick reference. There is a
CD in the back cover which plugs into the Visual Studio online help system
and gives you immediate access to everything in the book... :-) an
interesting trend in publishing, I think :-). Unfortunately, it only works
with VS 2003, and i am using VS 2005 :-) I have written to O'Reilly; watch
this space...

The latter is http://www.java21days.com - click on the "Fourth Edition"
link. The example classes and Java source files are there, if you want to
see the code he uses to teach these.

(BTW, threads are really, REALLY cool!)

Yes, I remember thinking that too...:-) I like the idea of "listener"s...:-)


Didn't realise you were getting into C#.

Well, I hadn't planned on it. At one point, I was responsible for our
home-brewed CM system, and am now the alternate programmer for it. The
lead guy is working on a .NET conversion, partly to get around the
limitations of the current ActiveX controls we currently use.

When programmers check in a source code file, there are several checks we
do to it, and cross-references that should be updated. The new .NET
check-in page was deployed last month, and has been the most troublesome
page in the system ever since. Within the system itself, there is the
capability to create a control number against the system, and there have
been a couple of formal bug reports.

Monday this past week was day 3, "Working with Objects". This was also
the day that I took it upon myself to begin writing the design for the
changes we would do to fix these problems. It came to me - a lot of these
processes need to do a line-by-line analysis of the code. Why not write
one object to do it all?

I think you are talking about a Class rather than an object...? It sometimes
helps to think in terms you are familiar with; in this context the Class is
like a COBOL program with each of the Methods being a nested program. The
Class ties them all together (as well as providing factory methods for
common processing).

(Of course, within the object there are many different methods, all but
one protected. As I mentioned in my last post, I'll post it here Monday
evening (unless otherwise prevented).)

I don't think it matters too much whether the terminology is right or even
whether you are sticking to OO principles here. At this stage, the idea is
to get experience and have a productive spin-off from the learning process
(that's how I approach it and I've already gone back and refined some stuff
I wrote a few weeks ago, before I acquired the knowledge I have now. The
nice thing is that it is easy in C# to amend stuff and shuffle Classes,
Methods, and Forms around.)

A major challenge I found was defining COBOL data structures in C#. I had
several goes at this and am happy with what I have now. The early attempts
worked, but were not elegant; I have something now that will allow me to
GENERATE these definitions in future. (I still have to write the generator
and that is on my TO DO list; meantime I can build them manually from the
templated approach I have developed. REDEFINES and OCCURS are somewhat
problematic... :-), the rest is pretty easy, once you grasp the underlying
concepts and learn how to create fixed length strings and hierarchically
structure them. Obviously, this is pretty essential if legacy is to be
invoked from C#. (BTW, you can't use the C# 'struct' for this because it is
a TypeValue structure and unmanged code requires TypeRef structures passed
to it... I wasted about a day and a half on that :-))


[snip]

MicroSoft, although much maligned :-), have invested huge money in
creating the DotNET framework and ensuring interoperability. This is a
major advance for application developers and MS deserve credit for it. (I
still can't believe they make this, and the IDE, available for
FREE...:-))

There are probably several entities you can thank for that - most of which
are responsible for the "much malign"ing of Microsoft...

[snip]

From now on, the error logs from all my applications will be purely for
system problems and the "Error Reports" will be Excel spreadsheets...

I am becoming more and more convinced that the difference in
productivity between COBOL and C# is largely down to the IDE and the vast
amount of information that is at your fingertips when using C#. I found
any number of articles, including sample code, when I searched on
accessing Excel from C#. And it is SO good to get sample code that is
actually in the language you are using, rather than having to translate
VB into COBOL :-) Having said that, I also like the simple elegance of
C#. It is a very good compromise between Java and C++ in my opinion.

Is this app is running on Windows proper or on a web server?

Initially on the desktop under Windows.Net Framework.

There are different implementations for people with different degrees of
computer literacy. The validation engine is the heart of it, but interfacing
it to existing systems is another major part of it. The desktop incarnation
is aimed at people who have no computer literacy and simply want a solution.
It will search their existing system data, find the address related data,
build a Dataset for it, and present each row of the dataset to the engine,
which will return the necessary changes, and these are then applied. The
interface is completely flexible and will work for any relational database
that is built with MySQL, MS Access, or SQL Server. (MYOB, DB2, and
Greentree are in the pipeline). The engine can accept completely free-format
addresses so it is not necessary to have fixed fields for street, city, etc.
This engine is written as a COM server in OO COBOL and it took me 3 months
to get it right (I seriously underestimated the difficulties in handling
free-format addresses...) It currently processes with over 90% accuracy and
this will be further improved in the coming week. (It is about tuning fuzzy
logic and making sure the Postal Database is accurate) The completely
flexible interface on the other hand is written in C# and took a couple of
weeks.

The next step is to wrap the engine as a Web Service and put it on a server.
I expect to have that working fully before the end of Feb, and was exploring
the vagaries of WSDL today :-)

So the people who can't be expected to extract their data or present it for
the engine are covered, and it goes on the first live site next week. (They
have over 5000 addresses and changing them manually would be a very
unpleasant and error prone task.)

Then there are the ones who write their own software (or at least are
capable of doing so). They don't want a full solution, they want a tool.
Providing access to the validation engine as a web service is a good
solution for them. They can run it from my server or their own. The ones who
write VBA macros can connect to the web service as a data source. There will
be some who will want the engine as a COM component and that is no problem
either. I have already tested it as a DCOM + component and have used
component services to generate the necessary .msi for client install.

Once the web service is written my biggest problem is going to be promoting
the service and writing a web site for it. Never mind. One step at a time...
:-)


I'm finding that, more and more, I can't even think of an app to try to
write that isn't web-based. :)

Funny that, isn't it...? :-)

The power of the network is insidious and permeates everything. Businesses
are fnding this too and that's why interoperability is going to be the new
buzzword. True platform independence is the solution for network services.
And I foresee Service Oriented Architectures becoming the future, based
around web services.

Maybe a library app - we have a good number of books, and my wife has
begun home-schooling. Even then, though, the database would have to be
centralized. I'm actually thinking about writing that - but at this
point, I'm really undecided about whether to go with Java or C#. I think
it would be good for my skills in whichever language I decide to go with.
Java would run under Linux, but supposedly so would C#, using Mono's CLR.


Either are good chices and I use both, but I'm tending more towards C#
lately... (You may have noticed :-))

Daniel, I'm really glad you found VS 2005 to be what I said it was.
Thanks for endorsing my comments.

You're welcome. The IDE is very good. One thing I found was that it
actually caught syntax errors, because the method/property list that I got
wasn't the one I expected. :) (Although, one gripe - it really OUGHT to
know that it can convert a .Substring(x,1) to a Char... but no,
Convert.ToChar(var.Substring(x,1)); ) heh - look at that, my parenthesis
actually match! ;)

Coincidentally, "Visual SlickEdit" (now known as just "SlickEdit") was
mentioned in Appendix A of the Java book. I've been entering the code
using it, and once I told it where the JDK was, it'll pop up methods and
properties for me too. It's not quite as thorough as the C# IDE, but I'm
familiar with it, so it feels comfortable. :)

Pete.


.