D Development Process - module

What is the recommended development process for D programs that use packages that are cloned from github and separately built?
Typically in relation to how C/C++ projects are built using make, autotools, cmake, etc.
Most other build specifications have an install target. Should there be an install target in the build or should we just link a library directly from where it is placed when built and add register its includes in D_INCLUDE_PATH and then direct to them using DFLAGS=-I<D_INCLUDE_PATH>?

I realise my comment can actually be an answer to the question, so here it is:
D development process can't be different than similar in C or C++ world. Is that really difficult to see? Almost all C and C++ compilers generate "native" code. D is not an exception. There was the D.NET project that could target .NET, but it is inactive for years...
Furthermore, all tools used in C/C++ based projects can be easily used for anything else. CMake can be used in Java or .NET projects as well. Same goes for Make and/or Autotools. Why are Maven and Ant more popular in Java world is a different story.
Speaking about them, you can use Maven or Ant in the D development process! Hands down, you need to write your own Maven plugins to make it more easy and flexible, but it is doable, and would in fact be a very nice project.
From what I have seen, D programmers stick to the good, old Make, or write BASH script to do the whole thing. However, I've seen people from the Lycus foundation use WAF. If you are Python programmer, you will just LOVE WAF. If not, try similar things - I've seen people use SCons, Remake, Premake, etc...
DSSS+Rebuild is the closest thing to a very useful such tool made with D. Unfortunately they are dead projects. :(
I am working on a maven-style tool, but considering the amount of time I have - it will be usable in 2014. :)

I would go with scons, which has support for D, thanks to Russel Winder:
http://scons.tigris.org/ds/viewMessage.do?dsForumId=1268&dsMessageId=2959039
If not, then POM (plain old make).

Related

Compiling Objective-C app for Linux (API coverage)

I might be asking something strange here, but I'm unsure where to begin. The thing is that I am considering writing a command line tool on a Mac using Obj-C and the Foundation classes.
But there is a very big risk that I would like to be able to compile it for different Linux distributions to run as a server app in the future.
I understand that it is not a problem in itself to compile Objective-C for Linux, but what I don't understand is the API coverage.
As I have understood it so far I can use GNUStep to compile for linux, but is there a good way for me to get an overview of the API coverage? What I mean is, if I use a class that has been added to the Foundation framework in OSX Lion lets say, how big is the risk of that not being available in GNUStep at that time?
I hope I am asking a question that you guys can understand, basically I want to avoid writing an app that can theoretically be compiled for linux, but not in practice because of missing classes etc.
Thanks!
An opinion: The risk is fairly high. GNU Step is an open source project and dependant on its volunteers to keep it up to date. OS X Lion has a small number of additions to Foundation and AppKit.
Your best option if you want it for *nix in the future will be to write it in generic C/C++ and then thinly wrap it in an NSTask if you want a GUI.
You should be able to check if the API's you're using are available by consulting the GNUStep base API docs.
You may want to target GNUStep as your base if compatibillity is a big concern. Compiling for mac should then be rather trivial, compared to moving the code the other way. Of course you always have the option of helping inplement whatever is missing from GNUStep too.

Is there an automatic tool to find the DRY-ness of your code base?

I am a strong advocate of the DRY principle:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
Are there any tools that can test a code base for the amount of DRYness and both quantify and pinpoint specific examples for correction?
Simian
Simian (Similarity Analyser) identifies duplication in Java, C#, C,
C++, COBOL, Ruby, JSP, ASP, HTML, XML, Visual Basic, Groovy source
code and even plain text files. In fact, simian can be used on any
human readable files such as ini files, deployment descriptors, you
name it.
Simian runs natively in any .NET 1.1 or higher supported environment
and on any Java 5 or higher virtual machine, meaning Simian can be run
on just about any hardware and any operating system you can hope for.
Both the Java and .NET runtimes are included as part of the
distribution.
PMD's Copy Past Detector (CPD)
Duplicate code can be hard to find, especially in a large project. But
PMD's Copy/Paste Detector (CPD) can find it for you!
Note that CPD works with Java, JSP, C, C++, Fortran and PHP code.
You can run it commandline, there is an ANT task, and an Eclipse plugin.
Clone Detective for Visual Studio
Clone Detective is a Visual Studio integration that allows you to
analyze C# projects for source code that is duplicated somewhere else.
Having duplicates can easily lead to inconsistencies and often is an
indicator for poorly factored code.
See our CloneDR tool, which finds exact and near miss sets of duplicated code using computer langauge structure as guide. As well as detecting clones, it will show you a rough abstraction and the parameter bindings that explain the differences between the clone instances.
It has instantiations for many lanuages: C, C++, C#, Java, JavaScript, PHP, COBOL, Python, PLSQL, ... It tends to find 10-15% duplicated code across systems that have any serious size (e.g, 100K SLOC and above). There are sample reports for many languages at the web site, and you can download a trial copy.

How to build/test Scala without IDE dependence?

I'm well into learning Scala now and enjoying it very much; I hope to start future projects in it, rather than Java. What I'm enjoying less is the (relatively) poor IDE support. I've found both IDEA and Eclipse with the Scala Plugin (including nightly builds) to be a bit unreliable or difficult to use - I want something I can always depend on. E.g. yesterday I couldn't get a fresh install of eclipse+plugin to run my tests at all, or even open an editor window!
I'm considering hopping between Eclipse/IDEA depending on which suits the task at hand best and more importantly cutting my dependence on the IDE for building and running tests (ScalaTest). This is non-trivial for me since I've grown up on Java in Eclipse; leaving Eclipse SVN to use GIT was initially a big deal. Given that I only have time to learn one tool, should it be Ant, Maven, buildr, sbt,.... ? How do other people work?
I have used both Maven and sbt with Scala and found both of them pretty easy to use.
However, sbt feel much more closer to Scala as its build files are written in Scala itself (as opposed to XML in Maven) and sbt feature a build REPL, has continuous compilation and testing etc.
So I would advise you to use sbt for a simple Scala project.
But in case you want to create standard Java projects like WAR, EJB etc, I feel like Maven has a better support for them.
Also Maven has an enormous plugin ecosystem which enables you to do virtually everything, code coverage, reporting, code standard checking, documentation generation, and a lot more.
I'd use SBT with IDEA. Though I haven't tried it, I know there's some support for integration of SBT and IDEA.
Anyway, SBT is a great basis for all Scala building&testing needs.
EDIT: Uuuups. Sorry. Actually I misread your question and only commented on IDEs. When it comes to building the project I use make ;) because it is well integrated into Vim
while I wouldn't want to do ANY Java Project without IDE, I'm currently doing a fairly large project just in Vim. I know that's a quite a "stone-age approach" but it works just fine.
On one hand I was fed up by the buggy/slow/lacking Scala support of all IDEs. I tried Scala, netbeans and IDEA and found working with them (in Scala) rather painful.
On the other hand Scala has some properties that help when working with a simple Editor: you can have more classes in one file so I usually define a whole package in one file which again doesn't grow too large, since Scala class are usually very (or even extremely) small. So I usually have only two or three files open at a time and hence don't need a package/file management.
I couldn't get code folding by languages tags to work but folding by indentation works just fine if you stick to Scala's indentation conventions.
One thing that doesn't work is auto-completion. But then again, this makes me write more loosely coupled objects ;)
Buildr supports Scala and Java as first class languages, with support for ScalaCheck and ScalaSpecs, and of course also has enough plugins to make it a good contender for Maven.
Just adding my two cents. I think you should give Netbeans a try too. Its supposed to be the most Scala-friendly among the three major players (Eclipse, Idea and Netbeans).
I have been having a lot of fun with Netbeans 6.8 and scala-2.8.0.r22602-b20100720020114
It is fair to say that I wouldn't be programming Scala now if it hadn't been for the Netbeans plugin. I have spent a fair bit of time trying to get it to work as smoothly with the others, but without much success.
I use Netbeans for developing and Ant for standalone build. Info on configuring Ant for Scala here:
http://scriptlandia.blogspot.com/2007/04/how-to-compile-and-run-scala-program.html

Sharing logic across different platforms

We have a business logic that works with the file systems on OS that we want to implement on both Linux and Windows platforms. The language we have selected is Python for Linux and C# for Windows. GUI is not a priority for now. We were looking for ways to abstract the business logic in a way that we dont have to repeat the business logic (ofcourse I understand since it is related to file system, some code will differ from platform to platform).
Any ideas on how to implement it? Is C/C++ the only option. We dont want to use Java.
Thanks,
Pranz
yea, pick a common language for the logic first. Punting down in to C/C++ pretty much eliminates any of the real values to development that the Python and C# languages provide. Done write, MOST of your logic will be "Business Logic" with the rest glue to external services (i.e. databases, etc.).
So, you should pick a portable environment from the get go. Dropping down to C/C++ and linking it in is a viable alternative, but most likely not worth the time.
Mono is an option you'll probably want to look into.
Quote from the site for easy explanation:
Mono is a software platform designed to allow developers to easily create cross platform applications. Sponsored by Novell, Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime. A growing family of solutions and an active and enthusiastic contributing community is helping position Mono to become the leading choice for development of Linux applications.
Either use Mono or Python.
Mono allows you to run C# .NET code on both platforms. Python can be executed on both platforms already.
Qt has cross-platform libraries for all sorts of things, including UI and file system. It does, however, use C++.

Most appropriate platform independent development language

A project is looming whereby some code that I will be writing may be deployed on any hardware that potential clients happen to have. Its a business application that will be running 24/7 so I envisage that most of the host machines will be server type boxes but smaller clients might, for example, just have a simple PC.
A few more details about the code I will be writing:
There will be no GUI.
It will need to communicate with another bespoke 'black box' device over an Ethernet network.
It will need to communicate with a MySQL database somewhere on the network.
I don't have any performance concerns as a) the number of communications with the black box will be small, around 1 per second, and the amount of data exchanged will be tiny (around 1K each time), b) the number of read/writes with the database will be small, around 5 per minute, and again the amount of data exchanged will be tiny and c) the processing that needs to be performed is fairly simplistic.
Nothing I'm doing is very 'close to the metal' so I don't want to use languages that are too low level. Ease of development and ease of deployment are my main priorities.
I'm not expecting there to be a perfect solution so I can live with things like, for example, having to have slightly different configuration files for Windows machines than for Linux boxes etc. I would like to avoid having to compile the software for each host machine if possible though.
I would value your thoughts as to which development language you think is most suitable.
Cheers,
Jim
I'd go with a decent scripting language such as Python, Perl or Ruby personally. All of those have decent library support, can communicate easily with both local and remote MySQL databases and are pretty platform independent.
The first thing we need to know is what language skills you already have? This is likely to be a fairly big determiner of what choice you would ideally make.
If I was doing this I'd suggest Java for a couple of reasons:
It will run almost anywhere and meet the requirements you've outlined.
Its not an esoteric language so there will be plenty of developers.
I already know how to program in it!
Probably the most extensive library ecosystem of any of the development platforms.
Also note that you could write it in another language on the JVM if your more comfortable with Ruby or Python.
Sounds like Perl or Python would fit the bill perfectly. Which one you choose would depend on the expertise of the people building and supporting the system.
On the subject of scripting languages versus Java, I have been disappointed with developing command line tools using Java. You can't directly execute them, you have to (1) compile them and (2) write a shell script to execute the jar file, this script may differ between platforms. I recommend Python because it runs anywhere and it's got a great SQL library, mysql-python. The library is ready to use on Windows and Linux. Python also has a lot less boilerplate, you'll write fewer lines of code to do the same thing.
EDIT: when I talked about JARs being executable or not, I was talking about whether they are directly executable be the OS. You can, of course, double click on them to run them if your file manager is set up to do so. But when you're in a terminal window and you want to run a java program, you have to "java -jar myapp.jar" instead of the usual "./myapp.jar". In Python one just runs "./myapp.py" and doesn't have to worry about compiling or class paths.
If all platforms are standard PCs (or at least run Linux), then Python should be considered. You can compile it yourself if no package exists for your version. Also, you can strip the standard library easily from things that aren't available and which you don't need (sound support, for example).
Python doesn't need lots of resources, it's easy to learn and read.
If you know Perl, you can try that. If you don't use Perl on a daily basis, then don't. The Perl syntax is hard to remember and after a week, you'll wonder what the code did, even if you wrote it yourself.
Perl may be of help to you as it is available for many platforms and you can get almost any functionality by simply installing modules from CPAN.
Python or Java. They both are easy to deploy on both the server environments and the desktop environments you mention - i.e., Linux/Solaris and Windows.
Perl is also a nice choice, but it depends on how well you know Perl, how well other people that will maintain your code know Perl, and number of desktop users that are savvy enough to handle an install of the Windows Perl version(s).
As Java supports Python via Jython, I'd go with a JVM requirement myself, but I'd personally go with a Java application all the way for such a system you describe.
I would say use C or C++. They are platform independant, though you will have to compile for each platform.
Or use Java. That runs in a Virtual Machine so is truely cross platform and not a slow level as C.