Alois Kraus

blog

  Home  |   Contact  |   Syndication    |   Login
  133 Posts | 8 Stories | 368 Comments | 162 Trackbacks

News



Archives

Post Categories

Programming

 Robert did write about my F#/C# article where he states that F# is as easy to learn as any other imperative language.
My final comment was:
Not all concepts of functional languages should be explored by Mort and Elvis since most of them are fairly complex to understand because functional languages are very picky (just like unix) who can be their friend and who not. If Einstein does write a F# program then only a true Einstein can maintain it. When the outsourced Mort and Elvis do change his code I am sure they will screw it up
He does argument that any complicated problem will result in more or less complex code which is difficult to understand. F# is much clearer and does require in many cases less code to write. This is true. But since F# and C# are different languages what is the difference anyway? Here is the catch: The F# language itself was designed to allow scientists to write complex algorithms with few lines of code. Humans with high mental capabilities see the immediate value of short and concise code that does not distract the reader with unnecessary syntactic language elements. This high value is at the same time it's Achilles heel. The language is only useful if the code is short and concise. If Einstein plays nice with Mort and Elvis he would comment the code. Every function should be described what its purpose is, what the input variables are and what the result is. But since there are so much more functions defined F# source code  this task of thorough documentation is not very practical. The other problem I have with F# is that there are so many implicit conventions you have to know. Where does the program execution start in a F# project with 50 files? Grep for main? Einsteins have no problems with syntax. All is clear to them. But Mort and Elvis will struggle with the syntax of a language where no explicit main, no explicit function end does exist. The C# syntax is perhaps bloated but at least it makes things much more explicit which is a good thing for the people who have to understand not your algorithm but the overall program structure. Nonetheless I will continue to explore F# because it does help to look at many problems from a different perspective where it does offer some remarkably easy solutions.
posted on Tuesday, May 30, 2006 9:50 PM

Feedback

# re: Is F# Code easy to understand? 5/31/2006 2:02 AM Greg Young
I have to admit it took me a while to _get_ functional languages (and I still don't _really_ get them but can hack my way through). The effort is well worth it though when you have a situation that calls for their types of behavior.

# re: Is F# Code easy to understand? 6/1/2006 8:44 PM Robert Pickering
Hey Alois, this is a good answer!

I agree with you that there is danger, that some one who _thinks_ they really clever might spew out a massive code base and leave it behind hoping that some one else will clean up there mess, but I also think this can happen in any language. To write good maintainable code, it does not matter if you are an Einstein, you have to document as you go along.

I also agree that there maybe problems scaling projects written in F#, my gut feeling that a language with explicit typing, C#, will work better when a code base is shared between a large group of developers and an implicitly type language, F#, works better when the group of developers is relatively small.

Having said that linspire recently announced they where going to do most of there development in Haskell (http://lambda-the-ultimate.org/node/1506). It will be interesting to see how this projects develop as they are shared between the large number of developers in the Linux community.

I disagree too that F# projects won’t scale, the F# compiler and libraries come to about 250 files, but the team seems to be able to maintain them and add new functionality. Then again, the team is pretty small and very smart.


# re: Is F# Code easy to understand? 5/8/2009 8:23 AM dan meismer
F# code is easy to understand in the sense that it allows you to write your program clearly and concisely, moreso than in other languages.

F# code is difficult to understand is the sense that you must first learn some advanced programming techniques (compared to c#) in order to understand what is going on.

Thus, the average programmer will not be able to understand an F# program.

Hiring managers may be reluctant to adopt F# because it limits how far they can treat programmers as commodities. [As opposed to the Java world, which is designed for this]

However, if one F# programmer is as productive as 2-3 C# programmers, and I suspect this will be true, then management will have to...well this is just simple math.


I believe the big factors in the success of F# will be:
1. The number of people that take the time to learn functional programming concepts.
2. Companies having strange legacy codebase situations that prevent F# from being viable (despite its .NET integration).
3. IT managers being good at math.
4. People being willing to try something new.


#4 is the biggest one, I think. Programmers aren't much different from everyone else in the world, except they know how to tell computers to do things. They rarely change.

So what do I think? I have no idea, but I think learning F# will give me a competitive advantage. Even if I never get to use it, it will make me a better programmer.



# re: Is F# Code easy to understand? 10/21/2009 5:14 PM Jarle Stabell
I agree with you that you must first learn some new programming techniques (compared to c#) in order to understand F# code. However that doesn't mean the average developer will never be able to understand an F# program, only that he/she will need to spend a couple of weeks learning the new concepts and syntax first. I think it is a widely (and correctly) held belief that learning a programming language is quite easy, it is learning all the libraries, frameworks, patterns, idioms etc which takes a lot of time, not learning the language itself.

# re: Is F# Code easy to understand? 5/11/2010 3:17 AM Stephen Martin
It seems to be an acquired taste. I have written programs in VB 6 and C# , VB.NET, SQL etc. I think if I never saw any of these languages F# would be a lot easier.

With that said, I think it is a mathematical view of programming and the language provides a powerful ways to do things in a few lines of code. I am beginning to use dll's and using them in other programs.

If I were Microsoft I would market it for science. I went to a recent Microsoft event and their evangelist were showing how you could zoom in to 200 % in basic C# code . No mention of F# at all. For my money it is a language and a skill set that is worth having if you crunch numbers

# re: Is F# Code easy to understand? 7/20/2010 8:16 AM alex
When I first started to search for F# code online, i saw a lot of translations from imperative style to F# syntax, but did not really see much true functional code. What i mean by that, is that people still use loops and mutable types and everything that makes C# great in F# syntax and as result, come up with something that is actually not that easy to read because it takes up too much space in F# terms, like any regular C# program. I think true functional programming is only suited for someone who wants to think in terms of functions, higher lever of abstraction than C# allows, and then the code is truly beautiful.

# re: Is F# Code easy to understand? 8/19/2010 12:17 PM Samson
F# is not easy to understand.
The use of let in all statement ,make it more cumbersome.
Even it increases the lines of code.
Frankly speaking I received a sample code in which every statement has LET ,it took me a long time to search which programming language is this.Finally googling up landed me to F#.Now I am looking how to convert F# to vb.
Anyhow thanks to F#

# re: Is F# Code easy to understand? 8/11/2011 2:55 PM Yemi Bedu
Hello,
_ There would be no extra lines of code for the "let" keyword that is used in F# than the types specifiers used in earlier C# code and the "var" used in some newer C# code. The same holds for the types or "auto" keyword use in C++ code and "Dim" used in VB.NET and I use all of these imperative languages.

_ I do dislike the white-space sensitive formatting but since I can still use some closing marks and separators (done and ";"), I save bits of my free form structure sanity.

_ Some of the code I write is data-oriented (SQL results) and they are passed around as table objects to check for properties and to be acted upon based on row filters. This means many loops and some mapping here and there (colorization and computed fields).

_ Since SQL is functional and many of us use it daily, it would lend to benefit using F# to fluidly manipulate those results. That is why LINQ came along. No?

_Thank you. Good day.

Yemi Bedu

Post A Comment
Title:
Name:
Email:
Comment:
Verification: