Mono: A Developer's Handbook 301
| Mono: A Developer's Handbook | |
| author | Edd Dumbill and Niel M. Bornstein |
| pages | 278 |
| publisher | O'Reilly Media, Inc. |
| rating | 8 |
| reviewer | vertigo |
| ISBN | 0596007922 |
| summary | An introduction to programming with Mono |
When learning a new language such as C#, or working with a new development environment such as Mono, it usually takes some time before you get up to speed in developing programs. Wading through the reference documentation and reading other people's source code often provides much-needed information on how to do certain things. Both, however, are very time consuming and tedious.
Enter Mono: A Developer's Notebook. This book provides a series of task-driven chapters which are thin on theory, but rich on practical content and example code. The featured code snippets are, in contrast to ones in books that teach theory and concepts, not solely designed to illustrate a specific theoretical aspect of programming. Each one is designed to perform a useful task that is essential in day-to-day application programming. What sets this book apart from the multitude of .NET books already available on the market? In order to answer this question it is neccesary to provide a short introduction on Mono.
Mono is essentially an open source cross-platform implementation of Microsoft's .NET development framework and implements the API's which are standardized by ECMA. It is, however, not an exact clone. Besides providing a (partially implemented) stack that provides compatibility with Microsoft's .NET API's, Mono adds a whole new API-stack of its own, consisting of open source technologies such as the Gtk+ toolkit and the Gecko HTML rendering engine. This makes it possible to develop cross-platform applications based on open source technology while (mostly) compiling from a single code-base. In contrast to most .NET books available on the market, which focus primarily on Microsoft's API's in the context of Visual Studio.NET, this book concentrates on the basic ECMA API's and Mono's own open source stack. A complete coverage of .NET and the Mono architecture is outside of this review's scope, so for more information you are advised to check the Mono Project's website.
Before we dive deeper into the content of the book, a short introduction on the Developer's Notebook series by O'Reilly may be useful. The books in this series are styled to resemble the kind of notebooks college students carry around during their classes in which to take notes or, more commonly, draw caricatures of their teachers. The 'notebook' theme persists throughout the look-and-feel of the book. The 278-page thick paperback has a glossy blue cover, complete with faux post-it note and coffee-stains. Inside, the pages are not clean white but lined like the pages found in math notebooks. In the margin, useful comments are scribbled in a font that resembles handwriting. At first I suspected that the 'busy' look would distract from the content, but in practice this was no problem, thanks to the thick black typewriter font in which the bulk of the text is printed.
The chapters in this book are referred to as labs. Each of them focuses on a specific set of tasks and/or features and is divided into several paragraphs. Most paragraphs consist of a number of standard sections following a rigid formula that help you understand a certain aspect of working with Mono. The most common sections are:
- How do I do that?: Often using a liberal amount of practical code, this section shows how to accomplish the task at hand, for example working with files.
- How it works: In this section, the code and concepts involved in the previous section are explained more in depth, step by step.
- What about...: Offers a short focus on more advanced topics or pitfalls.
- Where to learn more: If you are craving more information after reading the previous sections, you are often offered a helping hand on where to find more information, providing url's to relevant documentation such as MSDN and other websites.
The first chapter, Getting Mono Running, describes how to get Mono up and running on Linux, Windows or Mac OS X, and how to compile from source on other platforms. The installation instructions for Windows only describe how to install Mono and Gtk#. Integration of Gtk# only in an existing Visual Studio.Net installation falls outside of the scope of the book, but a recent blog entry offers some hints on how to accomplish this. Besides installation, the first chapter offers a short description of the individual tools that make up the mono development. After installation, you will want some kind of editor or IDE to work with. Both the MonoDevelop IDE and several other ways of integrating Mono into your existing environment as a Java or Windows developer are covered. Finally, the community is an important aspect of every open source project. Ways of interacting with the community as well as a guide on how to submit bugs and links to some working Mono/C# applications are part of this chapter.
The C# introduction in the second chapter, Getting Started with C#, is tailored towards people who have at least some proficiency in using an object-oriented language such as C++ or Java. Some differences between C#, Java and C++ are discussed, as well as the differences between value- and reference types, the basics of error handling, working with assemblies and more. Concepts such as classes, methods, inheritance and namespaces are assumed to be known territory. If you have no previous programming experience, Mono: A Developer's Notebook is only useful in combination with a book that teaches programming with C# such as The C# Programming Language by Anders Hejlsberg.
An important part of any modern language is its class libraries. The third chapter, Core .NET, provides an introduction to the standard Framework Library Classes, which describes essential everyday tasks that are part of every program, such as working with files, strings, searching for text patterns and handling collections of data. Besides those basic functions, the chapter also dives deeper into the internals of a compiled assembly, the handling of processes and easy multitasking using threads. Finally, the last paragraph explains how to use a .NET version of the JUnit Java Unit testing framework, Nunit, to test your code.
Developing Gtk-applications with Mono and C# is remarkably easy. Chapter 4, Gtk#, describes the basics of writing Gtk# applications. First, it's neccesary to remark that Gtk# might be a bit of a misnomer. Besides the raw Gtk+ toolkit functionality, Gtk# also includes most of the Gnome libraries like gconf, the gnome canvas, libglade and more. Chapter 4 describes functionality available in the Gtk namespace, the basic Gtk+ toolkit. Gtk+ is a constraints-based toolkit, which means that widgets are not positioned using absolute pixel coordinates but rather on basis of their logical relation to each other. This can be a bit confusing for novices, but this chapter provides a good introduction to the basic principles of writing layouts using Gtk#. The authors provide descriptions of essential operations that almost every application needs, such as creating menus and drawing pixmaps (or more advanced things like using the treeview widget and drag-and-drop), assisted by easy-to-read code snippets.
While chapter 4 introduces basic Gtk# functionality, chapter 5, Advanced Gtk#, delves deeper into more advanced features of the Gtk# library which also include functionality outside of the basic Gtk-namespace, such as the Gnome libraries. Working with Gnome button toolbars, the Glade user interface designer, storing your application settings in Gconf, setting up some preferences through the use of a wizard/druid, asynchronous operations and threading to increase responsiveness of your application while performing background tasks, rendering HTML in your application using the Gecko rendering engine and internationalisation and translation of applications are all described in this chapter.
The use of XML is tightly integrated throughout the Mono framework. It is, for example, the underlying format of the messages that web services use to communicate using the SOAP and XML-RPC protocols. The 6th chapter, Processing XML, describes the XML functionality available in Mono. It starts off by simple operations, reading and writing to an XML-file using relevant examples such as RSS and Dashboard clue-packets. It then proceeds to describe how to modify XML in memory, how to navigate and transform XML using Xpath and XSLT, how to constrain XML in several ways and how to serialize and deserialize objects into and from their XML representation. As in previous chapters, the information density is very high so it might take several reads to grok everything explained. The code examples and accompanying text however are very clear and concise.
The 7th chapter called Networking, Remoting, and Web Services describes the networking functionality available in Mono. The chapter starts off with ASP.NET. Mono's stand-alone XSP webserver and Apache integration with mod_mono are discussed, as well as the basics of writing a web application using ASP.NET's code-behind functionality which enables web applications to completely seperate presentation from the underlying code. Communication using plain tcp/ip, remoting using binary serialized objects and invoking remote procedures using XML-RPC as an alternative to SOAP are also described in this chapter. You might want to encrypt the data you send over the network, so a basic description of the Mono cryptographic API is provided. Finally, a short introduction to database handling using ADO.NET concludes chapter 7.
The 8th and last chapter titled Cutting Edge Mono starts off with an introduction on how to use the GNU Automake, Autoconf and the pkg-config tools to create an easy to build source package of your project. It then proceeds to describe various pitfalls and considerations in case you want to write cross-platform applications using Mono, such as filesystem layout, configuration storage and the calling of native code using p/invoke. A particularly cool project is IKVM, which translates Java bytecode into the Common Intermediate Language bytecode Mono uses. This enables Mono to run Java applications and allows Java and Mono code to inter-operate. A short introduction on the use of IKVM is provided, as well as some code examples on how to call Mono assemblies from Java and use the Java class libraries from within Mono applications. The chapter ends with some other cutting-edge functionality, like how to run a development version of Mono, a preview of the Generics (templates in c++) implementation available as featured in C# 2.0 and how to write Mono programs in Basic.
What is missing? The book doesn't contain a reference section on any of the described API's. If you need detailed information on the C# language specification or an API reference you will need to consult external resources such as the documentation provided with Mono, MSDN, or a separate book covering the topic to make optimal use of the information contained in this book. Fortunately, the book kindly provides pointers on where to find those. The information-density is much higher than you would expect from a book this size. This means the information contained in it is terse. Many topics are treated in a only a couple of pages and the book doesn't take time to explain a lot of programming concepts. The information gets you 'on the road' quickly however, which is exactly what this book is supposed to do.
The strength of this book is that it fills the gap between the earlier-mentioned reference documentation and the need to go out and try to read sourcecode to find out how a particular thing is done. The writing style is clear, concise and neutral. Some topics are clarified by the use of screenshots, which is especially useful in the chapters dealing with Gtk# widgets. All in all, if you are a developer with previous experience in object-oriented programming, Mono: A Developer's Notebook will provide you with an excellent introduction into many of the aspects of working with Mono, its associated libraries and programs.
More information and a sample chapter can be found at the book's homepage.
You can purchase Mono: A Developer's Handbook from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
No animal on the cover? (Score:5, Funny)
Re:No animal on the cover? (Score:5, Funny)
Unless you count the rare and beautiful stickynote species, of which there are colors, shapes, and sizes. I have a small herd of sticky notes that surround my monitor and desk. My co-worker swears that he has heard me talking to them. I don't understand why this is strange, considering that many people talk to their pets. These are no ordinary pets, however... I was warned by the old Chinese man at Office Depot that I should not feed them after midnight, expose them to bright sunlight or let them touch water. He didn't explain what time after midnight it would OK to feed them, how bright the light can be, or how they are able to survive in moist environments and be made up of so much water but not touch it. Weird.
Beware the stickynote, for it is a mighty foe when angered.
Re:No animal on the cover? (Score:2)
Re:No animal on the cover? (Score:2, Funny)
No animal on the cover?
Since the book deals with Mono, might I suggest a gourami [thetropicaltank.co.uk]?
mono (Score:4, Funny)
Re:No animal on the cover? (Score:2)
which language gets the dung beetle?
Cobol
Summary of the next 100 posts (Score:5, Funny)
Re:Summary of the next 100 posts (Score:2, Funny)
Re:Summary of the next 100 posts (Score:2)
Why not use Java? Probably didn't feel like it.
Does it run Linux? Yes, where else would you expect GTK# to run?
I will ignore a few here...
Re:Summary of the next 100 posts (Score:2, Informative)
Re:Summary of the next 100 posts (Score:3, Interesting)
Ruby's GTK and Gnome or QT and KDE bindings.
While C# and dotnet get enormous amounts of PR hype, they really don't amount to much in the real world, where the platform lock-in and enormous bloat that dotnet entails spell doom.
Re:Summary of the next 100 posts (Score:5, Insightful)
The big advantage to
As for the patent stuff, I'm not aware of what patents cover
Re:Summary of the next 100 posts (Score:3, Informative)
That's assuming you don't count Rotor [c-sharpcorner.com], Microsoft's reference implementation of the ECMA-standardize bits of .NET (the C# language, the CLR, etc, but not bits like WinForms), which at least works on various BSD platforms, and is licensed such that you can safely port it to other platforms, or use it as the basis for a reimplimentation (think BSD's network stack, for instance).
Also keep in mind that Microsoft has a 10 year support plan for each new version of the .NET framework. Tha means that 1.0 will be supported for another 7-8 years, 1.1. will be supported for another 9, and 2.0 will be supported for 10 years from release (which should be sometime next year?). That means that even if Microsoft does make breaking changes in a new version of the platform, you can still build applications against older versions that Mono does support. As well, each framework has some amount of backwards- and forwards-compatibility (for instance, it's possible to run 1.1-targeted .NET apps on the 1.0 framework, with a few exceptions). Microsoft generally does a good job of listing backwards [gotdotnet.com] and forwards [gotdotnet.com] breaking changes between versions of the framework. (Yes, GotDotNet.com is a Microsoft property.)
Re:Summary of the next 100 posts (Score:3, Informative)
Personally, I like it. Throwing everything together in a huge registry is a can of worms just asking for trouble.
Re:Summary of the next 100 posts (Score:2, Funny)
It's about time! Everyday when I come into work, I have all these software maintainers waiting for me with a common plea: please code my application with ten different languages! It's nice to know that I can know fulfill their request and provide them with unending job security.
Re:Summary of the next 100 posts (Score:3, Interesting)
Assuming that is true, the only real worry for Mono is that Microsoft would change .NET enough to break what compatibility they have, but the Mono project has already explained why this doesn't worry them.
I just wanted to clarify this part in case people are wondering why. Basically Microsoft can't break .NET compatibility in old versions of the Framework because it'll break all the programs that use those versions. So versions 1.0 and 1.1 can be considered unchangeable right now (except for fixes probably), and it's safe from a coding standpoint for Mono to make an equivalent implementation without worrying about breaking changes.
Microsoft can extend and modify .NET with newer versions, such as the currently-beta 2.0, but .NET versions can and are designed to be installed side-by-side, so applications that use 1.0 or 1.1 still need the respective version of the framework installed. If you want to check this for yourself, take a look at the C:\Windows\Microsoft.NET\Framework directory. I currently have the subdirectories v1.0.3705, v1.1.4322, and v2.0.40607
Re:Summary of the next 100 posts (Score:2)
Let's get a few things straight about Mono:
To summarize: Mono isn't going anywhere. There's plenty that Mono can't reasonably implement to allow Microsoft to retain its platform lock-in without any nasty tricks.
Re:Summary of the next 100 posts (Score:2)
Wrong. Just because something is standardized does NOT mean it isn't patented or patent pending. The two are orthogonal issues, there are many patented standards out there. With a patented standard, you ned to license the patent to legally use the standard.
# To that end, there is absolutely nothing stopping someone from producing
Wrong again. You can patent APIs. I don't know if it has been done by MS, I haven't been wasting my time following all their C# moves. And if it was a submarine patent, we wouldn't know yet anyway.
Microsoft does not care if Mono is ~90% compatible with the
ANything that makes it easier to switch OSes they care about. At the current time it isn't worth it for them to pull the rug out under Mono, nobody important is using it. When someone important enough does, don't be surprised when MS sues.
Re:Summary of the next 100 posts (Score:2)
Can you name a case where something similar (let's say an API or language spec) was submitted as, let's say, an ECMA spec and later the implementor(s) was sued into oblivion? I find it highly unlikely that Microsoft would legally be able to make publicly available, to a standards body, documents describing the bytecode file format and syntax of the language and then suddenly be able to say "no no, you aren't actually allowed to implement any of this."
Wrong again. You can patent APIs. I don't know if it has been done by MS, I haven't been wasting my time following all their C# moves. And if it was a submarine patent, we wouldn't know yet anyway.
Sure you can patent APIs. But there's nothing stopping me from making a functionally and API-equivalent clone of your, let's say, LinkedList class. BTW, you better warn those Wine guys, seeing as how they've been cloning the Win32 API for years.
ANything that makes it easier to switch OSes they care about.
You're missing the point. The ONLY part of the APIs that keeps people locked in to Windows IS NOT the mundane 90%, but the ~10% of stuff that can only be found on Windows.
Re:Summary of the next 100 posts (Score:2)
I can think of several ISO and ANSI specs where this happened. I don't know about EMCA in particular, in fact before MS used them, I'd never heard of EMCA. You can also look back at the W3C proceedings a few years back- they were deciding wether or not to allow patented technology in standard. The no patent groups barely won.
But there's nothing stopping me from making a functionally and API-equivalent clone of your, let's say, LinkedList class.
If there's a patent, yes there is. Copyright lets me clone with a similar interface I wrote myself, patents block all implementations of the patented functionality.
The ONLY part of the APIs that keeps people locked in to Windows IS NOT the mundane 90%, but the ~10% of stuff that can only be found on Windows.
No, you are. The reason anyone would want to code for Mono is because it would be cross platform. If MS has a submarine patent (and I'd put good ods that they do), they can pull it out from under the Mono developers once they have sufficient userbase. The people running those apps will then have the choice to rewrite in another language, or switch to MS and
Re:Summary of the next 100 posts (Score:5, Funny)
Re:Summary of the next 100 posts (Score:3, Insightful)
If you want cross-platform and (fairly) strong typing, use Java, if you want loose typing and want Linux or OS X, use Objective-C ( GNUStep/Cocoa respectively for UIs ), if you want M$, use Visual Studio C++ or flavor-of-the-moment C#, or flavor-of-the-last-moment VisualBasic, or ( somebody's favorite Wxyz windows-centric development platform here )...
But seriously ( for a moment ), without asking why not use Java, why use C# ? What's the benefit over *anything* else, other than Microsoft is pushing it hard ?
Because You Like It? (Score:2)
Re:Forgot one... (Score:2)
It isn't important if C++ or any other language really did solve the same problems. Why should people use C++ if they don't like and and no one is paying them to use it?
Are you also deadset against every other language, too?
Considering the fact that almost everything in Linux and the opn source arena is a knock-off of something else, accusations of "copying" ring loud and false.
Re:Forgot one... (Score:2)
So let me get this straight: If I wanted to use Mono, I'd have to: relearn how to do everything I already know how to do in C++... rewrite all of my personal libraries... learn a completely new set of bugs in a new API....
Dude. If you have portable a)threading b)database connectivity c)GUI d)App servers working in you precious little C++ personal libraries setup you are either bullshitting us or smoking dope or do not know what you are talking about.
I have spent many years developing enterprise applications in C++. Even after they (finally. after many years of hell) got more or less portable standard implementations right, stabilized ABI etc etc. it still does not have what it takes to design middle tier stuff. That's where the money are.
you are free to wallow in your desktop/standalone apps (games?) /single platform world, but at least admit there are TONS of benefits of using Java (or .Net) platform for enterprise development (remember - that's where the money are).
Re:Forgot one... (Score:2)
If you have portable a)threading b)database connectivity c)GUI d)App servers working in you precious little C++ personal libraries setup you are either bullshitting us or smoking dope or do not know what you are talking about.
Well ...
Most of these are admittedly C based, or available for C, but then real programmers don't bother with falsh in the pan stuff like .NET. Remember, .NET and C# is only relevant until MicorSoft find it's time to get you to upgrade (and deprecating your existing language or platform like VB or Fox is as good an incentive as they come).
Re:Forgot one... (Score:2)
but point out that it won't buy us anything, such as additional capabilities.
What do you do? What threading/GUI/networking/DB/utilities (such as regex) libraries do you use?
What development environment / automated testing /build environment?
In each of this areas Java will bring rather larger productivity gains. It is not just code. It is things like automated testing frameworks, ANT, 3rd party libraries working much more reliably.
I am not a big fan of Java, but our team migrated to it and advanatages are numerous and fairly obvious. It is quite possible, though, you do not care about any of it.
Re:What's funny (Score:2)
What's funny is that Slashdotters criticize Microsoft constantly for not innovating and for ripping others off. Meanwhile, we're discussing C# and a .NET clone
>C# is a Java clone, while .NET is a JFC clone. Of course, Java and the JFC was inpsired by Objective C, NeXTstep and Smalltalk, but at least they weren't a blatant attempt to make an incompatible version of something just for monpololy preservation.
Objective-C (Score:4, Interesting)
Re:Objective-C (Score:3, Informative)
Sidenote #2, IronPython, which runs on Mono, has been shown to perform better (on average, 1.7x better) under most performance tests than standard Python v2.3. (this is not a troll or flame-incitation, just a FYI). See IronPython.com [ironpython.com], or this paper from PyCon 2004 [python.org].
Re:Objective-C (Score:5, Informative)
It was a little less than a year ago that I first started investigating the Common Language Runtime (CLR). My plan was to do a little work and then write a short pithy article called, "Why
The more time that I spent with the CLR, the more excited I became about its potential. At the same time, I was becoming more frustrated with the slow pace of progress that I was able to make working on this project in my spare time. After exploring many alternatives, I think that I've found the ideal way to continue working to realize the amazing potential of the vision of the CLR. I've decided to join the CLR team at Microsoft beginning on August 2.
At Microsoft I plan to continue the work that I've begun with IronPython to bring the power and simplicity of dynamic/scripting languages to the CLR. My work with Python should continue as a working example of a high-performance production quality implementation of a dynamic language for the CLR. I will also reach out to other languages to help overcome any hurdles that are preventing them from targeting the CLR effectively. I welcome any and all feedback about how to best accomplish this. You can reach me at jim@ironpython.com.
Lesson to be learned, if you think something from MS sucks, only to find out it doesn't, you might just get hired.
Re:Objective-C (Score:4, Informative)
To each their own, but I suspect you are in a small minority. Garbage collection, safe modules, type-safe linkage, and runtime code generation are all important modern language features that C# has and Objective C lacks.
Re:Objective-C (Score:3)
Perhaps for a lot of apps, but not for me. I had a close look at Objective-C about a year ago. I started reading up on it and found that it missed operator overloading. I tend to do a lot of graphics and physics programming (nothing professional of course) and the thought of doing vector, matrix, and quarternion maths without operator overloading was just unacceptable. But I notice that ARToolkit [artoolkit.org] is written in Obj-C (whenever it's released). Could a seasoned Obj-C coder explain whether there's a way to get around the lack of operator overloading without using explicitly named methods?
Re:Objective-C (Score:2, Informative)
Re:Objective-C (Score:2)
I had a close look at Objective-C about a year ago. I started reading up on it and found that it missed operator overloading.
Operatror overloading? OPERATOR OVERLOADING??? One of th momst abused features of C++ and you miss it? You clearly haven't worked in the industry long enough to seen the abortions people produce with misconceived features like these.
Re:Objective-C (Score:3, Insightful)
Object-orientation is just a language feature, it's not a true indicator of the level at which a language exists, but typically it provides a boost to the level of a language. C, Objective-C, and C++ are each slightly higher-level than the last, but only slightly. It's other standard features (iostream, STL, etc.) that make the language truly higher-level.
The level of a language also depends on what you measure that level relative to. One way to look at it is to ask how far above the machine you are. In assembler, you aren't very far off the hardware. Every instruction is tailored to the hardware. But you can also measure relative to the OS. In C, you are farther from the hardware itself, but low-level to the operating system - you have to tailor your code to the OS it will run on.
Mono (Score:4, Funny)
Re:Mono (Score:2)
- So what do you do for a living?
- I develop Mono
- Er.. Look at the time, I've got to be going now...
Re:Mono (Score:2, Funny)
There are always books explaining how to accomplish difficult tasks. Most people here would be hard pressed to contract mono the way you described.
Mono (Score:2, Funny)
Re:Mono (Score:2)
Re:Mono (Score:2)
Well, if you hadn't been sucking face...
Mono vs .NET Framework (Score:3, Interesting)
Re:Mono vs .NET Framework (Score:4, Informative)
The mono c# compiler allows you to create CIL (common intermediate language) code, which is analygous to java byte-code, except for just-in-time compilation. The mono implementation of the
The whole point about the
When Mono's Windows.Forms implementation is complete, you should be able to do this same thing with complete GUI applications, however in the mean time that's what GTK# and other linux-based APIs are for.
Re:Mono vs .NET Framework (Score:5, Informative)
Personally, I disagree. Visual Studio is still a phenomenal IDE, and its GUI tools are some of the best on the market. But I think as we see Mono stabilize and mature past 1.0, the GUI tools for Gtk#, ASP.net, and the new Managed.Windows.Forms implemenation will be quite impressive.
(Disclaimer: This isn't a knock at Glade. Glade is good at what it does, but with the advent of Mono it's time for a replacement.)
Re:Mono vs .NET Framework (Score:3, Informative)
But, in addition, Mono also offers bindings to the Gtk+/Gnome APIs, and that makes software development a lot easier for Gnome developers. There are some GUI builders you can already use with those Mono bindings, and a new GUI builder will be integrated into Monodevelop, giving you a VisualStudio.NET-like experience developing applications for Mono and Gnome.
So, in short, yes, Mono "captures the simplicity of the
Re:Mono vs .NET Framework (Score:2)
I suppose if I develop in Mono for Windows I need to be able to make an
I guess I can always use Visual Studio to create nice installer that would include gtk/glade dlls and whatever else I may need. But can I do the same without VS?
Sweet Spot? (Score:4, Interesting)
1) operating system kernel or core library, embedded or high-performance programming. This niche only finished moving from assembly to C a few years ago. C++ is usually too slow & big & unwieldy for this niche, let alone C# or Java, although we may be ready for it in 5 years or so.
2) application programming. Here development speed is more important than execution speed. Python and kin provide 'good enough' execution speed when coupled with proper libries (QT, etc) with the fastest development speed.
What kind of code falls between the 2? Sure there is some, but is it interesting?
Bryan
Re:Sweet Spot? (Score:5, Interesting)
> than execution speed. Python and kin
Right on. And with Ruby/Python/etc you can always dip down into a C library for bits that turn out to be performance-critical. With Ruby, this is usually as simple as something like:Hard to beat...
Re:Sweet Spot? (Score:2, Informative)
The same is true for C#, using the platform invoke mechanism, it's even simpler.
Re:Sweet Spot? (Score:2)
The same is true for C#, using the platform invoke mechanism, it's even simpler.
[DllImport("myclib.dll")]
static extern void DoSomething();
DoSomething();
The point isn't that lower level languages can call libraries -- I'd *hope* that any non-toy language can do it -- the point is if a higher level scripting language can do it, why *bother* with all the extra bother of low level languages?
Non-Trivial Case Please? (Score:2)
How does Ruby know whether or not it has to free() the string returned from Curl.curl_version?
These things may look nice at first, but trying to automagically use low-level languages as if they were high is doomed to a painful failure
You may be aware of this, but your post is misleading in that it makes the reader think the programmer is freed from dealing with the pesky details of using a low-level language.
Re:Sweet Spot? (Score:3, Insightful)
I work specifically on 'fast path' software that is in the data path, and while we absolutely must be concerned with performance, a good C++ compiler will generate perfectly acceptable code from a speed standpoint. Any tweaks can be done in assembler. The benefits in extensibility and good code design are usually worth it in the log run (and better designed code is generally less buggy and often faster)
So, the point is that it's primarily memory footprint that has kept embedded engineers from using C++ (or other OO) in the past, but as that restriction has lessened, more and more of them are using C++ and OO design principles (even in 'fast path' processing).
Therefore, I (and many of my collegues) would like a language that is more OO than C++ (which frankly is a hack between C and strict OO languages), but still provides the direct system and memory access that a language like C provides. Not saying C# is it by any means, but there is a sweet spot between #1 and #2, and I'm living in it
Re:Sweet Spot? (Score:5, Insightful)
It's a myth that C/C++ is particularly fast or efficient for those applications: in the absence of language-provided features like garbage collection, runtime safety, or dynamic typing, people end up reinventing those features over time, badly and less efficiently.
Both Gtk and Qt are actually sad examples of this: not only does their functionality suffer from their choice of language (each has invented their own object models), their resource requirements are embarrassingly bad.
application programming. Here development speed is more important than execution speed. Python and kin provide 'good enough' execution speed when coupled with proper libries (QT, etc) with the fastest development speed.
Languages like Python have other problems for the development of large systems, like the lack of static type checking. Python is great, however, for prototyping, extensions language uses, and for single programmer projects.
But, in any case, there is a lot of application software that requires much better performance than languages like Python can deliver: CAD systems, graphics systems, image encoders/decoders/editors, vector graphics renderers, typesetting and layout software (including web browsers and editors), audio encoders/decoders, GIS systems and mapping programs, speech recognition engines, and lots more. No, application developers have neither the time nor the resources to turn all the compute intensive core functionality in C/C++ code and then link that into Python. C# is a good middle ground.
let alone C# or Java, although we may be ready for it in 5 years or so.
The performance of Sun's Java implementation is excellent (although Java sucks for other reasons). The performance of C# implementations is quickly catching up with Java implementations.
Re:Sweet Spot? (Score:3, Interesting)
That depends. For single processor 32bit x86 environments, I've found .NET to be significantly faster than Java. It helps to be able to inline short non-virtual methods, perform allocations for simple non-native-typed objects on the stack, etc. The gap will probably only widen as the two camps release their very different implementations of generics.
Java clobbers .NET in the 64 bit world and in the multi-processor world. .NET also doesn't really appear in a non-x86 architecture and probably wouldn't perform as well - Not surprisingly .NET IL looks to be pretty biased to the x86 architecture.
But for every runtime optimization the Java world can build, the .NET CLR team can match it and build in another option the Java camp can't without a pretty drastic change to some of the core internals.
(note that when I talk about .NET, I'm referring to the Microsoft .NET CLR - the Mono CLR is still pretty slow to my experience, but getting better by the day
Re:Sweet Spot? (Score:2)
This is a baseless argument. What evidence do you have that GTK (I have no experience with QT) is a poorly designed object framework? In actuality I find it a superbly well-designed framework that translates *very* well into these other object-oriented languages like C#, Java, and C++. Python and Perl also have bindings that are very comfortable within their own object framework.
Re:Sweet Spot? (Score:2)
Nowhere did I say it was "poorly designed". Gtk+ is probably about as good a toolkit as you can design with C.
Python and Perl also have bindings that are very comfortable within their own object framework.
Yes, after a lot of work has been spent on fixing the bindings and the bugs. And even then PyGtk applications written in pure Python still can crash with memory management and pointer errors. And there are still limitations when it comes to inheritance, memory management, and when mixing Gtk+, Python, and some other OO language.
Re:Sweet Spot? (Score:2)
The performance of Sun's Java implementation is excellent
But not near as good as JRockit(BEA) on Intel.
Re:Sweet Spot? (Score:4, Insightful)
Huh? I typically find that I don't have the time not to do this. Programming in Python takes me about 5 to 10 less time than programming the same functionality in C, and in the rare cases something is too slow even with Psyco [sourceforge.net], I use Pyrex [canterbury.ac.nz] for the inner loop, typically a single function or class.
CAD systems: I am not familiar with those, what exactly is too performance-critical for Python in CAD systems?
graphics systems: Huh?
image encoders/decoders/editors: Image encoders/decoders are typically very small projects - small enough to write in C or other low-level languages.
vector graphics renderers: Probably true
typesetting and layout software (including web browsers and editors): Python is fast enough for these, on non-antique hardware.
audio encoders/decoders: Similar to image encoders/decoders, these are small and should be implemented in a low-level language.
GIS systems and mapping programs: What is time-critical about these?
speech recognition engines: I suspect there's a small algorithm running in an inner loop and a lot of higher-order code. Only the inner loop needs C, and that only if you want Real-Time behavior.
Ever since I turned to write nearly all my code in Python, my productivity was boosted by hundreds of percents, and I am less surprised with time that Python is fast enough in almost all cases when it is used right.
Re:Sweet Spot? (Score:3, Insightful)
This is a debatable point. On the one hand, yes, it is dynamically typed. On the other hand, having easy access to an interpreter and zero compilation times leads to interactive testing and a more incremental approach to building large applications. In my experience, the latter far outweighs the former (as long as raw performance isn't the issue).
Re:Sweet Spot? (Score:2, Interesting)
Projects like IronPython give you all the advantages of working in Python, all the advantages of working on top of the CLR framework and toss in the added benefit of every other
btw - Being able to run stored procedures written in Python on the SQL Server 2005 beta is pretty cool. I still can't find a good reason to write a stored procedure in any language other than T-SQL, but its still kind of fun.
Re:Sweet Spot? (Score:2)
What kind of code falls between the 2? Sure there is some, but is it interesting?
The whole enterprise middle-tier application world. The one where they spend billions of dollars on software, you know? Where hordes of mindless drones whip out custom code that actually has to run reasonably fast and interoperate with a variety of systems.
In short - everything you want to run in an app server to do business.
I thought... (Score:3, Funny)
Before anyone starts trolling... (Score:5, Informative)
Mono with the
Mono with GTK#, Gnome, Mozilla and other libraries doesn't have that problem because the only thing that it uses from Microsoft is the ECMA standard C# language implementation.
Why Mono and not Java? Mono is 100% open source.
Why Mono and not Python? Mono uses a virtual machine environment that is faster than an interpreted language. Some people prefer the Java and C++ similarities that C# offers. Mono is cuasi language independent. You can use Python in Mono (See Iron Python).
"Miguel de Icaza is wasting his time..." Miguel works on Mono because he likes it, he is not employed by you (except if you are Novell) so he spends his time as he sees fit. He owes you nothing.
Cheers,
Adolfo
Re:Before anyone starts trolling... (Score:3, Informative)
Well.. if you're going to be "educated and informed", you should at least trouble yourself with considering the fact that there are open-source implementations of Java.
JBoss, gcj, kaffe...
And it's also fair to remember that there are indeed two different
patented libs in different part of build tree (Score:3, Informative)
Mono with GTK#, Gnome, Mozilla and other libraries doesn't have that problem because the only thing that it uses from Microsoft is the ECMA standard C# language implementation.
And the beaut think about that is the *potentially encumbered* libraries are in a different part of the build tree, ready to be pulled if a MS (FUD) patent does get served.
Re:Before anyone starts trolling... (Score:2)
Ever wonder how Miguel got into this position of being more convincing than you are?
Shit happens. (That is actually a perfectly serious answer).
For the uninitiated (Score:4, Informative)
There's an RSS feed [mono-project.com] for the newest news, updates, etc. on Mono, too.
Developing Mono. (Score:4, Funny)
Who needs a book? (Score:3, Funny)
Argh! (Score:5, Informative)
Java/C# = Strongly statically typed
Python/Ruby = Strongly dynamically typed
"Loose" typing is another way of saying "weak" typing. Meaning the system doesn't enforce type safety. In almost all scripting languages, type safety is strongly enforced.
Re:Argh! (Score:3, Informative)
Re:Argh! (Score:2)
I keep trying to forget TCL... the drugs are helping... aaahhh!! Vignette!! Tk applications that don't scale!! burning! death!....
Ok, I'm ok... it's ok... please don't mention that language again.... PLEASE.
Re:Argh! (Score:2)
C/C++ = Weakly statically typed
Java/C# = Strongly statically typed
Why? Because you can cast to a void *? You can cast to Object in Java and it's not checked until run time. The typing of Java is no stronger than C++.
At least we have strongly-typed collections in C++. How many times have you pulled the wrong thing out of a Java collection and not found this out until run-time...
The silly things they print in textbooks...
Re:Argh! (Score:2)
Re:Argh! (Score:3, Informative)
You *don't* have strongly-typed collections in C++. You've got *statically* typed collections in C++. They are, however, still *weakly* typed.
The difference between weak and strong typing is in that a strongly typed language, the compiler enforces the type system.
The difference between static and dynamic typing is that in a dynamically typed language, some type information may not be known until runtime.
Maybe you should read one of those textbooks...
Re:Argh! (Score:2)
Here is somthing funny (Score:3, Informative)
C# without .NET? (Score:3, Interesting)
Oh hell, I'll bite (Score:5, Insightful)
Re:Oh hell, I'll bite (Score:2)
Where did you get the idea that Firefox was written in Java? It's derived from Mozilla (which is C++) and makes heavy use of XUL which uses JavaSCRIPT. That has nothing to do with Sun's Java one single bit.
Re:Oh hell, I'll bite (Score:2)
Thats odd.. (Score:2)
Every try pascal or Object Pascal (Delphi)?
Re:Thats odd.. (Score:2)
Hehe... (Score:3, Funny)
Yeah, of course now that there's an open source implementation, C# is a good language...
No advantage of C# over Java (Score:2, Offtopic)
But Java has better support on a bigger variety of systems. And it does not rely on the good will of Microsoft to allow it to run on Linux.
And when using JRockit JVM on INtel harware - it is fast. Faster then equivalent C# code in my applications (prototyped certain numerical algorithms)
And it has a better development environment: Eclipse, IntelliJ etc.
Why C#. Why make it sound that this is some revelation of a language? There is nothing new there.
Comment removed (Score:2)
Re:No advantage of C# over Java (Score:2)
The 32 bit space & allocation limits of the JVM
I must have been dreaming running JRockit on Itanium. Or, much more likely, you do not know what you are talking about.
Java beats pants off C# on 64 bit. Java does not depend on the good will of Sun as long as folks like IBM, Oracle, BEA etc are around.
Comment removed (Score:2)
Comment removed (Score:3, Interesting)
Re:No advantage of C# over Java (Score:3, Insightful)
To date Java has produced exactly two good desktop applications, Eclipse and Azureus. It's an abysmal failure, and the associated stigma won't disappear anytime soon.
Telling users to go to Windows update and pull down
Mono apps on Linux or Windows won't come in some funky
The JRE is an alien piece of software in Linux land. Even after you install the official RPM "java" produces a "java: command not found". Even as a developer I don't want to deal with that sort of shit these days if it can just be automated. There's just been no thought given to end user experience and it shows throughout the whole platform.
All these points make Java a horrible system for desktop Linux apps, and Mono on par with existing systems. Then when you add in all the niceties of working in a managed language, you've got to at least give Mono a good look when deciding what to use for your next Linux app.
Mono's 100% open source. Dismissing it right from the start just because it has its origins with MS is just stupid. The situation is completely analogous to MS SMB vs Samba. Even in an all Linux shop you're likely to find Samba in use because, frankly, NFS for the longest time has been a real piece of shit and is only recently worth using on Linux.
C# Rocks (Score:3, Interesting)
There are mistakes in how the C# language has been designed that really bug me at times, but I've been developping in C# for about 2 years now and I've never been so productive in my life.
It has a lot of the advantages of Java, but with a better UI (and by better, I mean better looking AND better performance. The Java ones seem to be one or the other: Fast and Ugly or Slow and Pretty, and maybe even some slow and ugly ones).
I really hope Mono can keep up with the Longhorn development because I really expect the library design to be better. There are a lot of aspects of the
But complaints aside, overall it's excellent and as I said, I've never been so productive! As an independent contractor, that means a lot to me.
Re:What about java? (Score:5, Informative)
Mono is Novell's implementation of this standard [ecma-international.org].
On the other hand,
Same standard, 2 different implementations of the standard.
Re:What about java? (Score:3, Informative)
Re:What, no VB? (Score:2)
Re:What, no VB? (Score:2, Informative)
Re:Cobol (Score:4, Informative)
Re:Cobol (Score:2)
Re:It's not the language that counts... (Score:2)
And frigging HASHMAPS.
And regular expressions.
And..
People who claim C++ does everything have not done commercial development. And the hell of thrid party libraries (RogueWave anyone?)
Re:Notebook or Handbook? (Score:2)
I'm reminded of a series of booklets Radio Shack used to sell, back before it sucked, called "Engineer's Mini-Notebook". Written in a draftsman's block-print hand, they contained schematics and explanations of fun electronics projects to try -- all of the parts, of course, available from Radio Shack. I still have two or three of these.
These days you can't buy anything much more wireheadish than gold-plated audiowank cable.