Wednesday, December 16, 2009

Making Merge, Revert and Branching Easier with SVN

In the latest release of JDeveloper (11.1.1.2.0) we've added new declarative UIs to help simplify those most crucial and complex of SVN tasks - Merging and Branching. These SVN operations can be tricky. They involve ensuring that you pick the correct location in your repository, the correct revision, and mistakes can be costly and time consuming to fix.

Take a look at the wizard below. This is available whether you choose Merge Working Copy or if you want to Merge a single file. My top tip is that you should almost always use Merge Working Copy, especially if you are working with ADF (Application Development Framework) as many of the XML metadata files for your application will have dependencies on Java files and ending up with missed or out of sync files on a merge of any sort can lead to problems.

In previous releases we simply gave you the ability to enter your URLs and revisions, almost as you would if using the command line to access SVN. But in JDeveloper we pride ourselves on providing declarative help for developers. This wizard is invoked from a checked out application context - so you are always working within your working copy.

In this first step you choose the type of merge you are undertaking, for instance Merge Selected Revision Range is used if you want to update a branch with changes from the trunk. Let's take a common scenario: User 1 is working on Branch 123_susan. She knows that primarily her work will not cause any conflict with other work on other branches or the trunk so she has not worried too much about merging the latest trunk code into her branch. However, she comes across a problem and asks User 2 to fix something in the trunk so she can progress. She is told the revision that contains the specific fix she needs so she uses Merge Selected Revision Range to get that revision into her branch. The dialog below shows the path to trunk/blues as the source and her working copy - her branch - is the destination for the merge.

The revision to be merged - 275 - was picked using the List Revisions dialog. This dialog is used whenever revisions need to be browsed or selected. Notice that selecting 275 in the top panel shows the details of that revision - the comments, the files, the action and the author
Now the user can complete move to step 3 of the wizard, choose other merge options and carry out a test merge to check her work and finally complete the merge of that one revision into her working copy. Finally, she will commit her working copy back to its branch on the repository as normal.

Once she has completed the work on her branch she will be ready to use the Re-integrate A Branch merge to get it back into the trunk of the development. As always, the way to do this is to carry out any merge into a local working copy and then commit. So the first step for the user is to do a final commit of her branch. At this stage she can remove her branched working copy as it is finished with. She checks out the latest trunk revision and now she is ready to merge her branch to her new (trunk) working copy. Let's look at that another way:

1. A branch is created from trunk
2. User 1 checks out working copy from branch and edits code
3. Commits back to branch periodically
4. User 2 commits revision 200 to trunk and User 1 merges that revision to the working copy
5. Finishes coding working copy and commits to branch
6. Checks out new working copy from trunk
7. Merges branch into working copy
8. Commits working copy back to trunk


Before Subversion 1.5 the merge of a single revision in step 4 would have caused problems when the final merge of the branch back to the trunk was done (step 7). But SVN now has merge tracking so it keeps track of the revisions that have already been merged so that the final merge of all revisions goes ahead without error.

The third merge option is Merge Two Different Trees. This allows you to compare two different branches and merge and differences back into your working copy. This is the most complicated and, I would say, the least used of the merges.

One final tip - what if you want to revert your working copy to a specific revision? Use the Merge Selected Revision Range option. In List Revisions select the range of revisions from the latest to the revision you want to revert to and click OK. This will enter the range. But the range list will be ascending - eg 258-359. To revert to revision 258 simply reverse the range order and hey presto! a revert back rather than a merge up will be done - try it out in the test merge panel to check it - and you're done!

Tuesday, December 15, 2009

Working with Versioned Database Models

What? 3 posts in 2 days? After months of silence? Isn't it amazing how time flies. Here in the JDeveloper Product Management group we've been busy all year with releases and conferences and many opportunities to get out and talk to people about the great features in our tool. But as the year draws nearer to a close and all the traveling is over I've finally got time to get out on my blog some of the things that I've been evangelizing about all year. As you'll have noticed, one of those is the great new functionality that we've introduced in database modeling.

Periodically I'm asked why we don't introduce a database repository to store database models. One that can be queried and can store versions of the modeled objects? We've been down that road (those of you who've been around for a while know what I'm talking about!) but think that what we have now in JDeveloper is much more flexible. What is it that you want from a repository? Amongst the most important answers to that question is the ability to store multiple versions of your database objects, to query and to compare them.

In previous posts I've demonstrated how you can use our Database Reporting to query your database models and output the results. In this post I want to show you how you can use JDeveloper's integrated versioning system capabilities not only to maintain multiple versions of your database model but how you can resolve any conflicts that arise when multiple users update the model, using a declarative interface.

In this example I am using Subversion (SVN), one of the versioning systems that is integrated in JDeveloper. It is an open source system, widely used in the application development world. I am not going to step through a complete process for versioning in this post, there are various tutorials, how-to, demos. white papers available on OTN and if you want more information on SVN there is a very good online book.


Here is a part of my application. Note that it contains an offline database model (Blues) and one schema (GOTTHEBLUES) containing a number of database objects. This is a project that I'm currently working on. It is stored in an SVN repository - each of the objects has a revision number next to it. Notice that the PERSONS table is at version 378. In SVN the repository revision number is advanced each time a check in of files is done. So this does not mean that the PERSONS table has been checked in 378 times, it shows that the last time PERSONS was checked in the repository moved to version 378. Likewise the last revision of PUBLICATIONS is 258, so PUBLICATIONS has not been changed since revision 258.

If I open PERSONS from the navigator - I get the declarative UI that allows me to edit that object. But that is not how the information is stored. JDeveloper stores its database models by object - in XML. Below is an extract of what you would see if you opened the underlying file PERSONS.table in a browser.


It's not impossible to read - the extract shows the detail for column LAST_NAME, a VARCHAR2 of length 25, with a comment that it was created via a DB Transform (from a class model). However, the declarative UI abstracts you from the raw XML.


But imagine if you needed to compare two versions of the PERSONS table - or you had two users who were both working on the PERSONS table and checked in their changes to the SVN repository? Comparing the raw XML files is possible, and JDeveloper does recognize XML formating, but in the latest version of JDeveloper (11.1.1.2.0) there is a new declarative UI for that too.

Imagine this scenario: two users have checked out the latest version of the application. SVN uses a copy-modify-merge versioning approach. This means that when an application is checked out a copy of that application is created on the user's local machine. SVN does not keep a record of who and where copies are checked out. It is only interested when something is commited back to the repository. So, as a user I can check out a working copy, make changes to it and if I never commit those changes back to the repository, so be it. I could do some 'what if' type coding and then decide to discard the whole copy.

In my scenario the two users have been discussing the PERSONS table and agree that the length of the LAST_NAME column is too short at 25. Unfortunately, they both decided to modify the column length in their working copy. User 1 happens to be the first to commit her changes back to the repository - so it now has LAST_NAME with a length of 50.

Now user 2 modifies her working copy, editing LAST_NAME to length 40. As good practice dictates, she Updates her working copy with the latest revision from the repository - so she can resolve any code conflicts in her working copy prior to merging her copy back in.

In this case she finds that she has a conflict between her code and the repository that JDeveloper cannot resolve automatically. She sees this in her Application Navigator. It shows the PERSON table with a conflict overlay and the differing versions of the table are also listed (see below)


But help is at hand. Double-clicking on PERSONS 379 opens the three-panel Merge window. On the left is her local version of PERSONS - with length 40, on the right is the repository version with length 50. After reviewing this she has shuffled her version into the middle Result of Merge panel. As that was the only conflict in the two files the Save and Complete Merge icon is enabled in the toolbar.
Once she saves this merge and refreshes the Application Navigator the extra conflict files will disappear and the updates will be applied to her working copy. Now she is ready to commit her working copy back to the repository so that it reflects the latest code position.

Not all changes made by multiple users cause conflicts. If the changes are complimentary - for instance one user adds a new column LOCATION and another uses changes the type of PERSONS_TYPE these changes will be added to the repository as SVN and JDeveloper recognize that there is no conflict. This is how SVN works by default, copy-modfy-merge in action. Many systems work this way, and others use the lock-modify-unlock paradigm.

If you want to review changes to a database object prior to updating your working copy, you can use one of the Compare options (Compare with Latest, with Previous, with Other Revision) before you update your working copy with the repository contents. In the example below, user 1 has used Compare with Latest to check her changes: A change to the size of FIRST_NAME and a new column COUNTRY - as shown in the right hand panel with the latest version in the repository (as shown in the left hand panel).


Finally, in this post, a short list of other tips
  • Using Compare with Other Revision don't forget to scroll to the right - and see not only revision numbers but the commit notes. Also use the filters optimize the revisions listed


  • If you make changes to a file but want to revert back to the version you checked out from the repository - use menu Versioning - Revert

  • Use the graphical Version Tree to review branches and versions of your objects


Visualizing the DB Reporting Metamodel

In my last post I gave examples of using both the pre-built reports and building custom reports on your database models.
As a P.S. to that post I want to point you to the JDeveloper Help system that comes with diagrams to help you define and understand the Database Reporting metamodel. Below is the JDEV table of contents - open at Working with Database Reports


and one small part of the Tables Report Metamodel to give you the idea. Have fun!

Monday, December 14, 2009

Using Database Reporting to Ensure Standards Compliance

In JDeveloper 11gR1 we introduced a SQL-like interface for reporting on your database models. Watch this demo to review the basic functionality. In the latest release we've added a set of pre-built reports. These reports not only get you started with reporting but also illustrate how you can use database reporting to ensure that the objects in your offline database model comply with your team's naming standards.

I say SQL-like interface because the database model you develop offline in JDeveloper is stored in XML. However, we took the decision that as most database developers are familiar with SQL it made perfect sense to provide a familiar way to interrogate the model. For instance, the pre-built report to list all tables with no Primary Key is:

SELECT
T.SCHEMA '.' T.NAME "Table"
FROM
DB_PKCONSTRAINTS C RIGHT JOIN DB_TABLES T ON C.PARENT_ID = T.ID
WHERE
C.NAME IS NULL


As you get more familiar with the meta-model you might write your own SQL queries, but there is also a declarative UI to help you traverse the model and develop the query you want.
Below is an image of the wizard, showing how the FROM clause for the above query is selected. You can also select the objects, apply different JOINs, add a WHERE, GROUP BY and aliases using the declarative UI.




Here is an example of a more complex SQL query - to report on any tables that do not have the audit column CREATION_DATE*

SELECT T.NAME FROM DB_TABLES T
WHERE NOT EXISTS
SELECT 1 FROM DB_COLUMNS C WHERE C.PARENT_ID = T.ID
AND C.NAME = 'CREATION_DATE')



Now the world is your reporting oyster - how about creating a series of reports in a Standards Project - and distributing that project to every team that is doing database development? Here is one approach:
  1. Check the Standards Project out of source control into the required application
  2. In the Standards Project open the Project Properties, in Project Source Paths select the Offline Database node
  3. Add the projects containing your database model project(s) - see image below

  4. Open each report (double-click) and select the offline database you want to run against
  5. Go to the Publish tab and enter the details of how and where you want the report to be save. In the example below I've chosen to save the report in the project that contains the database - so my audit reports can be shown to represent my offline DB Model.
  6. Use the context menu of the report format to Run the report. In my example the HTML version of the report (AuditTableCheck) is now stored in Project1 along with the database, the report format (Check_Audit_Tables) is stored in the Standards project along with the other report formats.

Let me know how you get on - it would be good to build up a list of reports written by you that could be shared with others.

*For a full example of using this in a tutorial see this Oracle By Example

Monday, September 21, 2009

Announcing new Oracle Development SIG in the UK

On the 27th of October, the UKOUG are launching a new Development SIG aimed at any developer who is developing using Oracle tools and technology. The first special interest group (SIG) will have a "modernization" theme to it and covers topics as including Apex, SOA, Forms, Designer and JDeveloper.

A full SIG agenda is published here.

As usual with these events, space is limited and given the wealth of experienced presenters and topics, it should serve as a great learning opportunity as well as the chance to exchange ideas and meet with fellow developers.

Monday, July 20, 2009

Team Productivity Center Tutorial Published

There is now an Oracle By Example (OBE) tutorial available for TPC. It takes you through a number of topics including, on the admin side, setting up teams and integrating with repositories and, as a TPC user, querying repositories and creating relationships and tagging items across repositories.

It assumes that you have already installed or have access to TPC on the server. If not, here are instructions on doing that. The OBE includes images and examples using JIRA and MS Project Server but for a tutorial on the Rally Software integration, explore their site

And, as always, give me your feedback!

Thursday, July 16, 2009

Connecting with Team Productivity Center

Well, it's been quite a couple of weeks. TPC was featured in the developer tools section of the Fusion Middleware 11g launch and got some good press coverage (for instance eWeek) and the bloggers were our in force. You can watch the launch and see Duncan Mills use TPC in his demo. He has also recorded an Oracle Videocast and Podcast introducing TPC.

My aim is to get as many users to download and use it as possible (actually, that is every Product Manager's aim for their product!) That is going well, but I could do with your help to get the news out there. The ALM repositories we integrate with currently are all leaders in their field. The JIRA integration is a great productivity booster and the more I work with JIRA the more I realise how flexible it is. Microsoft Project Server is widely used in enterprise organisations and Rally Software is a world leader in agile development.

We are working on additional connectors (more news on that when I can divulge more) but there is always room for more. I'd love to hear from you on what ALM repositories you would like to see TPC integrate with. I'd love to hear from you if you have an internal system you would like to write a connector to integrate it with TPC. In fact, I'd love to hear from you in any capacity concerning TPC - and that, of course, includes those of you who have reported bugs too ;-)

John Stegeman, an Oracle Ace Director, is interested in creating a connector to TRAC. He announced this with a JDeveloper forum post saying, " I've been thinking about writing a connector for an issue management system that I use (of course, there had to be a selfish reason), TRAC. I think an ideal way to do this would be with a small team of developers working together on the new sample code site hosted by Oracle (http://www.samplecode.oracle.com). "

I think this is a great idea. It would be about a month of effort and you would get the opportunity not only to get to know our connector framework but to work as part of a small team and gain experience to perhaps go on to creating a connector for something within your own organisation. You can contact John through the forum post. I would highly recommend it (well, I would, wouldn't I?)

So, download, use, report, connect, and code - yep, that about covers it!

Wednesday, July 01, 2009

Introducing Oracle Team Productivity Center

Today is an exciting day for me. It's the launch of Oracle Fusion Middleware 11g in the USA and tomorrow the launch event comes to London. Included in this launch is, of course, Oracle JDeveloper 11gR1.

For some time I've been working on a new aspect of JDeveloper - Oracle Team Productivity Center. It is our first release of functionality to enable better Application Lifecycle Management for JDeveloper users and it is included in Oracle JDeveloper 11gR1.

TPC introduces the Team Navigator to JDeveloper. Through this navigator I can set up my team and user structure, applying team roles to users in teams/projects. I can connect to my existing ALM repositories and query/update artifacts in those repositories while working in JDeveloper.



In addition I can contextually link artifacts from different ALM repositories together - so I can create a relationship between a requirement defined in JIRA and a task in MS Project Server and I can tag items (needs a use case, ready for code review etc.) that are either visible to me or to all the members of my team. And I can be a member of multiple teams too. If I'm working on one task and am asked to switch to some other piece of code I can save the state of my development files open in the IDE against a specific work item. Work item is the generic term we give to any ALM artifact queried from an integrated ALM repository. So in the example below, I am working on a JIRA issue - SSTORE-23. If I Save Context I will save the Business Component files open in the editor along with the position and sizing of all the other JDeveloper windows. Then when I come back to this piece of work I can re-open SSTORE and Restore Context - to return my IDE to the saved state. Another great productivity booster!



A database is used to store queries, relationships, tags etc and managed by a small JEE application. This is set up by the installer and the client-side workings are downloaded through the normal Check For Updates Center in JDeveloper.

In this first release, in addition to the adaptors developed by us to connect to JIRA and MS Project Server I'm really pleased that we have partnered with Rally Software.

Rally is the leader in Agile application lifecycle management (ALM) dedicated to making distributed development organizations faster and leaner by dramatically cutting the time, cost and effort needed to deliver high quality applications. Rally's products were honored with four consecutive Jolt awards (the software industry's equivalent of the Oscar® award) in 2006, 2007, 2008 and 2009. The company's end-to-end solutions for Agile development also include Agile University, the largest source for Agile training, and Agile Commons, the largest collaborative Web 2.0 community dedicated to advancing software agility. Using the Rally Connector JDeveloper users can view and update their Rally tasks and defects directly from JDeveloper.

This release of TPC concentrates on enabling JDeveloper users, but Application Lifecycle Management is about more than just developers - it has a role in breaking down functional silos (development, QA, Doc, PM....) and it's our aim to push TPC out to more than developers going forward - both in terms of increased services provided by TPC and increasing the number of connectors available to differing ALM repositories (requirements, task, defects, testing etc)

One step towards that goal is the provision of a Connector Developers Guide and a sample connector to allow other third parties to create connectors to their existing ALM tools - be those commercial products or in-house systems.

But that's not all - JDeveloper users can also integrate their XMPP chat system into JDeveloper - even more productivity for developers without the need to leave their IDE! I can who of my team mates is connected to chat and also chat with all my buddies - whether they are working with TPC or not.

This is just a very brief introduction to Team Productivity Center. Browse the link above for more information, download, install and try it out - and let me know what you think ;-)

Saturday, June 13, 2009

ODTUG 2009

I can hardly believe it's another year (of few posts to my blog) and another ODTUG Kaleidoscope conference is almost upon us. This year the conference is in Monterey so I'm packing my bags and off to Oracle Headquarters in San Francisco tomorrow - then down to the conference on June 20th

If you have the opportunity I'd urge you to try and make it there too. The 'fun' starts off on Saturday when there is a community service day. Last year we painted school classrooms in New Orleans, this year we are helping to restore habitat at Martin Dunes, California’s largest and most intact dune ecosystem. So I'm packing plenty of sunscreen as my pale English skin isn't used to the California sun! More fun after the first day of sessions Sunday - with the second ODTUG Jam Session. Those of you who know Grant Ronald and I know that we are much too shy and retiring to join in that ;-)

But of course, that's not all the fun. The conference is full of interesting and diverse sessions - and I should know, I was part of the panel reviewing papers for the Editor's Choice award - I spent a few evenings reading papers on everything from project management to Oracle to the Holy Grail.

As for me, I'm really excited to be doing two sessions -

5000 tables, 100 schemas, 2000 developers: This will showcase some of the team-working features such as standards and version management, and reporting and impact analysis and the highly usable and scalable data modeling in JDeveloper. I've got some great new functionality to reveal - reporting on your data models, user defined validation and declarative compare of versioned database objects

Tooling up for ALM 2.0 with Oracle Team Productivity Center: If you were lucky enough to be at Oracle World or the UK Oracle User Group conference last year you might have seen a very early incarnation of this project that I've been working on. At ODTUG I'm going to be demoing the very latest code and showing you how to use your ALM repositories from within JDeveloper and how to integrate artifacts from those (maybe) disparate repositories together through Oracle Team Productivity Center. All this and team management too!

Another goal I have for the conference week is to talk to as many JDeveloper users as possible about team working, ALM and SDLC - and to ensure that I get feedback to take back and work on more functionality in JDeveloper to compliment the great application development tool we have

I look forward to seeing you there - or if not, finding other ways to talk to you!


Back to Top

Tuesday, August 12, 2008

DD Tips and Techniques - 2 Displaying Shapes

When I said occasional in the last blog - I didn't specify the time interval - so here is a second post in as many minutes!

There are a number of ways to tidy a cluttered diagram. Sometimes you don't want to see all the columns/constraints in the table shape, or perhaps you only want to see some of the columns - the keys or the most important columns:

View As -> Compact
Select shapes in a diagram and use this context menu to completely remove any columns or constraints from the shape

Hide Selected Shapes
If you want to show only some of the members of your shape (for instance only the keys and major columns in a table) select members you want to hide and use this context menu. The members are cut from the diagram but are still available to you through the shape editor. To see all the members again use Show All Hidden Members

Tools -> Preferences -> Diagrams -> Database
Under this node you will find many different options for your database diagram - you can change font, shape colors for many different database shapes. For instance - select Table from the dropdown list and uncheck Show Constraints if you want to exclude them from the diagram. Note that changes made in this way only apply to new shapes added to a diagram. So it's good practice to check your preferences before you start work on a diagram



Database Diagramming Tips and Techniques - 1 Keyboard Accelerators

I'm working on a new database design and thought I'd pass on some of the tips that I use to aid my work. As always with my blog entries, this will be an occasional series.

Keyboard Accelerators - diagram cleaning aid

I often create new offline database tables using a database diagram. I can visualize and edit objects in-place easily and often. But having to resize the shapes and tidy up the relationship lines can be very frustrating! So I do the following:

First the setup -
Go into Tools -> Preferences -> Accelerators
Scroll down the Actions list and select Height and Width
Add a new accelerator (if none set) - I use Ctrl H
Scroll to Select All and check what accelerator is set - default is Ctrl A
Scroll to Straighten Lines and add an accelerator - say Ctrl L

Now, in my diagram whenever I can't see all the info in my table shapes I either select the specific tables and do Ctrl H or do Ctrl A + Ctrl H to resize all my shapes followed by Ctrl L to straighten the lines.

Easy Tip No1!

Monday, June 09, 2008

Checking who else has checked out?

A comment on an earlier post has prompted me to clarify the way that Subversion handles certain tasks. The commenter is using SQLDeveloper, that uses JDeveloper's SVN implementation, and wants-

1. Subversion navigator to indicate if others are working on the same code

Subversion uses the copy-modify-merge paradigm. This means that any user with the correct authorization can check out a copy of the code from the repository to a local file system. This local copy can be manipulated (using JDEV, Tortoise, command line etc) so that updates and commits can be carried out from it. However, the Subversion repository does not have any understanding of how many users are working on or have checked out the same code. Updates and Commits are instigated from the local copy. This also means that any local copy checked out from Subversion may never be checked back in.

2.When double clicking on a package in the database or in the versioning tree and have the option to load the local copy (linked to subversion).

With respect to the request to double click on the versioning tree this comes back to Subversion having no knowledge of the local copies. I think that he is asking that the local copy be updated through using the Subversion navigator - but updates are driven from the local copy, not the repository.

As for the database package, that would be another level of complexity. Presumably the single point of truth is the package definition held in the SVN repository. To ensure that the database holds the latest version the user would have to checkout a the latest version as a local copy from the repository and update the DB. I'm not sure that somehow automating this process would be desirable - it would need links from the DB to the tool to the correct local copy location and through this to the SVN repository - sounds error prone to me.

3. Be able to do a compile and see the log window

This is a SQL Developer question, rather than SVN oriented, so I'll leave that to my colleagues with SQLDeveloper to answer.

Friday, June 06, 2008

Going To New Orleans - ODTUG Kalaidoscope 2008

I've traveled and spoken on Oracle all around the world at many events but this year will be my first at ODTUG (June 15th-19th). I'm looking forward to both the technical and the non-technical aspects of the conference. New Orleans is somewhere that I haven't visited in 15 years and I'm happy to be one of the nearly-75 strong ODTUG Brigade volunteering for a day of community service work to give back to the city that has given so much to music lovers and so many others like me.

The conference is packed with keynotes and sessions, I'm going to be presenting two:
Who Moved My Code? - Team Development in Oracle JDeveloper on Wednesday 8.00-9.00am
Seven Secrets (and more) of Successful JDeveloper Database Designers on Wednesday 2.45-3.45pm

Both of these will be predominantly demo driven sessions. In the first Lynn Munsinger will be joining me so we can demo multi-developer tips and tricks using Subversion. The Seven Secrets will focus on existing and new features for database development and visualization for application developers. I'm hoping also to squeeze in a sneak preview of a project I'm working on around Application Lifecycle Management. Please join me if you are at ODTUG as I would welcome your feedback.

Our Usability Research Team is running some feedback sessions that Lynn, Grant Ronald and myself will be attending, be sure and sign up for one of those. Plus, if you want to talk to us about any aspect of JDeveloper we will be in the exhibit halls ready and willing to demo and discuss.

Finally, I hear there is a ODTUG Jam Session and I'm pretty sure I wont be able to resist!

New Best Practices Paper for Subversion and JDeveloper

I've finally got around to pulling together some of the information and best practices that I've blogged about into a document. You can view it here on Oracle Technology Network. Let me know what you think

Tuesday, April 22, 2008

ALM - help me help you!

Some of the areas that I've always been interested in - as a consultant, a teacher, a curriculum developer or as a Product Manager - are standards, methodology and development process: From Designer to JDEV, from CDM to Agile, from ClearCase to SVN, from IE to UML and so much more. Now we call that ALM - Application Lifecycle Management - the management of the lifecycle development practices (requirements, build, test, change control, defect mgmt etc) fused together through application of process, reporting, traceability and collaboration.

Here in JDeveloper land we are always looking at ways to improve both our tooling and the developer experience so I've put together a survey to find out what ALM tools you are using today. We're looking into adding better integration with ALM tools and the results of the survey will ensure that we move in the right direction.

So please, take a couple of minutes to complete this quick online survey and help me help you!

Friday, February 08, 2008

Evil Clones - The SCM nightmare that can stop you in your tracks

It can happen to anyone. First the feeling of disbelief, then the cold sweat; you try pinching yourself, hoping it's some bad dream and you'll wake up and they'll be gone . . .

There, that's my catchy first line of my first novel written, now just the other 150 pages to invent. But unfortunately it really can happen to you - if you are working with ClearCase you may have come across evil twins. But I want to talk about a different nightmare that can occur if you are using SVN or CVS.

Here's the scenario. You and a team member are both working on a file (let's call it MyClass1) checked out of SVN.







Your colleague, as part of her edits, renames MyClass1 to CloneClass1 and commits the working copy.







SVN uses copy/delete commands for a rename:
First MyClass1 is copied (so that the history is maintained) to CloneClass1.
Then MyClass1 is deleted from the repository.
The screenshot of the SVN repository (left) shows the new resulting file with CloneClass1.

CVS is not quite so clever is uses add/delete: It adds CloneClass1 and deletes MyClass1 - so none of the history of MyClass1 is copied to the new CloneClass1.

But back to the SVN example. You have edited the checked out MyClass1 and are oblivious to your team member's edits. Not a problem, you might think as an update from the repository would absorb the changes or at the very least show you a conflict over the rename. Unfortunately not!

Here is where the nightmare that I'm calling Evil Clones appears.

The repository rightly updates your working copy with CloneClass1. But wait, your class MyClass1 is not only still in your App Navigator, but is no longer under version control!







If you think about it, this is correct -
  • SVN has replaced MyClass1 with CloneClass1. It has no recollection of the object MyClass1 so there is no merge of MyClass1 and CloneClass1.
  • You wouldn't want to lose the additional changes you have made to MyClass1 in your working copy - and it is not under version control - well, it's not, because it doesn't exist in the SVN repository
  • You can easily recognize that MyClass1 has been replaced by CloneClass1 so it's a simple job to move your changes to CloneClass1 - or is it. . .
This is expected behavior from Subversion and it seems that they recognize it as a bug . The example above is very simple. But what when you have 00s of different files in your working copy?

I'd be interested in how you work around this shortcoming in SVN. Here are some of my thoughts:
  • Don't rename, if you think you must, think again!
  • If you must, then refactoring or plain renaming of files (this is not specifically a Java problem, could be XML metadata, diagram or any other file type) should always be taken seriously in team development. In our JDeveloper development teams it's usual for the developer thinking about renames to email colleagues, check for dependencies and most definitely comment both the code, the check-in and the build notes to minimize the possible problems.
  • How renaming is handled in your team should be part of your defined development process. It should take account of your source code system, your build system and provide workarounds as necessary
  • If you are using JDeveloper and find that one of your objects appears to 'lose' its versioning status after an update - think rename!
  • Always ensure that you fully comment a rename on commit so that other users can use the log to find out where and why their object was deleted from the repository
In a forthcoming post I want to look more closely at how you detect and work to correct a rename problem. Specifically I want to use JDEV's offline database objects to do this. In the Java world developers may be more aware of the power of refactoring. But, as I said above, this is not a problem restricted to Java. I want to highlight the effect on XML and database objects.

At what level should I version my source code? - Alternate Takes

So now you know that I'm a Blues fan. One of Blues most revered artists was Robert Johnson. There are only a very few recordings of him - done between 1937 and '39 - just 29 different songs, but there are alternate takes bringing his total recordings to around 40 songs. Maybe he was striving for perfection, maybe different styles suited different audiences or even his moods, but these alternate takes add to the legacy left by him. Some blues fans have their own favorites but I love them all!

Recently I've been speaking with a number of JDeveloper/SVN users concerning the level at which they version their code. While I still maintain that the best way is to create a working copy at the Application level there are times and development process requirements when this isn't practical or possible.

Take this example: A team development with one Application split into many Projects. The Application is under source control using SVN. Their development process mandates commits are done per Project. There are a number of ways to achieve this, here are my suggestions for a team member to work on one or more projects and be selective about what is committed:

Alternate Take 1: Check-out each project as a separate working copy
  1. Create a new empty Application with no projects
  2. Use the SVN Navigator to select the root node of one of your projects in the repository
  3. Check this project out of the repository
  4. For the check-out destination, select the root folder of your newly created application
  5. You will get a warning on the Confirm Check Out dialog that you have selected a directory that is not empty - this is OK
  6. Continue to check out projects under your application root folder

  7. Now you can use JDeveloper's Commit Working Copy command on any node in a specific project and that project's changes will be committed.
Alternate Take 2: Filter the Outgoing Pending Changes Window

Using JDeveloper 11g you can filter the Pending Changes window by application or project. In the screen shot below I've filtered my outgoing changes to myProject1. I can select one or more of these files and with the context menu Commit Working Copy or Commit. I'd choose to select all the files and Commit if I had checked out my Application as the working copy. I'd choose Commit Working Copy if I had used Alternate Take1 to check out each project as a working copy. Unfortunately JDEV 10g doesn't have this filtering ability so this is an 11g only Alternate Take





I'm sure there are other Alternate Takes to both the level at which you version your code and how you manage checkin/out. I'd love to hear the good practices and the pitfalls.

Monday, January 14, 2008

I got tagged in the Oracle Blogsphere tag game by Shay Shmeltzer so here goes my entry of 8 things you didn't know about me.

1. In 1973 I was sent from Reading, UK to live on a cotton farm and attend high school in Arkansas, USA for a year by AFS Intercultural Scholarships. At the end of the year I was inducted as an Arkansas Traveler. Even now I drop into an Arkansas drawl the minute I reach the Delta - love it!

2. This started my love affair with Blues. It grew and developed after I met my husband, Scott, through his research for the original writers of songs recorded by such great guitarists as Rory Gallagher. In about 1986 during a blues festival holiday in Memphis (TN) we met some people who have become our great friends: David and Liz Berntson who, earlier in the year, had founded the Tulsa Blues Society. Also first met Paul Jones who was in Memphis to cover the festival for BBC Radio. As a result of these meetings we arrived home to find Paul had talked about our ideas on air and we started the British Blues Connection and the magazine Blueprint.

3. During over 10 years of the British Blues Connection and Blueprint, we became the first overseas Blues organization to be affiliated to the Blues Foundation and were Keeping The Blues Alive award winners in 1990. In the late 1990s we passed the UK blues gauntlet over to Blues In Britain

4. I love music, singing and dancing. From working the amateur chorus lines in productions like Lady Be Good in my 20s (when I was younger, thinner and more flexible!) to singing and dancing with blues men or my fab musical family or anyone who will let me. One of my special blues moments is dancing on stage with Willie Dixon when he presented us with our KBA Award in 1990. But it's not just about Blues, I love music - from Karaoke to Kraftwerk, Blues to Bartok and all the Kings (Elvis, Freddie, Albert, James, Frank, Bob ....)

5. I love to travel. I'm not sure I'll ever make the Traveler's Century Club (think I'm at about 35 currently) but I like to take every travel opportunity (whether work or leisure related!) Last year I added South Korea and China to my list and this year, as well as Europe and the USA, we will be in Rio to celebrate the wedding of our good friends: Blues man Alamo Leal and Mariza Lopez

6. My first personal computer was an Mac SE30 Bought this in 1989 when Blueprint became a magazine that could no longer be pasted and photocopied on my office copier but had to become more sophisticated as its readership grew. I learned how to use Adobe Pagemaker and spent many long, long nights waiting for the tiny screen to refresh as I moved across its 32 pages adding articles (Scott was the editor) and leaving space to paste in the photos. This was also the time of my introduction to 'programming'. I used spreadsheets and macros to maintain the subscription list and create mailing labels. At the time I thought I had designed a database!

7. Oracle is my second career. In my 20s I was a Financial Controller for a SME US company in the UK and started up subsidiaries in France and Germany for them. In my young, thrusting days I was even a finalist in the UK 'Young Career Woman of the Year' (can't remember which year - didn't get far). Later I took a Computer Science degree (for fun) and decided to try life at Oracle - the rest is history!

8. I have two favourite types of footwear! In the summer it's hard to imagine not being in flip-flops. I have many, many pairs - including High Havaianas that can make that awkward transition from shorts to cocktail dress ;-) In the winter I move into cowboy boots - the most comfortable footwear ever. But be sure to get a good brand. For me that has to be the Ariat.

So, if you see a flip-flop carrying, cowboy boot wearing, laptop hauling Oracle Product Manager demoing with blues-inspired examples - be sure to say "hi y'all"

I hate chain letters but who am I to deny you the opportunity to join the fun? So I tag Sue Harper, Kuassi Mensah, Doug Clarke, Eric Rajkovic, Brian Duff (sorry)

Monday, November 05, 2007

At what level should I version my source code?

This is a question that comes up regularly when I talk to development teams. And I believe that the answer should always be - at the top level.

If you are using JDeveloper this means at the application level. We adopt this in our own development here and it's my top tip for best practice. Some might want to argue that if their application is broken into a number of different projects then why not version those individually?

One problem with this approach could be cross- project dependencies in your application. Imagine that you work in one project on a day to day basic but there is a dependency on libraries held in another project (let's call it a 'library' project). You might checkout both projects at the beginning of the development cycle but assume that the 'library' project was complete and so you could just work and update your 'working' project. At some later stage, you could run into problems when you want to check in your 'working' project and realise that updates have been made to the 'library' project.

On a practical level, if you are using JDeveloper, you should not only follow my advice and version at the application level, but always ensure that your .jws configuration file is included in source control. This isn't a problem if you using JDeveloper's integrated SVN commands. When you select an application you automatically get the .jws file included.

But what if not all your development team are using JDeveloper? Perhaps you prefer to use Tortoise for your SVN interactions. Or perhaps you have some team members that use Eclipse or another IDE as well as JDeveloper? In this case it is important to ensure that you still place both your 'jws' and your 'jpr' files under source control.

Why? Because JDeveloper's SVN code looks at the state of those files to decide what menu options it makes available. For instance, say an initial import of an application to SVN had been done using Tortoise and the .jws file had not been included. I then check out this into a working copy in JDeveloper and make some changes. When I try to commit or update this working copy using JDeveloper I would expect to get the menu options 'Commit Working Copy' or 'Update Working Copy'. In fact, I would only see 'Import Files' as the .jws files would not be part of the versioned application and so JDeveloper offers you the option to place the application under version control.

I've come across this a few recently. The workaround is to go back to the repository and add the .jws file to version control. This brings the IDE back into kilter and allows you to continue using JDeveloper's integrated SVN support.

Wednesday, October 24, 2007

Connecting to CVS/SVN thru JDeveloper

Here is how simple it is to set up your CVS repository to work in JDeveloper 11g. The first step is to select your Versioning system. SVN and CVS are shipped with JDeveloper 11g. Other supported version control system can be downloaded via Check for Updates.
Now you can view the SVN or CVS Navigator from the View menu. Use the context menu of the parent node in the open navigator to create a new repository connection.
For CVS enter the details of your CVS repository in the wizard; including your access method and authentication style and user id (set by your CVS repository administrator). Test the connection and Finish the wizard. You are now able to browse the repository and Check Out a module using the context menu to begin work. To add a new application to the repository select Import Module from the Versioning menu.



For SVN enter the URL to the repository, user name and password, again Test the connection and click OK to complete the connection. As well as being able to browse the repository you can do other things such as create new remote directories from the context menu of the connection in the navigator.

To add a new application to the repository using either CVS or SVN, select Import Module from the Versioning menu.
By returning to the Versoning menu and selecting another version control system you can invoke the navigator for that system - without losing any of the connections you have to other systems.