Forums

Is Cobra and/or Naja appropriate for me?

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Is Cobra and/or Naja appropriate for me?

Postby Zmeeed » Thu Feb 02, 2012 2:56 am

I know some programming languages, but very superficial. One languages are too inconvenient for me, others are inconvenient for my problems. For example, I have made recently the program on Java which has appeared difficultly read even for me, its founder. In spite of the fact that it not so big, and I know its algorithm by heart. Certainly, a principal cause that I just codemonkey. Principal, but not the unique. Java has appeared very inconvenient for my algorithm. Also it is not my conclusion. I consulted to professionals and they have confirmed that my algorithm will turn out unevident in language which forces to use object-orient paradigm even there where it isn't necessary. Language of functional programming would be much more suitable. But I don't know any of them. I try to study F# now, but it turns out slowly and difficultly. Then I have paid attention to a Python. It's multi-paradigm has involved me. It is possible to write in habitual style, then rewrite parts of the program in functional style. And here then I have come across the Cobra. I did not have time to study and use TDD though I know about its utility. I program in loneliness, it just a hobby. But if contracts and tests are built in language - it is magnificent!

I so detailly tell about the uninviting person because answers to some questions are necessary to me. The first and main from them: whether really the Сobra is the suitable tool for me? I have bought the book "Python Programming for the Absolute Beginner" by Michael Dawson, it should be delivered in the nearest some days. I can study the Cobra with its help? The Cobra has kept a functional paradigm of the Python? My programs should include the parts written on C# (much of legacy code) and, probably, on F# (small, but very "functional-oriented" part). How much the Cobra is convenient for this purpose? What is best IDE for creation of such multilingual programs - Naja, SharpDevelop, VS? Excuse that I burden you the big text in ugly English.
It is easy to go from the house of reality to the forest of mathematics, but only few know how to go back. Hugo Steinhaus.
Zmeeed
 
Posts: 13
Location: Russia

Re: Is Cobra and/or Naja appropriate for me?

Postby torial » Thu Feb 02, 2012 12:06 pm

Zmeeed wrote:....I consulted to professionals and they have confirmed that my algorithm will turn out unevident in language which forces to use object-orient paradigm even there where it isn't necessary. Language of functional programming would be much more suitable. But I don't know any of them. I try to study F# now, but it turns out slowly and difficultly. Then I have paid attention to a Python. It's multi-paradigm has involved me. It is possible to write in habitual style, then rewrite parts of the program in functional style. And here then I have come across the Cobra.


Hi -- I can't speak too much on the functional programming paradigm, but you may find LINQ approaches to be fitting what you need. As I understand it, there are many aspects of functional programming paradigm bottled up in a proper LINQ approach.

Zmeeed wrote:whether really the Сobra is the suitable tool for me? I have bought the book "Python Programming for the Absolute Beginner" by Michael Dawson, it should be delivered in the nearest some days. I can study the Cobra with its help? The Cobra has kept a functional paradigm of the Python? My programs should include the parts written on C# (much of legacy code) and, probably, on F# (small, but very "functional-oriented" part). How much the Cobra is convenient for this purpose? What is best IDE for creation of such multilingual programs - Naja, SharpDevelop, VS? Excuse that I burden you the big text in ugly English.


Really Naja doesn't offer much at this point over a glorified text editor like SCITE (I say this as the creator/maintainer) unless you want the experimental feature of the UI designer or to have a project view of files, which only does it one way. I haven't had much time to improve the app, but it is on my radar for when I do free up time. I have a release plan for features, but would probably focus on autocomplete stuff next -- but really that would be months out.

Regarding will your python book help you -- it probably won't help too much except maybe for syntax or learning concepts in a general way. Really, the .Net framework is what you'll need to study and it is different enough from the Python Standard libraries that you'll have to learn which .Net classes map up to the python ones (so learning the same thing twice). So picking up a C# book would probably be more effective.
torial
 
Posts: 229
Location: IA

Re: Is Cobra and/or Naja appropriate for me?

Postby Zmeeed » Thu Feb 02, 2012 10:46 pm

torial wrote:Hi -- I can't speak too much on the functional programming paradigm, but you may find LINQ approaches to be fitting what you need. As I understand it, there are many aspects of functional programming paradigm bottled up in a proper LINQ approach.


Thanks.

Really Naja doesn't offer much at this point over a glorified text editor like SCITE (I say this as the creator/maintainer) unless you want the experimental feature of the UI designer or to have a project view of files, which only does it one way.


My programs are divided into two types: those that have a console interface and those that have no user interface. All my programs are number-crunches.

I haven't had much time to improve the app, but it is on my radar for when I do free up time. I have a release plan for features, but would probably focus on autocomplete stuff next -- but really that would be months out.


I want to ride a horse and gallop off into the sunset right now! What is better in my situation, SharpDevelop or Visual Studio?

Regarding will your python book help you -- it probably won't help too much except maybe for syntax or learning concepts in a general way.


The main advantage of this book is that each chapter is accompanied by a simple but complete program. Do I understand correctly that these code examples to help as much as if they were written in BASIC?

Really, the .Net framework is what you'll need to study and it is different enough from the Python Standard libraries that you'll have to learn which .Net classes map up to the python ones (so learning the same thing twice).


I think I understand what you say. For example, I need algorithm - http://rosettacode.org/wiki/Combinations#Python
I can not use the first, the most trivial way, because the library "itertools" does not exist in Cobra.
I can use the second way, because it is "pythonic" and, consequently, "cobraic".
What about third way?

So picking up a C# book would probably be more effective.


I was hoping that I do not need other languages​​, because Сobra combines the advantages of many different languages​​.
It is easy to go from the house of reality to the forest of mathematics, but only few know how to go back. Hugo Steinhaus.
Zmeeed
 
Posts: 13
Location: Russia

Re: Is Cobra and/or Naja appropriate for me?

Postby Charles » Thu Feb 02, 2012 11:33 pm

Python, Cobra and C# have some functional type features in them, such as lambda expressions and the ability to pass references to functions/methods. However, they lack other functional features found in languages like F#, Ocaml and Haskell which emphasize functional programming first. Things like pattern matching and tail call optimizaton.

So whether or not you find the first three suitable for functional programming will depend on your requirements and preferences.

To learn Cobra see How to Learn Cobra including all the links on that page. And ask questions here.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Is Cobra and/or Naja appropriate for me?

Postby Charles » Thu Feb 02, 2012 11:48 pm

You may be able to port "combinations" to Cobra. Details of how "combinations" work are here:
http://docs.python.org/library/itertools.html#itertools.combinations

The Cobra way would be to add this as an extension method to anything enumerable like so:
extend IEnumerable<of T>
def combinations(r as int) as IList<of T>*
...

Another tip is that where Python writes a list comprehension like:
... pool(i) for i in indices ...

Cobra would write that expression as:
... for i in indices get pool(i) ...

Which is the same order as the for statement found in both Python and Cobra.

You can find examples of extending IEnumerable<of T> here (scroll down):
http://cobra-language.com/trac/cobra/browser/cobra/trunk/Source/Cobra.Lang/ExtendIEnumerable.cobra

I realize this is quite a challenge to learn the language, libraries, port advanced functions, etc. But the above information can at least get you started if you want to pursue it.

Or someone could hire me to port Python's itertools to Cobra's standard library. :mrgreen:
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Is Cobra and/or Naja appropriate for me?

Postby Zmeeed » Fri Feb 03, 2012 9:21 pm

Thanks. Yesterday I received that book of Python. I'm going to do the exercises in the Cobra. Somewhere I can publish my achievements? It will be interesting to someone? What kind of version control systems used by the majority of local residents?
It is easy to go from the house of reality to the forest of mathematics, but only few know how to go back. Hugo Steinhaus.
Zmeeed
 
Posts: 13
Location: Russia

Re: Is Cobra and/or Naja appropriate for me?

Postby Charles » Sat Feb 04, 2012 12:11 am

It's ultimately up to you, but posting here in the forums would be interesting because there could be discussion and refinements.

For source control, some of us are on https://bitbucket.org/ but really you can use whatever you like.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 5 guests