Code reuse tools - code-reuse

I usually maintain code snippets that I can resuse in a Wikidpad personal wiki with a small index page that can take me to any code that I want.
I want to share these snippets with my team and am looking for easy ways to do it.
Are there any tools that would help me setup such a repository? Or should I simply install a wiki and port my personal wiki there?
Thanks
Hari

Google Docs, perhaps? Search-ability is the key. No one has time to cross-index, keyword-stuff, and organize "snippets" into complex ontologies.
Also, remember that when someone reuses code, they also reuse the bugs, limitations, and performance issues you may have worked out in subsequent revisions. The best way to reuse code is not to copy it, but to document it and make it accessible for direct reuse.

Some IDEs have a code-snippet utility built into them. e.g. Visual Studio has Code Snippet Manager.
Or perhaps an addin like Resharper. My point being find something that integrates nicely with the IDE that your team uses.

Why not use code snipplr

An easy and reusable solution: a repository with web interface like subversion. Also Github can be a good option since you don't need installation

Related

Use one "main project" as source for many projects: how to do it best with GitHub?

I'm planning 3-4 Rails projects. All of them share some basic functionalities, and I want to use the same development tools (e.g. RSpec) for all of them. But I don't feel like configuring every project completely from the ground up.
So I'm thinking of starting with one "base project" in which I configure all needed tools, and then to create a fork of it for all of the "real" projects. Everything all projects share is developed within "base project" and then synced into the forks.
Is this a good idea? I know that there are other possibilities to share common code (like gems or even gemified engines), but for a fast start I think my idea is quite effective.
Anyone has done this before? With good or rather bad results?
Any other ideas or hints are highly appreciated.
Update
Damn it, I just found out that I can't fork a repository into its own repository. Hm, I think there's a reason why people don't seem to do this. But simply copy&paste a project doesn't seem useful to me, as I also want to get stuff from a "real project" back into the "base project" when I think that it's useful for all other projects, too. I could do that with creating patches and stuff, but this seems rather cumbersome.
Update
I found a quite easy way to fork own projects in the same repository: http://bitdrift.com/post/4534738938/fork-your-own-project-on-github
Look at the comments though, there the easiest method is described.
Templates
You should look at using templates -
an inbuilt Rails feature which allows you to define certain attributes of a project (gems etc), and then "inherit" them in other projects
I've never used them myself, so I can't provide any code right now, but the tutorial seems pretty good :)

How to integrate similar diagam functions in my delphi application?

I would like to use some diagrams/drawings similar to the picture below in my applications especially without having to pay for any third-party components. Any idea where to start ?
You may look at the JVCL JVDiagramShape.
You have a good example, in the \jvcl\examples\JvDiagramShape\2. UseCaseEditor directory created when you install the JVCL. Not as cool as your example but you may choose your own images.
You may found also another example with a WebMapper, in \jvcl\examples\JvDiagramShape\1. WebSiteScanner :

Do we have any code retrofit tools inbuilt for mainframe technologies like COBOL, JCL etc?

I hope what does retrofitting of code mean?
Since you checked-out the code from
prod, if any changes have been
deployed in prod, then retrofitting of
a code will add those changes to your
code to make your code deploy-ready.
Hope retrofitting is already known stuff. I know SUPERCE does in identifying the changes happened to code but do we have a tool which incorporated the changes automatically? Lemme know if you have a solution or question needs to be rephrased?
You can use the ISPF Editors "COMPARE" command. It will merge the changes in as info lines and you can use the makedata (MD in the prefix area) command to accept the changes.
Hope that helps.
Another option to consider is "Merge+Reconcile" from SERENA Software. It can compare up to 8 variations (derivatives) and uses an ISPF-editor like interface. If you're working on a huge merge, you may want to use its "Work In suspense" feature, where you save your intermediate results and come back on it at a later time to continue where you left of.
Refer to page 15 of this PDF for way more details.
My this has aged. When in parallel development (say multi year projects with multiple major releases in the pipeline).
The retrofit occurs when an accepted and implemented change needs to be shoehorned into the other arms, where code may not be identical prior to the change. It may not possible to automate.

Register applications via Registry table rather than TLBs

We register the capabilities of Delphi applications using TLB files. However, from reading MSDN documentation, "Installation package authors are strongly advised against using the TypeLib table. Instead, they should register type libraries by using the Registry table". Does anyone have any advice on how to do this in a 'Delphi' way for Windows 7?
It means you would need to figure out what registry entries to add to register the tlb. This explains what needs to be done. You could also use a tool like REGCAP.EXE which comes with Visual and generates a .reg file. If you use WiX to build your msi you could use tools like tallow and heat to let them generate the wix files for you.
I'm going to answer my own question! This is a duplicate of this question, which seems to have the answer I needed (just in a different language that I would normally use).

Single-user source control?

Searching with '[Delphi] "source control"' didn't return much, so here goes: For those of you Delphi programmers working on your own, what source control do you like? I know about TortoiseSVN (which can be used without a server), but I'd like to know if there are better options before choosing it.
Thank you.
SVN will be more than enough as you'll mostly use it for backing up and diff'ing versions.
You can use VisualSVN Server and TortoiseSVN with Delphi IDE Integration. All of these are freeware. If you wish to use any other freeware SCM with Delphi IDE integration you'll need to buy SourceConneXion or Athlant. Also, if you're using D2009 you'll need to convert strings to ansistrings in order to get TortoiseSVN addon for delphi to work.
I use Mercurial, and have used Bazaar and Perforce (free for small teams). All are good, but nowadays I tend to prefer Mercurial. Mercurial comes with its own tortoise
which, while not quite as polished as TortoiseSVN, is perfectly usable:
(source: sourceforge.net)
For users of RAD Studio XE or XE2, Uwe Schuster has published an IDE add-on called Version Insight Plus that adds Mercurial and Git support to the IDE's built in version control support.
For all the systems I have mentioned, no central server is required.
I would recommend Git which is free & open source and:
Doesn't require you to even set a central server even if you want add more developers or machines.
Is Extremely Fast (imo)
Encourages the use of branches
I use it for almost every new project, even when it's just me on the project. It's an extremely fast distributed version control system and was written by Linus Torvalds and is now used in high profile projects like the Linux Kernel and Ruby on Rails.
Git isn't hard to use from the Command line but also has it's own "Tortoise" package (TortoiseGit - albeit not as polished as it's SVN cousin).
SourceGear Vault is free for a single user. I like to use the external client because I work in different environments, but If you want Delphi IDE integration, you can use Source ConneXion (not free).
You might look at some of the responses here (Stack Overflow) if you do have Delphi in mind. As mentioned in the answers there, I use Team Coherence which integrates very nicely with Delphi's IDE, and is aware of Delphi file groups (.pas with .dfm etc). I think it's written in Delphi too.
Having said that, the other comments already made are true - you shouldn't really let your choice of language dictate your choice of VCS.
Even though you've said single user, I would look for a solution that allows you to easily host it on a server/other desktop machine, so you have separated your development machine from your source repository. I'm probably teaching granny to suck eggs but you ought to check that whatever you choose can be easily backed-up too (even to a USB key or external drive would be fine). :-)
I know you have asked for Source Control, but if you are always planning to be a 'single developer' you might like to consider an automatic backup solution like AJC Active Backup instead. Yes, you lose the ability to check in and out specific versions, but at the same time you avoid the need to check stuff in and out all the time when it is only you working on a project. And you can recover or diff any previous source files by date for as far back as you care to configure. It's very much a set-and-forget solution, until you need to recover something, when it is invaluable. And the archive itself can be backed up in the normal way.
I use TortoiseSVN, but store my repositories as files on my laptop (on a share that can be accessed by mutilple VMs), not managed by a server. This means that I have full access to the repository regardless of server access, but also allows me to easily backup the repositories to the company file server when connected.
Since I am the only programmer I have not needed a separate server so far. I have seen Nick Hodges (Delphi Development Manager) say very nice things about VisualSVN Server, and I aim to check this out, to see how easy it is to backup/restore the repository: if that can be automated, and done very quickly, then I will probably adopt that.
Longer term I am going to look at the various flavours of distributed VCS, as that may be better suited to multiple laptop-based developers; I'm not sure yet, as I've not reached that page of my to-do list ;-)
One of the things supposedly in the pipeline for Delphi is integrated support for VCS. I've no details on that, or on any implications for current users of the various traditional or distributed VCS.
The language you use doesn't really matter in the choice of the SCM you will use.
It can matter if your favorite IDE supports or not this SCM.
TortoiseSVN is just a svn client, if you choose svn you can have several client.
I use Tortoise, and subclipse for committing in the same svn repository.
I would suggest using SVN server on a separate machine (either VisualSVN as suggested before or CollabNET Subversion Server) and TortoiseSVN with JVCL integration expert (also as suggested before).
Besides getting all the good stuff from the version control, you'll also automatically have backup on a different computer, which is always a good thing.
I know this will get down voted, but I feel it has to be said.
I've used Version Control software for many years at my job, and it is required when multiple people work together - to make absolutely sure that no two people overwrite one-another's work.
But for my personal development at home I don't use one. I find them overbearing and inconvenient for a simple one-person project. And I've tried several packages including Source Gear Vault and some others that other people have mentioned.
What I do instead is at every significant change to my program that I might want to go back to, I make a copy of the entire program directory. If I screw up in the next change, I can go back to the copied directory.
I also permanently keep copies of all my directories of every release of my program. If I ever need to do comparisons between my current version and previous releases, or between two different previous releases, I use Beyond Compare by Scooter Software - a simply great tool for diff-ing and copying changes between versions. If you use Source Control software, Beyond Compare will integrate into it nicely.
So I mention this simply because I have often heard everyone pushing Version Control Software, even for the individual developer. For some of us, it's overkill.
You may want to consider this simpler solution.
I use Bazaar with Delphi and it works well, especially for solo developer workflows. It has it's own TortoiseBzr but it isn't as good as some of its cousins so I recommnend the excellent Bazaar Explorer instead. One of the great things about Bazaar is it's flexibility and the ease with which you can change workflow or include another developer in a project that started off solo.
A lot of articles about Bazaar will tell you it is a lot slower than Git or Mercurial. They are out of date, now it takes a similar time to acomplish operations as they do and is faster on some operations.
My team use StarTeam and I have never used something else like SVN so it is hard for me to do a good compare. Starteam has both positive and negative sides.
Pros:
You can register Change requests and
connect them to checkins. This make
changes more trackable.
I feel more comfortable with a real GUI compared to commandline or some Shell
extension.
Cons:
Expensive, as most products from
Borland...
Latest version use Java. It is almost like the previous Win32 version and they have added more features, but I still feel that it is some slower and more memory hungry than before.
GUI could be a bit more intuitive.
I'm not big on version control, but use SVN/Tortoise and am quite happy with it. The main benefits that I see for a single developer is being able check out older versions of the application, and use multiple computers for development (desktop / laptop) - other than the obvious backup benefit. I tend to not need it for diffing files, as I find the version control tools within the Delphi IDE fairly good for this - provided the "bug" was introduced recently.
I think most Delphi developers use SVN/Tortoise (making it a fairly safe choice) - but there are trendyer options such as Mercurial and Git.
As a single developer, I have used Perforce for a number of years. It has been great. Aside from a CLI, you can use the P4V client. There's also an explorer plugin available, as well as Delphi IDE integration. I actually just found this free integration on Torry yesterday:
p4delphi
I've installed it in Delphi 2010, and it works pretty good.
Perforce is free for two user, it would require you to install perforce server, but the server footprint is very, very small. you can use P4V (Perforce visual client) which is far more convenient than tortoise, it also provide Windows explorer extension to be have just as tortoise (but you could skip this installation). Delphi integration could be done using P4Delphi.
I am using subversion, bug tracking and simple to use project planning for my latest delphi project from an web service provider. http://www.unfuddle.com has a free account for projects less than 200mb with 1-2 developers and the user interface is easy to use.

Resources