Forums  > Software  > The D Language  
     
Page 1 of 2Goto to page: [1], 2 Next
Display using:  

Tradenator


Total Posts: 1599
Joined: Sep 2006
 
Posted: 2007-05-02 13:51
Does anyone have any experience with the D programming language?  Opinions please?

signalseeker


Total Posts: 237
Joined: Oct 2006
 
Posted: 2007-05-02 15:03
Though nothing to do with D, you may find this interesting.

I have looked at D before it did not seem "practical" (tools, libraries, middleware, books etc) enough for me yet. Also it is not too difficult to write python extensions in c/c++ wherever there is a need for speed and compatibility.

The dark is light enough.

Tradenator


Total Posts: 1599
Joined: Sep 2006
 
Posted: 2007-05-02 15:16

Interesting article.  I still have my vintage FORTRAN 77 text but people give me strange looks when I suggest using it.  It probably doesn't help that all my work looks like FORTRAN regardless of the language.

Anyway, does anyone else have anything to add about D?


Cheng


Total Posts: 2868
Joined: Feb 2005
 
Posted: 2007-05-02 15:28
Just a general observation. Over the last couple of years I saw tons of new languages popping up, some where really good. All claimed to be the better C/C++ or Modula-2 or [insert arbitrary name of commonly used programming language here] but most disasppeared since people stuck to what they know. I think it takes a couple of years to establish something really new, you need libraries, books and environments in which you can run the language. Imagine you have a fantastic piece of code written in XXX but no one but yourself can use ist. Time willl tell, but I am very cautios and in the meanwhile stick to what I know or what has been around for several years.

"No trade with death / No trade with arms / Dispense the war / Learn from the past"

tristanreid


Total Posts: 1677
Joined: Aug 2005
 
Posted: 2007-05-02 16:54

Cheng, I'm the same way.  I like to play around with languages, but unless they're fundamentally different in function there's rarely a point.

-t.


the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -comp.lang.lisp

Cheng


Total Posts: 2868
Joined: Feb 2005
 
Posted: 2007-05-02 17:07
but unless they're fundamentally different in function there's rarely a point

I think this observation is the key. When was the last time you saw a programming language that was fundamentaly different ? For me I think it was way before I started programming when OO languages entered the scene. Before we had LISP for the functional branch but to me it looks like all major theoretic streams are covered by more than enough languages and there is nothing new emerging.

"No trade with death / No trade with arms / Dispense the war / Learn from the past"

FDAXHunter
Founding Member

Total Posts: 8372
Joined: Mar 2004
 
Posted: 2007-05-02 19:21
I've looked at D earlier this year because I got intrigued. He's got some nice ideas, but to me, there are some issues that are not that well thought out. Others, are indeed nice. In either case, it's not groundbreaking, certainly and therefore the case to replace, say C# or Java, is just not there. One of its major problems, in my opinion is that there's way too much C legacy in there. Building a language to actually be compatible to another language still is just retarded. Imagine if you wanted to create a new "language language". Like a new way for people to communicate, but... wait for it... it had to be compatible to English still. What would that look like, ya think?

The main problem with this thing seems to be that its essentially a one man show. While a cool language is great, it only becomes widely adopted if there is enough man-power behind it.
Nowadays, a big part of a language is it's framework libraries. In the case of .NET and Java, there's hundreds of programmers at Microsoft / Sun that hammer this stuff out. And the landscape changes very quickly. People don't want a language anymore, they want a platform.
What good is a managed environment that can write inline assembly in, if you can't output/integrate with a web server, work with a database or do a dozen other things in a productive manner?

Finally, D has been in development for... wait for it: 10 years. Contrast this with C# which has been around for only 6 years and which is already in version 3. The language has evolved quite a bit and the focus shifted into a slightly more functional programming approach (more of that will surely appear in version 4). What's D going to do? To maintain the current pace in software evolution a seriously big player would have to get behind it. Like IBM for example. And it's not "great" enough to do that. The edge just isn't there.

You guys know that I'm always to be had for the latest nonsense and I'm well known to run with something in production that's still officially in "beta" (to the great horror of some people). But this thing I just don't see going nowhere slow. It's just not groundbreaking enough to generate enough interest, in my opinion. The lack of documentation/framework/support will do the rest.

The Figs Protocol.

Tradenator


Total Posts: 1599
Joined: Sep 2006
 
Posted: 2007-05-03 01:47

Sounds like the consensus is that D gets an F.  And Microsoft is unpalatable to us as far as this system goes.  We don't have any of that C/C++/C#/.Net baggage to cope with, thankfully.  We are just replacing an old pascal system that has worked well for many years but is being outgrown.  Python is the new platform, and we want to write the numerical stuff in something quicker (compiled).  Maybe I should seriously try FORTRAN again, or maybe its time to start using C. 


tristanreid


Total Posts: 1677
Joined: Aug 2005
 
Posted: 2007-05-03 02:23

If you're all learning Python anyway, have you checked out NumPy? 

http://numpy.scipy.org/

-t.


the only reason it would be easier to program in C is that you can't easily express complex problems in C, so you don't. -comp.lang.lisp

Tradenator


Total Posts: 1599
Joined: Sep 2006
 
Posted: 2007-05-03 02:37
Numpy/scipy is a good point, and a great package, and yes I am using it for some stuff.  It's good for generating the current day's positions but we still need to compile some things used for backtesting, though.

signalseeker


Total Posts: 237
Joined: Oct 2006
 
Posted: 2007-05-03 04:18
I am not sure what you mean...do you want to build a backtesting/simulation engine in python or just write mission critical parts in a faster language?

There are lots of options these days to integrate c/c++ with python like pyrex, psycho, weave, ctypes etc etc. Both python and even numpy have excellent c API's. I suggest that you consider that option.

On the other hand if you are looking to build an independant system and compatibility with python is not an issue, you should look at Java as well.

btw, you should check this out - http://www.lecturefox.com/blog/python-design-patterns-by-alex-martelli

The dark is light enough.

Cheng


Total Posts: 2868
Joined: Feb 2005
 
Posted: 2007-05-03 08:55
If you are used to Pascal and want something new and fancy why don't you try Oberon ? Big Smile

"No trade with death / No trade with arms / Dispense the war / Learn from the past"

FDAXHunter
Founding Member

Total Posts: 8372
Joined: Mar 2004
 
Posted: 2007-05-03 09:17
There's IronPython which leverages the power of .NET. I've read that some people consider that a lot better than the original Python.

The Figs Protocol.

Tradenator


Total Posts: 1599
Joined: Sep 2006
 
Posted: 2007-05-03 10:31

Thanks for all the responses.  I know there is a lot available in python, and we are already using numpy/scipy and some of the C integration stuff.  (Another guy, an actual professional programmer, is evaluating D.)  I was just looking for other opinions and got some good ones.  A common theme seems that nobody here seems to like D, perhaps at least partly because you are fluent in C/C++.  Anyway, thanks again for the opinions.


jslade


Total Posts: 1209
Joined: Feb 2007
 
Posted: 2007-05-04 12:39
The last time I had a legacy system in pascal, I piped it through p2c, got code which looked better than mine ever did, compiled it, and kept my customer happy forever (she's still happy, near as I can tell). Maybe you can do the same, and paste some python over it if you need some flash. Pascal's type safety and structure seems to loan itself to a pretty nice translation into C. Nicer than writing it in C would probably be.

D (which I never heard of until just now) looks like someone attacked C++ with Objective-C and a spork. Why, for god's sake?

Then again, I just went through learning a bit of OCaML, mostly because I think working in the same room with Sam Steingold would be pretty neat. Upsides: interactive top level, type safety, terse and quick, M$ seems to be getting behind it (F#), insanely fast if you understand things like tail recursion, multiparadigm. Downsides: crap IDE's, no libraries, little useful documentation, looks sort of like APL or something:

let haar l =
let rec aux l s d = match l, s, d with
[s], [], d -> s :: d
| [], s, d -> aux s [] d
| h1 :: h2 :: t, s, d -> aux t (h1 + h2 :: s) (h1 - h2 :: d)
| _ -> invalid_arg "haar" in
aux l [] [];;


"Learning, n. The kind of ignorance distinguishing the studious."

Nonius
Founding Member
Nonius Unbound
Total Posts: 12794
Joined: Mar 2004
 
Posted: 2016-07-31 11:09
sorry to bring up a very old thread. just was trying to find the right place to ask about how to do something in Python that I do in C# and I notice there are C# and Python guys in this thread.

So, I do these types of classes a fair amount in C# (by the way, it's annoying you can't paste in code and respect the indentations).

public sealed class Foobar
{
//stuff

public Foobar ()
{

//stuff that's read in from a file


}

public void Foo(){




}



private static readonly Foobar instance = new Foobar();

public static Foobar Instance
{
get
{
return instance;
}
}
}

so, in particular, in any part of my project I can do:

Foobar.Instance.Foo();

a Foobar object is only created once and I can reference it anywhere without having to pass it in as an argument to a method that needs it. examples of uses would be registering a method in an object as a delegate that's contained in Foobar and which is triggered when an event occurs.

how to do in Python?

Chiral is Tyler Durden

svisstack


Total Posts: 346
Joined: Feb 2014
 
Posted: 2016-07-31 11:15
it's just a singleton, http://python-3-patterns-idioms-test.readthedocs.io/en/latest/Singleton.html
but unfortunately if you are using it often it means code is improperly designed, so this can be something that usually people dont do and maybe dont know answer to your question

First Commander of the USS Enterprise

Nonius
Founding Member
Nonius Unbound
Total Posts: 12794
Joined: Mar 2004
 
Posted: 2016-07-31 11:17
Thanks Svisstack!

care to elaborate on your second comment?

Chiral is Tyler Durden

svisstack


Total Posts: 346
Joined: Feb 2014
 
Posted: 2016-07-31 12:06
singleton pattern is often named as anti-pattern, because improperly used it will make in future more harm than good,

using singleton you are introduces to application global state,

also is overused in places where should not be used and its result of pure bad object orientated design,

also it places unnecessary restrictions and making automating code testing complicated.

also its hard to debug code because you will need track what caused that singleton state

also you need to synchronize if using it from multi-threads.

for example singleton makes sense for database connection or for application configuration

First Commander of the USS Enterprise

svisstack


Total Posts: 346
Joined: Feb 2014
 
Posted: 2016-07-31 12:07
.

First Commander of the USS Enterprise

Nonius
Founding Member
Nonius Unbound
Total Posts: 12794
Joined: Mar 2004
 
Posted: 2016-07-31 12:10
thanks Svissstack, I read pretty much the same thing you just wrote (almost verbatim I might add) on Wikipedia.

In fact I am using it mostly for config type things as well as for database type things.

But thanks for the reference.

Chiral is Tyler Durden

EspressoLover


Total Posts: 432
Joined: Jan 2015
 
Posted: 2016-07-31 16:40
Using a singleton for a database connection is definitely a code smell. There's a number of good arguments why you should treat db conns as instances on a per-object basis:

1) Mocking and unit-testing is much easier to handle.
2) What if you want an application with multiple simultaneous connections?
3) Some database drivers are not thread-safe out-of-box and you're more likely to get in trouble with the singleton.
4) Dependencies between components are less transparent. That makes the architecture a lot less maintainable.

Not that the approach is always inadvisable. Particularly if you're rolling out a quick and dirty solution. But I'd say singletons for DBs (or configs) are at best a convenient evil.

Good questions outrank easy answers. -Paul Samuelson

svisstack


Total Posts: 346
Joined: Feb 2014
 
Posted: 2016-07-31 16:48
yes that is true, I also dont use singleton for database connection, but on level of this thread it is totally ok imho,

everything depends on scale even code accessing database can look totally different when you have few gb's vs few tb's,

nonius you must decide whats best for you

First Commander of the USS Enterprise

Nonius
Founding Member
Nonius Unbound
Total Posts: 12794
Joined: Mar 2004
 
Posted: 2016-08-01 22:54
sort of sick of "patterns". any you mofos cooked up some new patterns?

patterns is cookbook shit, no?

LOL

ok, EsspressoLover is clearly some high IQ polymath, that's for sure.

Chiral is Tyler Durden

svisstack


Total Posts: 346
Joined: Feb 2014
 
Posted: 2016-08-01 22:59
>> patterns is cookbooks shit, no?

totally not, dont fool yourself in it

>> ok, EsspressoLover is clearly some high IQ polymath, that's for sure.

agree

First Commander of the USS Enterprise
Previous Thread :: Next Thread 
Page 1 of 2Goto to page: [1], 2 Next