[Blog Map] [Table of Contents] This blog is inactive. New blog: EricWhite.com/blog
First, if you finished the tutorial, I am very interested to know that you did. I am also interested in how long it took you (in hours). Please drop me a quick email at white.eric at microsoft.com.
In the end, I believe that programming in the FP style is useful and powerful. When programming, it enables you to focus more on the problem domain, and focus less on the plumbing.
I think that in some circumstances, imperative code is more readable than FP code, so I am not (yet) an advocate of doing everything only in the FP style.
And as always, as my learning evolves, I'll certainly expose my learning process publically.
[Blog Map] [Table of Contents]
I read tutorial till parsing example part, don't have time for this now. I understood almost all of this before, but FP switch is something new to me, had to think on this one a bit.
Great tutorial. Some of the code is very advanced (at least for me), but you gave some great solutions to problems.
It gives me much better insight into this whole LINQ business.
Thanks for this tutorial, Eric. It's very clear and helpful. It took me about 8 hours total go straight through, copying and testing only select code segments. (I'm not certain as to the time, but that's about right; I was looking at some other links for further reference, too.)
The examples you gave were good, too, but I wonder why you would use fp techniques instead of an XSLT transformation since you're using OpenXML. I can certainly see some great benefits to this for generating object transformations.
There are two types of XML transforms, generally speaking: 1) transform a document to some simpler form of XML, and 2) transform a document into a new document (a document centric transform).
For the first type of transform, my experience is that it is far easier to write the transform using LINQ to XML compared to XSLT. I also find the code easier to read. I think that this is only true for developers after getting some level of experience with LINQ.
And there is the issue of performance - some LINQ transforms might perform better than the same transform in XSLT. There are a lot of reasons for this:
- XPath expressions are typically interpreted, whereas LINQ expressions are statically bound.
- no need to fire off a separate process in C# to do the transform.
But this by itself could be a dubious reason, as it is possible to write poorly coded transforms in either language.
For document centric transforms, XSLT works well; to use LINQ, you have to do something like the technique detailed here: http://blogs.msdn.com/ericwhite/archive/2007/07/30/how-to-use-annotations-to-transform-linq-to-xml-trees-in-an-xslt-style.aspx
And that technique, while it would perform well, is a bit abstract.
Sometimes there is an advantage to staying within one language, C# 3.0, instead of coding using a hybrid approach.
I've written a pile of programs to extract data and text from Open XML documents, and I really enjoy using LINQ for those purposes.
You are right, for object transformations, LINQ rocks!
[Table of Contents] [Next Topic] The following code is attached to this page. using System; using System.Collections.Generic;
Currently learning FP at University and I must say that your tutorial helped me a LOT. Thank you for taking the time to write this, much appreciated.
Phenomenal tutorial. I found it enlightening and enjoyable. FP has always been a very gray area for me, I never really "got it" or understood how to apply it in a conventional manner. You're tutorial has helped me in both areas.
Hi Wu, thanks! -Eric
Great tutorial. It would be helpful if you write a similar tutorial for Expression Trees.
I really liked your tutorial. It was nice to see the different parts pulled together. (Linq, Linq to XML, lambda, extension methods) I will be passing on a link to your tutorial to others getting started with these technologies.
This was definitely helpful. I don't know how long it took as I read a few sections each day over the course of a couple of weeks (with some breaks).
hi Eric, I did not have any experince with Lazy Evaluation and Open XML before this, but now I am quite clear. Thanks for this wonderful tutorial. I finished all of it in 4 hours with a half an hour break in between.
can we get an image file by using DocumentFormat.OpenXml.Packaging ?