Docstoc

Enterprise C++ Development and Deployment Solutions

Document Sample
Enterprise C++ Development and Deployment Solutions Powered By Docstoc
					Enterprise C++ Development and
Deployment Solutions:
A Technical Overview of Rogue Wave Software Products




                         WHITE PAPER
   Contents
                  .
      Introduction...................................................................................................................................................... 2

      Debunking.Some.Common.Misperceptions.About.C++.................................................................................. 3

      .      When.C++.is.the.Right.Tool.for.the.Job.................................................................................................. 4

      Rogue.Wave.Software.Product.Overview........................................................................................................ 5

                                                 .
      Professional.C++.Source.with.SourcePro®.C++.............................................................................................. 7

      Rogue.Wave.Hydra™..................................................................................................................................... 13

      .                                                   .
             Web.Service.Development.with.Rogue.Wave.Hydra. ........................................................................... 14

      .      Manipulating.XML.Data.with.HydraSDO............................................................................................. 18

      .      Beyond.Moore’s.Law............................................................................................................................. 20

      .      Challenges.with.Multi-Threading.and.Concurrency.............................................................................. 21

      Rogue.Wave.Hydra.and.Software.Pipelines.Scalability.Example.................................................................. 22

      .                                                                      .
             Bringing.Services.into.the.Service.Grid.with.Rogue.Wave.HydraSCA. ............................................... 24

      Summary......................................................................................................................................................... 28




WHITE PAPER                                                                                                                  PAGE 1
   Introduction
        Software.developers.today.are.under.constant.pressure.to.complete.projects.faster.while.building.scalable.
        solutions.that.can.be.deployed.across.a.myriad.of.platforms.and.easily.integrated.with.other.enterprise.
        applications..Coping.with.these.challenges.requires.sophisticated.tools.that.enhance.developer.productivity.
        by.handling.some.of.the.details.so.that.developers.can.focus.their.energy.on.application.functionality.and.
        performance..

        For.close.to.a.decade,.advocates.of.“managed”.programming.languages.have.held.an.opinion.that.C++.is.a.
        language.whose.time.has.passed,.one.that.does.not.have.the.same.capabilities.as.its.more.modern.programming.
        brethren..In.fact,.ever.since.the.introduction.of.the.managed.code.platforms.(Java.in.1995.and.its.twin.brother,.
        .NET,.in.20011),.the.corporate.IT.industry.has.effectively.pronounced.dead,.the.C++.language.that.gave.rise.
        to.both..“It’s.too.low-level,”.come.some.complaints,.or.“it’s.not.garbage-collected.”.Some.even.question.its.
        productivity,.citing.issues.like.long.compile.cycles.or.its.lack.of.high-level.language.facilities..Whatever.the.
        accusations.about.C++,.the.prevailing.myth.in.the.industry.is.that.for.developers.to.be.productive.in.writing.
        software.that.scales,.performs,.and.interoperates.with.the.rest.of.the.enterprise,.they.should.consider.Java.or..NET.

        There.is.no.debating.the.wealth.of.offerings.available.to.the.Java.and..NET.programming.platforms..There.
        is.a.huge.variety.of.Web.development.frameworks,.persistence.frameworks,.middleware.frameworks.and.
        application.servers..Even.the.simplest.search.query.turns.up.more.than.5.8.million.hits.in.response.to.“Java.Web.
        Framework”.alone..So,.there’s.no.arguing.with.the.idea.that.Java.and..NET.both.serve.as.useful.tools.in.the.
        enterprise.IT.toolbox..

        Regardless.of.how.rich.the.ecosystem.surrounding.these.managed.code.platforms,.or.the.features.present.
        in.their.underpinnings,.it.makes.no.sense.to.restrict.software.development.projects.to.a.single.language.
        for.the.same.reason.that.construction.workers.don’t.carry.just.a.hammer.to.the.work.site..In.a.search.for.
        “standardization”.across.the.enterprise,.companies.often.make.fatal.decisions.to.build.software.in.languages.
        and.environments.that.aren’t.ideal.for.those.kinds.of.projects..Then,.when.the.project.gasps.its.last,.the.search.
        begins.for.the.reasons.behind.the.failure,.because.surely.it.can’t.be.that.the.wrong.decisions.were.made.at.the.
        very.beginnings.of.the.project.

        With.millions.of.developers.still.actively.writing.code.in.C++,.the.language.is.clearly.not.ready.to.be.
        pronounced dead. In fact, C++ development remains strong in many areas including financial services, military
        and.embedded.systems..For.example,.in.2006,.C.and.C++.were.the.most.popular.programming.languages.for.




   1
    It should be noted that most comparisons between C++ and the .NET platform are usually made through the lens of the C# pro-
   gramming language. To be fair, it should be pointed out that such comparisons aren’t entirely accurate. Many of the points made in
   C#’s favor are more about the Common Language Runtime itself, and thus are equally applicable in a comparison against Visual
   Basic. Few proponents of the .NET versus C++ debates feel inclined to explicate this comparison, for some reason.




WHITE PAPER                                                                                     PAGE 2
          embedded.systems.and.Java.use.actually.declined.2.This.paper.gives.a.rebuttal.to.the.popular.view.that.C++.
          does.not.stack.up.to.the.Java.and..NET.environments,.and.provides.some.guidelines.for.when.C++.is.indeed.
          the.right.tool.for.the.job..Readers.will.see.that.the.rich.suite.of.tools.offered.by.Rogue.Wave.Software.can.give.
          C++.developers.the.power.and.productivity.of.a.modern.programming.environment.while.also.offering.other.
          advantages.


   Debunking Some Common Misperceptions About C++
          Before.addressing.the.kinds.of.work.that.C++.is.well.suited.to.solving,.it.is.helpful.to.examine.some.common,.
          if.incorrect,.perceptions.about.C++.

          The.center.point.of.the.“C++.is.unproductive”.argument.generally.resides.around.the.notion.of.pointers,.and.by.
          extension,.memory.management..Commonly.cited.statistics.put.the.overhead.of.managing.memory.“by.hand”.
          via.new.and.delete.to.be.at.close.to.50.percent.of.the.total.effort.involved.in.a.C++.project..Programmers.
          swapping.war.stories.over.lunch.or.at.conferences.and.user.group.meetings.all.have.“wild.pointer”.stories,.
          describing.in.excruciating.detail.the.heap.corruption.commonly.associated.with.just.a.single.pointer.whose.
          location.has.been.corrupted.to.point.to.an.un-owned.or.incorrect.part.of.memory..Other.programmers.listen.
          in morbid fascination as entire processes come to a spectacular halt, usually with imagined visual fireworks
          flashing brightly behind the eyelids.

          What.is.frequently.not.mentioned.is.that.none.of.these.wild-pointer.scenarios.needed.to.happen.

          Memory.management.in.C++.does.not.need.to.rest.with.the.programmer..Not.only.does.the.C++.language.
          provide.native.facilities.for.taking.explicit.control.of.memory.management.through.well-known.customization.
          of.the.allocation.and.deallocation.operators.(new.and.delete),.but.there.are.also.numerous.garbage.collector.
          implementations.for.those.who.prefer.the.greater.safety.of.automated.memory.management..For.those.who.
          question.the.reliability.of.C++.garbage.collectors.such.as.the.popular.Boehm-Demers-Weiser.garbage.collector,.
          it.should.be.noted.that.this.garbage.collector.implementation.serves.itself.as.the.garbage.collector.of.choice.in.
          several.“managed.runtime”.platforms.in.widespread.use,.including.several.Common.Language.Infrastructure.
          (the formal name for the .NET CLR specification) implementations. Concerns over C++ garbage collector
          reliability.would.thus.appear.to.be.unfounded.

          Another facet of this argument states that there is not sufficient research for performance optimization of C++
          environments..C++.adversaries.point.to.deep.levels.of.research.being.conducted.by.Sun.and.Microsoft.on.
          their.runtime.implementations,.noting.the.impressive.array.of.optimizations.both.companies.are.introducing.
          specifically in their garbage collection implementations. Yet similar research is taking place in the larger



   2
       Gartner Dataquest report: “User Survey Analysis: Embedded Software Development Tools and RTOS, North America, 2006”




WHITE PAPER                                                                                 PAGE 3
      world.of.garbage.collectors.(much.of.it.in.concert.with.the.managed.platform.researchers),.and.many.of.those.
      enhanced.collectors.also.available.for.the.C++.platform.

      C++.actually.gives.the.programmer.greater.freedom.by.providing.the.ability.to.choose.when.to.use.a.garbage.
      collected.heap,.and.when.not.to..In.fact,.this.decision.can.even.be.made.within.the.boundaries.of.a.single.
      program,.something.that.neither.the.Java.Virtual.Machine.nor.the.Common.Language.Runtime.can.offer.(at.
      least,.not.without.writing.code.for.the.native,.underlying.operating.system,.which.frequently.must.be.written.in.
      C++).

      Pro-Java.or.pro-.NET.arguments.also.point.to.the.impressive.array.of.libraries.and.tools.available.for.these.two.
      environments..The.ecosystem.surrounding.these.environments.ranges.from.collection.classes.to.database.access.
      layers.and.user.interface.libraries.both.for.the.Web.and.for.the.desktop.environment..Many.of.those.making.the.
      argument remember the early days of C++ when the first task of every C++ programmer was to write their own
      “string”.class..At.that.point,.the.language.itself.had.not.evolved.to.the.point.where.this.was.provided.as.part.of.
      the.compiler.and.associated.toolchain..

      Said.comparisons.do.not.apply.to.the.modern.C++..Although.the.range.perhaps.isn’t.quite.as.wide.as.that.seen.
      for.Java,.the.C++.ecosystem.is.equally.broad,.diverse,.and.in.most.cases,.far.less.“scattered”.and.redundant..
      Every.category.of.Java.or..NET.component.or.library.can.be.found.in.C++,.usually.with.a.quick.Internet.search.
      that.doesn’t.even.require.much.imagination:.“C++.SOA,”.“C++.Web.services,”.“C++.development.library,”.or.
      even.“C++.unit.testing”.

      Perhaps.the.most.impressive.of.the.open-source.contribution.to.the.managed.code.platforms.is.that.of.the.
      application.container.Spring,.providing.an.embeddable.application.container.for.providing.powerful.services.
      to.“Plain.Old.Java.Objects”,.what.today.is.being.called.lightweight application servers..These.are.a.reaction.
      to.the.“heavyweight”.application.servers.of.the.previous.generation,.most.notably.the.Enterprise.JavaBeans.
      specification and associated products.

      Fortunately,.C++.didn’t.need.a.reaction.to.the.previous.generation.of.“heavyweight”.application.servers,.
      since the language—again—didn’t mandate the use of one, or even a common specification for one. Instead,
      C++.programmers.have.simply.used.the.libraries.that.have.made.sense.to.them.for.their.particular.project...
      Interestingly however, there is now a standard specification for a lightweight runtime for distributed applications
      called.Service.Component.Architecture.(SCA)..Its.primary.programming.languages.are.Java.and.C++...


   When C++ is the Right Tool for the Job
      One of the greatest advantages of C++ is its flexibility to be used for different programming paradigms. It
      works.well.for.both.object.oriented.and.procedural.programming,.and.offers.templates.and.meta-programming.
      techniques.for.a.generative.approach.as.well..The.C++.ecosystem.has.produced.some.amazing.new.extra-




WHITE PAPER                                                                            PAGE 4
      linguistic.extensions.in.the.form.of.the.Boost.libraries.—.extensions.that.neither.Java.nor.C#.could.produce.
      without significant language revisions, or commercial variants, such as Rogue Wave’s own SourcePro
      (discussed.below)..Thanks.to.the.expressive.power.of.templates.and.metaprogramming.(and.even.the.language.
      preprocessor),.the.C++.programmer.can.take.advantage.of.features.like.named.parameters,.lambda.expressions,.
      arbitrarily complex finite state machines, and more, all produced without making a single change to the core
      language.itself.

      Perhaps most importantly, C++ is synonymous with highly efficient code. C++ compilers do a phenomenal
      amount of analysis at compile time, resulting in very fast code and making the language a good fit for
      computationally.intensive.tasks..Most.high-powered.mathematic-oriented.code,.if.not.maintained.in.Fortran.
      (usually.because.that’s.what.it.was.written.in,.30.years.ago),.resides.in.C++..Many,.if.not.most,.entertainment.
      and.game.software.is.written.in.C++.for.this.same.reason..Furthermore,.C++.has.the.ability.to.access.the.C-
      based.APIs.of.nearly.every.operating.system.in.the.world,.giving.C++.developers.unparalleled.access.to.the.
      underlying.platform.

      Embedded.platforms.such.as.mobile.phones,.set-top.boxes,.and.a.wide.array.of.industrial,.medical.and.
      other.devices.are.generally.regarded.as.the.next.frontier.of.computing.hardware...As.such,.they.represent.a.
      tremendous.growth.opportunity.for.new.software.application.development...C++.is.already.the.most.widely.
      used.and.the.fastest.growing.programming.language.for.embedded.applications.in.these.types.of.devices...

      The C++ language, owing to its optimizing compilers, its ability to create “domain-specific embedded
      languages”.(DSELs).using.its.preprocessor.and/or.templates,.and.its.ability.to.access.the.underlying.platform,.is.
      frequently.not.the.only.tool.for.the.job,.but.often.the.right.one..


   Rogue Wave Software Product Overview
      Rogue.Wave.Software.has.been.bringing.a.wealth.of.offerings.to.the.C++.language.since.1989.and.today.offers.
      a.rich.suite.of.tools.to.support.the.development.of.modern.enterprise.service-oriented.software,.in.C++.as.well.
      as.Java.and.BPEL..As.shown.in.Figure.1,.the.Rogue.Wave.C++.development.tool.suite.contains.a.set.of.core.
      components (bottom of figure) as well as tools that extend into development of Web services (top).




WHITE PAPER                                                                          PAGE 5
                                                       THE COMPLETE SOLUTION FOR
                          ENTERPRISE C++ DEVELOPMENT AND DEPLOYMENT

                                                              RE                             ENT
                                                         TU             ITE                        ERP
                                                      UC           A SU                                  RI S
                                                 TR     H   YD
                                                               R
                                                                                                                E
                                            AS




                                                                                                                C+
                                       R
                                       NF        HydraSCA




                                                                                                                     +C
                                  DI
                                                 Multi-core optimized




                                                                                                                       OM
                                                                                            SourcePro® Core
                             E AN

                                                 C++/Java
                                                 SCA Compliant                              C++ Standard Libraries




                                                                                                                        PON
                                                 Multi-language runtime                 Integrated, Cross-platform
                          R U N TI M




                                                                                                                          ENTS
                                        HydraExpress                                                SourcePro® DB
                                        C++ Web-Services
                                                                      ROGUE WAVE                    SourcePro® Net
                                        HydraSDO™
                                                                       PRODUCTS
                                        For XML/Databases                                    SourcePro® Analysis
                                        Data Access Services

                                                                      Stingray® Studio
                                                                       Objective Grid
                                                                      Objective Toolkit

                                                                        STINGRAY®
                                                               GUI C
                                                                     OMPONENTS

   Figure 1. Rogue Wave Software Product Suite


       The.Rogue.Wave.C++.development.tool.suite.includes:

       Core.components:

           ». Rogue.Wave.SourcePro®.C++.—.A.set.of.C++.libraries.and.integrated,.cross-platform.components.and.
              analysis.tools.that.provide.the.basic.building.blocks.to.create.or.extend.applications.

           ». Rogue.Wave.Stingray®.—.An.integrated.set.of.GUI.components.designed.to.handle.the.low-level.details.
              of.GUI.application.development

           ». HostAccess®.—.Rogue.Wave.Software’s.suite.of.terminal-emulation.products.that.provide.Windows.users.
              secure.access.to.legacy,.host-based.applications,.as.well.as.the.ability.to.transform.the.interface.of.existing.
              applications.using.a.browser.or.any.ActiveX.supported.containers..




WHITE PAPER                                                                                                          PAGE 6
      SOA.Components

         ». HydraSCA.—.A.Service.Component.Architecture-compliant.runtime.that.enables.application.developers.
            to.quickly.increase.performance.and.scalability.of.an.individual.service.or.a.globally.distributed.
            application.with.many.concurrent.services.—.all.without.requiring.special.development.expertise

         ». HydraExpress.—.A.framework.for.developing.and.hosting.high.performance.C++.Web.Services,.
            including.advanced.XML,.SOAP,.and.WSDL.productivity.C++.tools.for.transforming.new.and.existing.
            C++.applications.for.use.in.Service.Oriented.Architectures

         ». HydraSDO for XML.—.A.Service.Data.Objects-compliant.Data.Access.Service.for.exceptionally.fast.
            parsing.of.XML.data.with.in-memory.shared.data.between.tightly.coupled.Java.and.C++.applications

         ». HydraSDO for Databases.—.A.Service.Data.Objects-compliant.database.service.which.provides.simple.
            and.easy.access.to.relational.databases.in.both.conventional.and.Service.Oriented.Architectures

      The.service.grid.tools.that.are.part.of.Rogue.Wave®.Hydra.include.some.unique.capabilities.that.simplify.the.
      task.of.concurrent.programming.to.enable.fast.execution.on.multi-core/multi-CPU.systems..Rogue.Wave®.
      Hydra.also.includes.an.application.server.environment.that.rivals.those.for.Java.and..NET.

      In.addition,.Rogue.Wave.Software.is.a.contributor.to.open.source.libraries,.which.are.an.important.part.of.the.
      ecosystem.for.the.C++.community..Since.2005,.Rogue.Wave.Software.has.donated.code.and.effort.into.the.
      Apache.C++.Standard.Library.(STDCXX),.a.high-quality.cross-platform.implementation.of.the.C++.Standard.
      Library.available.at.incubator.apache.org/stdcxx/..The.open.source.Apache.library.helps.provide.standard.
      behavior.across.platforms.and.compilers,.creating.greater.portability.in.C++.applications.across.the.enterprise...
      The.Apache.Standard.Library.is.supported.with.Rogue.Wave.SourcePro.C++.

      The.sections.that.follow.provide.a.more.in-depth.discussion.of.these.Rogue.Wave.software.products.


   Professional C++ Source with SourcePro® C++
      At.the.core.of.the.Rogue.Wave.family.is.SourcePro C++,.a.collection.of.C++.modules.intended.for.direct.use.
      by.programmers..For.those.who.recall.Rogue.Wave’s.Tools.h++.or.Dbtools.h++.from.past.release.cycles,.that.
      functionality.now.resides.as.part.of.SourcePro...Four.modules.currently.make.up.the.whole.of.SourcePro.C++:.

         ». SourcePro®.Core.—.An.extensive.set.of.fundamental.C++.components.that.offer.a.consistent,.uniform,.
            and.portable.API.for.developing.applications..SourcePro.Core.components.have.been.relied.upon.by.
            industry.leading.enterprises.for.well.over.a.decade.to.deliver.the.reliability.and.performance.required.by.
            today’s.mission-critical.applications,.making.them.the.most.trusted.enterprise-quality.C++.component.
            libraries.on.the.market.today.




WHITE PAPER                                                                           PAGE 7
         ». SourcePro®.DB:.—.Abstracts.away.the.complexity.of.writing.database.applications,.yet.allows.developers.
           to.drill.down.to.the.native.database.client.libraries.if.needed.

         ». SourcePro®.Net:.—.Provides.APIs.for.developing.secure.and.non-secure.networked.and.Internet-enabled.
           applications,.handling.the.granular.details.of.socket.programming.and.Internet.protocols.to.expedite.the.
           timely.delivery.of.quality.applications.

         ». SourcePro®.Analysis.—.Contains.a.full.range.of.C++.components.for.solving.mathematical.problems.in.
           business.and.research,.encapsulating.algorithms.that.can.be.relied.upon.for.accurate,.precise.calculations.

      The most fundamental of these is SourcePro Core, which defines the core functionality that almost every
      non-trivial.C++.program.will.need.at.some.point..It.includes.features.for.threading.and.synchronization,.XML.
      support,.internationalization,.and.of.course,.the.same.high-quality.Standard.C++.library.implementation.Rogue.
      Wave.used.as.the.core.of.the.Apache.C++.Standard.Library.

      Equally as important to the enterprise developer, is SourcePro DB, which provides an STL-influenced API for
      accessing.relational.database.implementations..SourcePro.DB.is.built.on.the.SourcePro.Core.so.as.to.keep.the.
      high fidelity of core C++ types throughout the Rogue Wave offerings.

      By.combining.SourcePro.DB.with.the.SourcePro.Core.tools,.relational.database.access.becomes.highly.
      simplified. Consider, for example, the following code:

              // Header file for class QueryServer
              //
              // From the DB Interface Module
              #include <rw/db/db.h>

              // From the Threads Module
              #include <rw/itc/RWTIOUResult.h>
              #include <rw/thread/RWTRunnableIOUFunction.h>
              #include <rw/thread/rwtMakeRunnableIOUFunction.h>
              #include <rw/thread/RWServerPool.h>

              class QueryServer
              {

              public:
                  QueryServer(const RWDBDatabase &db, unsigned concurrency)
                    : database_(db), pool_(RWServerPool::make(concurrency))
                  {
                      // Set the database’s connection pool size to our
                      // concurrency level for better performance.
                      database_.defaultConnections(concurrency);

                       // Start the pool running to accept requests.
                       pool_.start();
                   }

                   ~QueryServer()




WHITE PAPER                                                                         PAGE 8
                    {
                         // Wait for the pool to finish processing its queue.
                         pool_.stop();
                         pool_.join();
                    }

                    RWTIOUResult<RWDBResult> enqueue(const RWCString& sql)
                    {
                       // Make a new runnable to handle the request and
                       // throw it on the queue.
                       RWTRunnableIOUFunction<RWDBResult> rf =
                         rwtMakeRunnableIOUFunctionMA1(QueryServer, // class
                                   *this,                          // instance
                                   RWDBResult,                 // return type
                                   &QueryServer::serviceFunction, // function
                                   const RWCString&,        // first arg type
                                   sql);                          // first arg
                       pool_.enqueue(rf);
                       return rf.result();
                    }

               private:
                   RWDBDatabase database_;
                   RWServerPool pool_;

                    // Service function enqueued on the RWServerPool to handle
                    // the request. Private, because users should use enqueue()
                    // to place a query on the queue.
                    RWDBResult serviceFunction(const RWCString& sql)
                    {
                        // Grab a connection, go for it.
                        return database_.connection().executeSql(sql);
                    }

                    // Not defined on purpose
                    QueryServer(const QueryServer&);
                    QueryServer& operator=(const QueryServer&);
               };


      This.may.seem.like.a.non-trivial.amount.of.code,.but.closer.examination.reveals.several.features,.now.neatly.
      encapsulated.in.the.QueryServer.class.(and.all.built.with.the.help.of.the.Threads.module.of.SourcePro.Core).
      that.are.essential.in.non-trivial.enterprise.applications:

          ». The.QueryServer.makes.use.of.a.thread.pool.rather.than.forcing.the.calling.thread.to.block.incessantly.
            waiting.for.the.database.to.respond..This.will.make.it.easier.for.multiple.queries.to.be.submitted.
            simultaneously.and.will.allow.for.better.throughput.and.scalability.

          ». Notice.how.the.returned.object.from.the.enqueue.method.is.not.the.database.result.object.(RWDBResult).
            itself,.but.an.RWIOUResult,.also.known.as.a.future.in.concurrency-hip.circles..This.means.the.developer.




WHITE PAPER                                                                           PAGE 9
           can.check.the.RWIOUResult.periodically.to.see.if.the.results.have.returned,.and.if.a.critical.time.threshold.
           is.crossed.in.the.meantime..Or,.if.the.interactive.user.simply.decides.to.cancel.the.request.because.it.is.
           taking.too.long,.the.calling.thread.remains.in.control.and.can.proceed.accordingly.

         ». Because.the.QueryServer.is.now.making.use.of.a.thread.pool.to.enqueue.the.requests,.it.can.also.leverage.
           the.RWDBDatabase’s.connection.pooling.facilities,.providing.multiplexed.communication.to.the.database.
           to.maximize.the.throughput.of.a.single.database.connection..This.helps.reduce.the.overall.load.on.the.
           server.

      Using.the.QueryServer.is.thus.straightforward.and.simple:
              // Implementation file, queryserver.cpp

              #include    <rw/db/db.h>
              #include    <iostream>
              #include    “queryserver.h”
              #include    <rw/thread/RWRunnableSelf.h>     // for rwSleep()
              #include    <rw/tools/bustring.h>

              using namespace std;

              void outputStatus(const RWDBStatus& aStatus)
              {
                  if(aStatus.errorCode() == 0) return;
                  // Print out the error.
                  cout << “Error code: “ << (int) aStatus.errorCode() << endl
                  << “Error message “ << aStatus.message() << endl
                  << “Is terminal: “ << (aStatus.isTerminal() ? “Yes” : “No”)
                                     << endl
                  << “Vendor error 1: “ << aStatus.vendorError1() << endl
                  << “Vendor error 2 : “ << aStatus.vendorError2() << endl
                  << “Vendor message 1: “ << aStatus.vendorMessage1() << endl
                  << “Vendor message 2: “ << aStatus.vendorMessage2() << endl;
              }

              int main()
              {
                  RWDBManager::setErrorHandler(outputStatus);
                  RWDBDatabase db = RWDBManager::database(“ORACLEOCI”,
                                                          “database”,
                                                          “username”,
                                                          “password”,
                                                          “”);
                  RWDBTracer& trc= db.tracer();
                  trc.setOn(RWDBTracer::SQL);
                  trc.stream(cout);
                  RWDBConnection conn = db.connection();

                     // Create and populate table
                     conn.executeSql(“create table testServ(col1 nvarchar2(20))”);




WHITE PAPER                                                                          PAGE 10
                    // Any Unicode String May be inserted here
                    conn.executeSql(“insert into testServ values(N’Oregon Ducks’)”);

                    // Create QueryServer
                    QueryServer server(db, 5);
                    RWCString query(“select * from testServ”);
                    RWTIOUResult<RWDBResult> resultIOU = server.enqueue(query);

                    // Poll until redeemable
                    while(!resultIOU.redeemable())
                    {
                        cout << “Waiting for result...” << endl;
                        ::rwSleep(50);
                    }

                    // Obtain RWDBResult object from RWTIOUResult
                    RWDBResult res = resultIOU.redeem();

                    // Create RWDBReader
                    RWDBReader rdr = res.table().reader();

                    // Output data from query
                    RWBasicUString output;
                    // Create a file to write out the results
                    RWFile fileOut(“queryServerOut.txt”);
                    while(rdr())
                    {
                        rdr >> output;
                        // Output UString
                        fileOut << output;
                        // Print out UTF 8 version oof UString
                        cout << output.toUtf8() << endl;
                    }
                    // Cleanup
                    conn.executeSql(“drop table testServ”);
                    return 0;
               }


      Here.the.use.of.the.futures.is.obvious..Developers.simply.check.to.see.if.the.results.are.ready.via.a.call.to.the.
      redeemable().method,.and.retry.periodically.as.desired..In.this.case,.a.simple.polling.loop.checking.every.50.
      milliseconds.is.used..Once.retrieved,.the.results.are.iterated.row-by-row,.and.displayed.using.traditional.C++.
      IOStreams.operators.

      And,.notice,.no.messy.memory-management.anywhere.to.be.found.

      Naturally,.for.those.applications.that.need.a.more.powerful.transactional.scenario,.the.SourcePro.DB.module.
      provides.full.XA.transaction.support..A.SourcePro.DB-authored.application.can.be.easily.and.completely.
      integrated.with.other.XA-compliant.transactional.middleware,.including.the.full.array.of.Java.Enterprise.
      JavaBean.application.servers.or..NET.tools.




WHITE PAPER                                                                           PAGE 11
      SourcePro.Net.provides.another.necessary.component.to.modern.enterprise.application.development..It.
      supports.network.communication.across.servers.and.clients,.with.the.full.complement.of.networking.protocols.
      developers.have.come.to.expect..This.includes.HTTP,.FTP,.POP3,.SMTP,.and.MIME.support..And.for.the.
      security-conscious,.it.also.includes.SSL.and.HTTP/S.support..Again,.all.of.this.is.built.on.top.of.the.traditional.
      C++.IOStreams.interfaces,.making.it.invisible.to.programmers.familiar.with.cin.and.cout..Since.much.network.
      traffic involves binary exchange of information, SourcePro Net also provides binary streams, both in platform-
      specific encoding as well as endian-specific or XDR-defined binary data exchange.

      Finally,.the.SourcePro.Analysis.module.provides.a.plethora.of.higher-level.functionality.needed.by.enterprise.
      business.analysis..This.includes.linear.algebra.and.other.essential.mathematics.features,.as.well.as.monetary.
      currency.classes.and.regression.calculation..The.currency.support.alone.makes.the.Analysis.module.well.
      worth.having.to.those.developers.working.with.monetary.values.in.code..The.naïve.approach.of.“just.store.it.
      in a float” quickly breaks down in the face of the imprecision of floating-point math. This is well documented
      throughout.both.the.C++.(and.Java,.and..NET).communities,.yet.is.still.one.of.the.most.frequently.coded.
      mistakes in financial software.

      Look.at.the.code.involved.in.combining.Italian.Lira.with.now-obsolete.German.DeutschMarks.and.converting.
      the.result.to.US.Dollars:

               typedef RWDecimal< RWMP2Int > Decimal;
               RWExchangeRateTable table;

               ...

               RWExchangeFactory<Decimal> factory( table );

               ...

               RWMoneyCalculator<Decimal> calculator( factory,
                                 RWMoneyCalculator<Decimal>::target );

               RWMoney<Decimal> lira(Decimal(“12823”), “ITL” );
               RWMoney<Decimal> marks(Decimal(“1.26”), “DEM” );

               RWMoney<Decimal> sum = calculator.add( lira, marks );

               calculator.setConversionType( RWMoneyCalculator<Decimal>::base );
               calculator.setBaseCurrency( “USD” );

               sum = calculator.add( lira, marks );


      Notice.the.use.of.the.RWExchangeRateTable,.which.as.its.name.implies,.handles.the.conversion.of.both.the.
      ITL and DEM values to USD when populated with the appropriate data. And because financial accounting often
      carries.its.own.rules.for.when.fractional.currency.values.round.up.or.round.down,.the.RWMoneyCalculator.




WHITE PAPER                                                                          PAGE 12
      provides.customization.on.this.point,.something.bankers.will.appreciate.even.if.developers—particularly.those.
      who’ve.not.seen.the.movie.Office Space.—.don’t.see.the.need.

      Certainly.much,.much.more.is.baked.into.the.Source.Pro.modules,.but.time.passes.quickly.and.there’s.still.more.
      Rogue.Wave.tools.to.explore:.the.Rogue.Wave.Hydra.Suite.


   Rogue Wave® Hydra
      Rogue Wave Hydra is the industry’s first development environment specifically built for concurrent processing
      of business applications and Service Oriented Architecture (SOA) frameworks. It offers a flexible services
      development.environment.coupled.with.lightweight,.high-performance.runtime.agents.that.can.be.widely.
      distributed.across.the.network..By.replicating.these.agents.across.the.network.to.implement.concurrent.
      processing on multi-core hardware in a service grid, developers can create solutions that offer efficient
      execution.and.distribution..(See.later.section.titled,.“Bringing.Services.into.the.Service.Grid.with.Rogue.Wave.
      Hydra”).

      Rogue.Wave.Hydra.is.based.on.Rogue.Wave’s.many.years.of.experience.creating.high.performance.software.
      development.tools..The.major.advantages.of.Rogue.Wave.Hydra.include:

         ». Rapid development.—.Using.industry.standards.such.as.XML,.SOAP,.and.WSDL.to.build.SOA.
            applications,.developers.can.quickly.create.new.services.and.then.independently.orchestrate.the.
            service.components.into.a.business.service.grid.that.can.reuse.software.components.to.accelerate.
            development...Support.for.the.Service.Component.Architecture.(SCA).standard.provides.a.consistent.
            programming.model.for.SOA.with.features.such.as.service.abstraction,.multiple.programming.language.
            implementations.(including.C++,.Java.and.BPEL),.and.integration.with.existing.Web.services.standards...

         ». Multi-core optimized.—.Near-linear.scalability.can.be.achieved.by.use.of.Hydra’s.Software.Pipelines.to.
            increase.the.capacity.for.concurrent.processing.of.business.transactions.

         ». Flexible deployment.—.The.virtualized.environment.made.possible.with.Rogue.Wave.Hydra.enables.run-
            time flexibility. Rogue Wave Hydra agents can be allocated to specific CPUs or servers and can easily be
            moved to support a different configuration.

         ». Massive Scale.—.Unlike.most.SOA.environments.that.use.a.hub.and.spoke.architecture,.Rogue.Wave.
            Hydra.offers.the.option.of.peer-to-peer.communication.between.components.in.a.service.grid.to.avoid.
            unnecessary.overhead.when.components.are.running.in.the.same.server.environment..This.feature.also.
            supports concurrent processing of business transactions, enabling businesses to achieve significant
            increases.in.transaction.throughput.

         ». Vendor independence.—.Based.on.industry.standard.Web.service.protocols.and.a.component.architecture,.




WHITE PAPER                                                                          PAGE 13
              Rogue.Wave.Hydra.can.be.easily.integrated.with.other.Web.services.or.embedded.into.other.service.
              frameworks.

           ». Language Neutrality.—.Rogue.Wave.Hydra.enables.multiple.different.languages.to.communicate.
              directly.using.native.protocols.and.Web.services..Initial.support.includes.C++,.Java,.and.BPEL,.and.more.
              languages.will.be.supported.in.future.releases.


   Web Service Development with Rogue Wave Hydra
       One.area.of.development.usually.reserved.for.the.Java.and..NET.is.the.Web.application—a.collection.of.
       typically.dynamically-generated.HTML.content.served.by.an.HTTP.server,.providing.application.functionality.
       without.requiring.a.client-side.deployment.step..The.Java.Servlet.architecture,.and.the..NET.ASP.NET.
       architecture,.have.for.years.provided.a.safer,.more.robust.development.experience.than.the.traditional.C/C++.
       approach.—.that.of.building.standalone.executable.programs.that.execute.through.the.HTTP.server’s.Common.
       Gateway.Interface.(CGI)..In.the.traditional.C/C++.approach,.each.request.spawns.a.new.operating.system.
       process.for.the.duration.of.that.request,.an.expensive.approach.in.both.time.and.resources.

       HydraExpress.provides.a.remarkably.similar.approach.—.a.standardized.processing.container.that.loads.
       components.at.runtime..Each.component.obeys.a.standard.programming.interface,.and.responds.to.one.or.more.
       HTTP requests as defined by the application lifecycle. In fact, this model is deliberately similar to the Java
       Servlet.approach.as.shown.in.Figure.2..




                                                               Clients



                                                                      HTTP Requests




                                    Servlet                    Servlet                    Servlet

                                          Rogue Wave Hydra Servlet Container


   Figure 2. HydraExpress offers a Servlet container much like that of the Java Servlet architecture.




WHITE PAPER                                                                                     PAGE 14
      The.likeness.is.close.enough.that.any.Java.developer.who.has.even.the.barest.ability.to.read.and/or.write.C++.
      code.will.recognize.the.following.as.“Hello,.world”,.servlet.style:

               // HelloWorldExample.h
               //
               #include <rw/rwsf/servlet/http/HttpServlet.h>

               class HelloWorldExample : public rwsf::HttpServlet
               {

                   public:

                     virtual void doGet(rwsf::HttpServletRequest& request,
                                        rwsf::HttpServletResponse& response);

               };



               // HelloWorldExample.cpp
               //
               #include “HelloWorldExample.h”

               // Define the servlet for the container.
               RWSF_DEFINE_SERVLET(HelloWorldExample)

               // Implement a response to the HTTP GET method.
               void
               HelloWorldExample::doGet(rwsf::HttpServletRequest& request,
                                        rwsf::HttpServletResponse& response)
               {
                 // Tell the client that the response is an HTML document.
                 response.setContentType(“text/html”);

                   // Get a reference to the response output stream.
                   rwsf::ServletOutputStream& out = response.getOutputStream();

                   // Send a canned response to the client.
                   out.println(“<html>”);
                   out.println(“<head>”);
                   out.println(“<title>HelloWorldExample</title>”);
                   out.println(“</head>”);
                   out.println(“<body bgcolor=\”white\”>”);
                   out.println(“<h1>HelloWorldExample</h1>”);
                   out.println(“</body>”);
                   out.println(“</html>”);
               }


      What’s.more,.the.HydraExpress.container.offers.all.the.same.characteristics.that.any.production-ready.Java.
      Servlet.container.provides..It.supports.a.full.range.of.HTTP.commands,.provides.scalable.execution.of.HTTP.
      requests, and enables powerful configuration through a descriptor XML file that supports a variety of response




WHITE PAPER                                                                        PAGE 15
      options..Developer.can.thus.have.full.access.to.servlet.parameters.and.request.body,.as.well.as.simple.per-user.
      session.data.storage.and.management..In.short,.HydraExpress.neatly.stands.as.the.C++.developer’s.HTTP.
      application.server.in.the.inevitable.comparison.against.the.Java.or..NET.stack.

      The.typical.next.step.for.the.C++.developer.looking.to.build.a.Web.service.is.to.write.a.complex.servlet.that.
      will.parse.the.incoming.HTTP.request.body.via.an.XML.parser.(the.Apache.Xerxes.C++.XML.parser,.perhaps),.
      extract.the.parameter.data.via.complex.DOM.navigation.API.calls,.perform.the.requested.operation,.then.
      marshal.the.results.into.another.SOAP.XML.document.and.send.it.back.by.passing.it.to.the.servlet’s.output.
      stream.

      To.the.casual.observer.of.C++,.this.sounds.like.a.typical.criticism.of.C++.code:.too.low-level.and.unproductive..
      Just.like.memory.management.

      HydraExpress.provides.two.more.key.pieces.of.functionality.to.reduce.the.complexity.of.building.the.necessary.
      Web.service..Just.like.the.popular.Java.and..NET.frameworks,.HydraExpress.provides.XML.binding.and.full.
      WSDL proxy code generation support. For example, in its simplest usage, given a WSDL file, the HydraExpress
      “rwsfgen”.tool.will.produce.either.a.client.proxy.for.the.Web.service.described.therein,.or.the.server.stubs.the.
      service developer fleshes out with the appropriate business functionality. Full support for either synchronous or
      asynchronous execution is provided. And configuration files allow developers to defer certain decisions (such
      as.the.actual.endpoint.to.use,.as.opposed.to.the.one.described.in.the.WSDL.document.itself).to.runtime.and.
      modification by system administrators or other deployment agents.

      More.importantly,.like.any.good.XML.services.toolkit,.HydraExpress.makes.no.presumption.that.the.only.
      transport.for.XML-based.data.must.be.HTTP..A.full.range.of.transports.is.provided,.along.with.support.for.
      advanced.Web.service.features.such.as.authentication.and.handling.of.WSDL.faults..In.fact,.the.provided.API.
      allows.developers.to.provide.custom.SOAP.handlers.for.any.SOAP.header.sent.by.the.service.or.client..This.
      enables.developers.to.begin.with.simple.“business-focused”.services.and.layer.additional.complexity.into.the.
      service.as.time.and.business.demands.

      Within.the.XML.community,.however,.calls.for.a.simpler.model.based.on.pure.HTTP.requests.exchanging.raw.
      XML.data,.commonly.called.“RESTful”.operations,.have.led.developers.to.build.hand-spun.alternatives.to.
      SOAP-based,.WS-*-based.services..HydraExpress.fully.supports.this.model.as.well,.providing.an.XML.binding.
      framework.that.uses.XML.Schema.Description.(XSD).as.a.model.for.generating.the.code.necessary.to.provide.
      XML.marshaling.and.unmarshaling.

      Given,.for.example,.a.standard.XSD.description.of.an.XML.document,.such.as.the.one.provided.in.the.XSD.
      Standard,.a.Purchase.Order,.like.so:
                <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>

                  <xsd:annotation>




WHITE PAPER                                                                          PAGE 16
                <xsd:documentation xml:lang=”en”>
                 Purchase order schema for Example.com.
                 Copyright 2000 Example.com. All rights reserved.
                </xsd:documentation>
              </xsd:annotation>

              <xsd:element name=”purchaseOrder” type=”PurchaseOrderType”/>

              <xsd:element name=”comment” type=”xsd:string”/>

              <xsd:complexType name=”PurchaseOrderType”>
                <xsd:sequence>
                  <xsd:element name=”shipTo” type=”USAddress”/>
                  <xsd:element name=”billTo” type=”USAddress”/>
                  <xsd:element ref=”comment” minOccurs=”0”/>
                  <xsd:element name=”items” type=”Items”/>
                </xsd:sequence>
                <xsd:attribute name=”orderDate” type=”xsd:date”/>
              </xsd:complexType>

              <xsd:complexType name=”USAddress”>
                <xsd:sequence>
                  <xsd:element name=”name”   type=”xsd:string”/>
                  <xsd:element name=”street” type=”xsd:string”/>
                  <xsd:element name=”city”   type=”xsd:string”/>
                  <xsd:element name=”state” type=”xsd:string”/>
                  <xsd:element name=”zip”    type=”xsd:decimal”/>
                </xsd:sequence>
                <xsd:attribute name=”country” type=”xsd:NMTOKEN”
                                fixed=”US”/>
              </xsd:complexType>

              <xsd:complexType name=”Items”>
                <xsd:sequence>
                  <xsd:element name=”item” minOccurs=”0” maxOccurs=”unbounded”>
                    <xsd:complexType>
                      <xsd:sequence>
                        <xsd:element name=”productName” type=”xsd:string”/>
                        <xsd:element name=”quantity”>
                          <xsd:simpleType>
                            <xsd:restriction base=”xsd:positiveInteger”>
                               <xsd:maxExclusive value=”100”/>
                            </xsd:restriction>
                          </xsd:simpleType>
                        </xsd:element>
                        <xsd:element name=”USPrice” type=”xsd:decimal”/>
                        <xsd:element ref=”comment”    minOccurs=”0”/>
                        <xsd:element name=”shipDate” type=”xsd:date” minOccurs=”0”/>
                      </xsd:sequence>
                      <xsd:attribute name=”partNum” type=”SKU” use=”required”/>
                    </xsd:complexType>
                  </xsd:element>




WHITE PAPER                                                             PAGE 17
                   </xsd:sequence>
                 </xsd:complexType>

                 <!-- Stock Keeping Unit, a code for identifying products -->
                 <xsd:simpleType name=”SKU”>
                   <xsd:restriction base=”xsd:string”>
                     <xsd:pattern value=”\d{3}-[A-Z]{2}”/>
                   </xsd:restriction>
                 </xsd:simpleType>

               </xsd:schema>


      The HydraExpress developer takes the above XSD file, runs it through the rwsfgen utility to create a new C++
      class.responsible.for.handling.the.details.of.parsing—and.producing—the.schema-compliant.XML.document.on.
      demand,.from.any.source..In.fact,.most.of.the.details.of.the.parsing.logic.are.completely.encapsulated.from.the.
      C++ developer. For most scenarios, this means that parsing an incoming XML file that should contain a single
      Purchase.Order.will.look.like.the.following:

               PurchaseOrder po;
               std::ifstream istrm(“po.xml”);
               std::stringstream buffer;
               buffer << istrm.rdbuf();
               std::string xmlContents(buffer.str());
               po.unmarshal(xmlContents.data());


      In.this.example,.the.PurchaseOrder.class.was.generated.by.the.rwsfgen.utility..Producing.the.XML.
      corresponding.to.a.PurchaseOrder.is.equally.simple..One.can.create.the.PurchaseOrder.object,.populate.the.
      object.via.calls.to.generated.methods.like.setBillTo(),.and.then.call.marshal().to.produce.the.results.

      Combining.this.with.the.servlet.code.creates.a.powerful.RESTful.solution,.one.that.executes.at.the.native.speed.
      of.the.underlying.platform.yet.surrenders.not.an.iota.of.that.high.productivity.so.strongly.claimed.by.managed.
      code.developers..


   Manipulating XML Data with HydraSDO™
      Accepting.incoming.requests.and.sending.outgoing.responses,.or.initiating.those.requests.and.accepting.the.
      results,.is.of.course.only.part.of.the.service.interchange..Much.of.the.time,.those.requests.will.generate.business.
      data.that.needs.preservation.in.the.data.storage.layer..Typically,.the.storage.layer.will.utilize.one.of.the.many.
      different.relational.database.products.available.either.commercially.or.from.the.open.source.community.

      The.chorus.rises.again..Of.course,.this.is.C++.and.that.means.that.developers.will.be.required.to.write.their.SQL.
      statements.by.hand,.embed.them.in.the.source.code.(where.DBAs.fear.to.tread.and.thus.cannot.optimize),.and.
      manage.by.hand.the.translation.of.objects.to.relational.tables.and.back.again..Granted,.the.powers.of.SourcePro.
      DB.reduce.the.immense.amount.of.work.required.to.access.the.database.(as.opposed.to,.say.the.ODBC.data.




WHITE PAPER                                                                           PAGE 18
          access API or a database vendor’s native API), but still, compared to the benefits of, say, the Java Persistence
          API.(JPA),.based.on.the.highly-popular.Hibernate.project.

          Unfortunately,.as.some.have.discovered.the.hard.way,.trying.to.map.objects.to.relational.tables.in.a.seamless.
          way.is.a.tricky.problem,.one.that.some.have.suggested.hasn’t.yet.been.entirely.solved3..Back.in.2003,.BEA.and.
          IBM released a new specification, Service Data Objects (SDO), designed to take a new approach to accessing
          and.manipulating.data.against.various.data.repositories,.including.the.relational.database.and.XML.data..
          According to the SDO specification, SDO “simplifies data programming by unifying data programming across
          data.source.types,.providing.support.for.common.application.patterns,.and.enabling.applications,.tools,.and.
          frameworks.to.more.easily.query,.bind,.view,.update.and.introspect.data”4..Thus.SDO.offers.a.disconnected.
          mode.of.access.that.the.traditional.O/R-M.cannot.

          HydraSDO.provides.this.core.SDO.functionality.and.access.capabilities.for.relational.database,.XML.data.and.
          other.formats.as.shown.in.Figure.3..



                                                                                                            Databases




                     Software
                    Application                        API       HydraSDO™                                XML Documents



                                                                                                            Other Data
                                                                                                             Formats
                                                                                                      -i.e. EDI, Text, Video



   Figure 3. HydraSDO provides a layer of abstraction to simplify data access from within applications.


          As.an.example,.given.the.PurchaseOrder.schema.described.above,.and.an.instance.of.that.type,.using.
          HydraSDO.would.operate.in.a.slightly.different.manner:

                    const char* SCHEMA_FILE = “../po.xsd”;

                    int main()
                    {




   3
       The Vietnam of Computer Science, available via http://odbms.org/about_news_20070212.html
   4
       The SDO Specification, v2, available at http://www.bea.com/dev2dev/assets/sdo/SDO_Specification_CPP_V2.01.pdf




WHITE PAPER                                                                                     PAGE 19
                    // define the data types used by the document
                    DataFactoryPtr dataFactory = DataFactory::getDataFactory();
                    XSDHelperPtr xsdHelper = HelperProvider::getXSDHelper(dataFactory);
                    xsdHelper->defineFile(SCHEMA_FILE);

                    // load the po.xml file from disk using the XMLDataAccessService
                    XMLDataAccessService das(dataFactory);
                    DataGraphPtr dataGraph = das.loadFile(“../po.xml”);
                    DataObjectPtr billTo = purchaseOrder->getDataObject(“billTo”);

                    SequencePtr billToSeq = billTo->getSequence();
                    // Set the existing 0th element “name” to a new value
                    billToSeq->setCStringValue(0, “Thomas Jefferson”);
                    // Set the existing 4th element “zip” to a new value
                    billToSeq->setCStringValue(4, “12345”);
               }


      This.permits.the.C++.code.to.remain.loosely-coupled.against.the.actual.details.of.the.XML.data.being.
      consumed,.and.uses.the.same.“Data.Graph”.approach.as.the.HydraSDO.for.Databases.product..The.SequencePtr.
      abstracts.away.the.details.of.the.underlying.representation,.allowing.the.developer.to.focus.on.modifying.the.
      element.in.question.without.having.to.know.its.(in.this.case).XML.element.name..In.essence,.the.details.of.the.
      underlying.data.model—to.the.greatest.degree.possible—are.abstracted.away.from.the.developer.working.with.
      that.data.

      Data.access.is,.of.course,.far.more.complex.than.this,.and.HydraSDO.responds.with.equally.powerful.features.
      to.make.data.access.easier.and—to.boot—interoperable.with.Java.applications..However,.another.topic.
      beckons: the increasingly difficult problem of producing software that will not only perform quickly on the
      server hardware present in the enterprise data center, but also scale well. What makes this problem so difficult
      is.the.recent.shift.in.hardware,.notably,.the.rise.of.the.multi-core.CPU,.and.the.thread.synchronization.concerns.
      that.come.with.it.


   Beyond Moore’s Law
      To.meet.today’s.demanding.business.requirements,.software.developers.look.for.ways.to.reduce.run.times.and.
      improve.scalability.of.enterprise.applications..Historically,.one.of.the.more.successful.ways.to.achieve.those.
      goals.has.been.to.rely.on.faster.processors.and.hardware..But.that.tactic,.for.good.or.for.ill,.is.near.its.end.

      Commonly.cited.as.“Processor.speeds.double.every.eighteen.months,”.Moore’s.Law.actually.states.that.the.
      doubling.effect.is.relative.to.the.number.of.transistors.that.can.be.put.into.a.chip..Practically.speaking,.for.years.
      this.meant.that.processors.did,.in.fact,.double.in.speeds.every.eighteen.months.or.so,.leading.developers.and.IT.
      environments into a beneficial arrangement. If the developed program wasn’t fast enough, all that was necessary
      to.improve.the.speed.was.patience.and.a.new.system.hardware.upgrade..A.year.and.a.half.later,.without.any.
      work.whatsoever,.the.program’s.processing.power.doubled..With.even.some.modest.performance.tuning.work.




WHITE PAPER                                                                            PAGE 20
      on.the.part.of.the.developer,.programs.could.appear.to.double,.triple.or.even.quadruple.in.speed..But.by.2003,.
      that.doubling.effect.started.to.wane,.and.by.2004,.it.came.to.a.very.visible.halt.

      No.deep.insight.into.industry.trends.is.necessary.to.see.this.shift..Casual.observation.reveals.that.in.August.
      2001,.the.average.PC.CPU.clock.speed.was.roughly.2GHz..According.to.rough.calculations,.the.doubling.
      effects.of.Moore’s.Law.should.have.created.an.average.CPU.speed.around.16GHz.to.32GHz.by.2007..A.quick.
      look.at.PC.sales.ads.reveals.that.the.upper-echelon.machines.being.sold.in.2007.ship.with.processors.no.faster.
      than.3.66.GHz..The.evidence.is.clear:.the.era.of.doubling-processor-speeds.is.on.hiatus,.if.not.entirely.over..

      Rather.than.faster.CPUs,.what.Intel.and.other.processor.manufacturers.now.offer.is.more.CPUs.per.machine,.
      through.the.use.of.multi-core.processors..In.essence,.manufacturers.are.putting.multiple.CPUs.on.a.single.piece.
      of.silicon,.creating.multiple.“cores”.(or.virtual.CPUs).on.a.single.chip..By.doing.this,.the.overall.processing.
      capability.of.the.chip.is.increased.without.the.traditional.drawbacks.of.faster.processors,.namely.increased.heat.
      and.power.drain..Not.only.does.this.create.an.overall.faster.experience.for.multi-tasking.users.and.distributed.
      applications,.but.it.also.helps.relieve.data.center.capacity.constraints..Today’s.massively.scaled-out.network.
      operations.centers.are.faced.with.practical.power-service.and.heat-dissipation.limitations.in.the.server.room.
      itself..These.data.centers.can.now.enjoy.greater.computing.capacity.in.the.same.room.by.using.multi-core.
      systems.that.require.less.space,.power,.and.cooling.to.deliver.more.application.throughput.

      If.developers.and.their.programming.environments.are.primed.to.take.advantage.of.this.multi-core.environment,.
      it can mean significant performance increases for business applications. However, the era of developers simply
      waiting.for.faster.processors.to.save.their.slow.performing.applications.is.essentially.over..Now,.instead,.
      developers.must.learn.to.take.advantage.of.multiple.cores.in.their.programs..And.that.presents.its.own.share.of.
      issues.


   Challenges with Multi-Threading and Concurrency
      Concurrent.computing.is.not.an.easy.thing.to.manage..Developers.must.ensure.that.data.is.accessed.in.
      proper.sequence.in.order.to.prevent.two.concurrently.executing.tasks.from.overwriting.the.same.bit.of.data..
      Developers.in.all.the.mainstream.languages.(including.Java,..NET.and.C++,.among.others).face.the.arduous.
      task.of.examining.their.source.code.for.subtle.concurrency.problems..Concurrency.bugs.are.not.always.easily.
      spotted.even.by.expert.developers,.and.just.because.the.code.works.correctly.one.time.doesn’t.mean.it.will.
      work.the.same.way.every.time..In.fact,.it’s.not.entirely.uncommon.for.a.concurrency.defect.to.only.appear.once.
      in.a.thousand,.or.million,.executions..Modern.languages.do.what.they.can.to.optimize.code.for.multiple.core.
      processing..In.some.edge.cases,.however,.the.tools.can.actually.deceive.developers.into.believing.their.code.is.
      concurrent-safe.when.in.fact,.the.opposite.is.the.case.

      Work.on.solving.this.problem.in.a.general.manner,.commonly.known.as.“parallel.programming”,.has.not.yet.
      yielded.a.satisfactory.answer.for.business.applications,.despite.advances..For.certain.types.of.applications,.




WHITE PAPER                                                                           PAGE 21
      a.Java.application.server.or.other.clustering.solution.can.scale.appropriately.on.multi-core.hardware..For.
      example,.Web.applications.that.are.serving.user.requests.and.don’t.generally.care.about.order.of.execution.
      should do fine. For these applications, a Java application server can spawn new threads across additional cores
      without.modifying.an.application’s.behavior.

      Most.business.applications,.however,.have.additional.requirements.such.as.sequential.processing.or.guaranteed.
      message.ordering..For.example,.a.single.threaded.application.that.needs.to.ensure.that.“A”.happens.before.“B”.
      cannot.run.multiple.instances.concurrently.on.multiple.cores.and.still.ensure.a.particular.order..If.an.application.
      server.or.other.external.controller.is.not.explicitly.aware.of.an.application’s.ordered.processing.requirements,.it.
      may.spawn.new.threads.in.a.way.that.creates.race.conditions,.deadlocks.or.other.unexpected.behavior.

      Application.servers.and.operating.systems.are.generally.multi-threaded.themselves,.but.unfortunately.their.
      multi-threaded nature does not always yield benefits that extend to the applications that run on them. The
      application.server.and.OS.cannot.know.the.proper.order.of.execution.without.being.instructed.by.the.business.
      logic. They are designed to simply process any thread in a “first-come-first-served” fashion, and rely on
      underlying concurrency locking to prevent data conflicts.

      Symmetric.Multi-Processing.(SMP).has.similar.limitations.because.the.OS.enforces.the.order.of.the.application.
      business.logic,.but.can.only.leverage.multiple.CPUs.to.the.extent.that.the.business.logic.supports.multi-
      threading..In.other.words,.software.grids,.clustering,.and.distributed.SOA.environments,.which.can.deliver.
      some.concurrent.processing.without.requiring.code.changes.to.applications,.are.still.limited.in.their.scalability.
      for.high.volumes.of.transactions..At.a.certain.scale,.bottlenecks.begin.to.occur.


   Rogue Wave Hydra and Software Pipelines Scalability Example
      As.a.demonstration.of.the.power.of.Rogue.Wave.Hydra.for.concurrent.processing,.Rogue.Wave.Software.
      developed.a.small.benchmark.that.would.test.the.scalability.of.a.traditional.business.application.that.requires.
      ordered.processing.

      The benchmark involved a Java business application that simulates a traditional financial services application.
      Processing.involved.typical.Java.Enterprise.Edition.application.logic.and.simulated.transactions.that.included.
      calls.against.a.relational.database.and.a.Web.service..The.application.logic.contained.sequential.processing.and.
      first-in/first-out ordering, a common business application requirement that makes concurrent processing more
      challenging.

      Five.different.test.scenarios.were.used.to.examine.how.the.application.would.perform.with.varying.numbers.
      of.processor.cores.and.varying.numbers.of.Rogue.Wave.Hydra’s.Software.Pipelines..The.test.utilized.both.a.
      single-core Intel system and two different configurations of quad-core Intel systems, one with two CPUs and the
      other.with.four.CPUs..Tests.on.the.multi-core.systems.were.conducted.without.modifying.the.code.to.enhance.




WHITE PAPER                                                                           PAGE 22
        concurrency.and.then.again.using.Software.Pipelines.to.enhance.concurrency.

        The.performance.results.in.transactions.per.second.are.shown.in.Figure.4..It.easy.to.see.that.that.there.was.a.
        significant jump in performance when Software Pipelines were added and that Software Pipelines offered near-
        linear.scalability.as.the.number.of.pipelines.and.processor.cores.were.increased..




                            600

                            500

                            400                                                         530

                     TPS 300

                            200

                            100                                        70
                                               50
                               0
                                     Single Core–           8 Cores–Unmodified   8 Cores with
                                     No Concurrency         For Concurrency      Concurrent Pipelines


   Figure 4. Tests showed linear scalability with Software Pipelines


        Readers.familiar.with.Amdahl’s.Law.will.recall.that.it.predicts.that.the.speedup.to.be.gained.by.an.algorithm.
        through.concurrent.processing.is.based.on.the.amount.of.the.algorithm.that.is.sequential.in.nature..The.law.
        states.that.regardless.of.the.hardware.increase.applied,.a.performance.ceiling.exists..If.90.percent.of.the.code.
        for.an.application.can.be.run.concurrently.(a.highly.optimistic.assumption),.then.regardless.of.the.number.
        of.processors.applied,.the.maximum.performance.increase.will.be.10.times.the.application’s.original.single.
        processor.performance..

        The.capacity.of.the.eight-core.system.was.saturated.when.8.pipelines.were.used.and.the.total.throughput.had.
        increased.to.more.than.13.times.the.capacity.of.the.corresponding.test.without.Software.Pipelines..It.would.be.
        reasonable.to.estimate.the.ultimate.capacity.of.the.eight-core.system.at.eight.times.the.single.core.test.results,.
        or.160.transactions.per.second..However,.the.four-pipeline.and.eight-pipeline.tests.offered.double.and.triple.this.
        estimated.capacity.with.320.TPS.and.530.TPS.respectively..The.eight-pipeline.test.results.were.an.impressive.
        25.times.greater.than.the.baseline.single-core.test.




WHITE PAPER                                                                               PAGE 23
   Bringing Services into the Service Grid with Rogue Wave HydraSCA
      The.service.developer.also.faces.a.number.of.challenges.beyond.worrying.about.concurrency.issues..Whether.
      operating on a multi-core platform or not, the service must deliver sufficient performance to meet user needs.
      If the IT service is not living up to user expectations, users will often find other ways of acquiring the data and
      processing.they.need..Making.sure.services.run.“at.speed”.is.an.obvious.necessary.condition.for.success.—.one.
      that doesn’t need much justification. A second major challenge for developers is to ensure that the service will
      be.able.to.scale.to.an.appropriate.number.of.simultaneous.users..Again,.the.dangers.of.poor.response.time.can.
      lead users to find alternatives, including the least desirable option of deciding to rewrite it themselves. In many
      cases.scalability.problems.manifest.themselves.as.performance.problems,.leading.developers.down.a.rabbit.
      hole.looking.for.ways.to.optimize.the.wrong.thing..Allowing.services.to.run.in.parallel,.whether.on.multiple.
      machines.or.on.multiple.cores.inside.the.same.machine,.is.a.critical.part.of.getting.today’s.services.to.scale.

      As.if.just.getting.services.to.perform.and.scale.weren’t.hard.enough,.things.get.even.more.complicated.when.
      looking.at.services.in.the.aggregate..As.a.general.rule,.services.are.not.intended.to.stand.alone..In.the.SCA.and.
      SOA.ideal,.they.form.a.collective..Services.interact.with.one.another.in.atomic.ways.to.achieve.a.desired.end.
      such.as.delivery.of.a.complex.business.process.

      This.bears.greater.explanation..If.SOA.were.simply.about.building.a.monolithic.application.with.an.XML.front-
      end.instead.of.a.graphical.or.console-based.front-end,.SOA.would.be.just.a.footnote.on.the.history.of.client/
      server.computing..After.all,.the.format.that.transactions.take.when.they.enter.or.leave.the.database.is.really.
      just an implementation detail and not something developers need spend any significant time thinking about.
      Unfortunately, it is not uncommon for developers to think they’ve built a SOA solution, only to find that it is
      no.easier.to.maintain.than.traditional.client/server.a.solution..They.may.have.spent.eighteen.months.building.a.
      large.“uber-service”.designed.to.incorporate.every.bit.of.business.logic.found.within.the.company..When.the.
      solution.is.released.into.production,.the.developers.hope.that.future.business.process.changes.will.be.easy.due.
      to the benefits of their so-called service-based infrastructure. They then grow confused and later frustrated as
      those changes require the same kind of modifications as that of a traditional client/server style application. Since
      functionality.was.not.isolated.into.discrete.services.that.operate.independently.of.one.another,.little.progress.
      was.actually.made.in.terms.of.maintainability.of.the.code.

      Services.are.an.extension.of.the.basic.principles.of.modularity.that.have.echoed.throughout.programming.
      history. From the earliest days of COBOL, many languages and platforms have touted the benefits of
      modularity..Rather.than.monolithic.“uber-services”.that.incorporates.every.shred.of.corporate.IT.logic,.true.
      SOA.solutions.are.based.on.small.atomic.services.that.focus.on.just.one.aspect.of.the.corporate.IT.landscape..
      Then developers or analysts can orchestrate the flow of messages between these services to build complex
      business.processes..This.orchestration.or.integration.of.services.is.sometimes.done.by.hand..In.other.words,.
      a.composite.application.is.built.which.makes.calls.to.the.underlying.services.to.create.the.desired.sequence.




WHITE PAPER                                                                           PAGE 24
      of.business.logic..In.other.cases,.service.orchestration.is.handled.through.another.facility.such.as.the.facility.
      provided.by.BPEL..In.some.organizations,.this.orchestration.step.is.entirely.removed.from.the.developer..The.
      orchestration.may.be.turned.over.to.a.business.analyst.or.domain.expert.who.knows.little.about.programming.
      and.XML,.but.knows.a.lot.about.how.the.business.works.

      The.concept.of.modular.service.components.has.slowly.evolved.into.a.standard,.the.Service.Component.
      Architecture.(SCA).and.stands.as.a.core.part.of.Rogue.Wave.HydraSCA..HydraSCA.provides.a.container.for.
      C++.SCA.components,.giving.the.C++.developer.not.only.a.runtime.container.in.which.these.components.
      will.execute,.but.also.a.standard.architecture.and.tooling.infrastructure.to.make.these.services.feasible..For.
      example, HydraSCA provides a graphical orchestration editor, making it easier for domain experts to define
      and/or.modify.business.processes.across.the.various.services.that.are.deployed.in.the.enterprise..The.distributed.
      nature of HydraSCA deployments can also provide significant performance throughput advantages, allowing
      businesses.to.reach.much.higher.transaction.volumes.for.their.business.applications..

      Consider,.for.a.moment,.the.following.SCA.code,.written.(obviously).in.C++.but.similar.to.what.a.Java.SCA.
      developer.would.write:
               #include <rwsf/service/ServiceContext.h>
               #include <stdlib.h>

               #include <rwsf/message/MessageServiceVariable.h>
               #include <rwsf/message/SimpleServiceVariable.h>

               #include <rwsf/sdo/DataObject.h>
               #include <rwsf/sdo/RefCountingPointer.h>

               #include “PurchaseApprovalCppService.h”

               PurchaseApprovalCppService::PurchaseApprovalCppService() {}

               // virtual
               PurchaseApprovalCppService::~PurchaseApprovalCppService() {}

               // virtual
               void
               PurchaseApprovalCppService::invoke(rwsf::MessageInfo& messageInfo)
               {
                 rwsf::MessageServiceVariablePtr obj =
                    messageInfo.value<rwsf::ServiceVariablePtr>(“inputMessage”);
                 rwsf::MessageServiceVariablePtr response =
                    messageInfo.value<rwsf::ServiceVariablePtr>(“outputMessage”);

                 rwsf::SimpleServiceVariablePtr purchaseAmt = obj->getPart(“purchaseAmount”);

                 std::string cost = purchaseAmt->getString();
                 int costOfItem = atoi(cost.c_str());




WHITE PAPER                                                                            PAGE 25
                   // Approve if amount is less than 100 dollars.
                   rwsf::SimpleServiceVariablePtr appResp =
                     response->getPart(“approvalResponse”);
                   if(costOfItem <= 100.00) {
                     appResp->setString(std::string(“Purchase approved.”));
                   }
                   else {
                     appResp->setString(
                       std::string(“Sorry, too much. Try again next quarter.”));
                   }
               }

               RWSF_DEFINE_CPP_SERVICE(PurchaseApprovalCppService)


      SCA’s.cross-language.nature.means.that.an.SCA.container,.like.HydraSCA,.doesn’t.particularly.care.what.
      language.the.SCA.component.is.implemented.in,.so.Java.and.C++.SCA.components.can.happily.coexist.
      side-by-side.inside.the.same.container,.allowing.developers.to.focus.more.on.the.problem.at.hand.and.less.
      on.convincing.their.coworkers.of.the.merits.of.writing.code.in.one.language.or.another..This.becomes.more.
      obvious when looking at the “.composite” file for HydraSCA, that stitches together the component with its
      service.context:

               <?xml version=”1.0” encoding=”ASCII”?>
               <composite xmlns=”http://www.osoa.org/xmlns/sca/1.0”
                 name=”PurchaseApprovalCppComposite”
                 targetNamespace=
               “http://www.roguewave.com/composites/PurchaseApprovalCppComposite”>

                   <service name=”PurchaseApprovalService”
                     promote=”PurchaseApprovalComponent/PurchaseApprovalService”/>

                 <component name=”PurchaseApprovalComponent”>
                   <rwsf:implementation.bpel
                     xmlns:rwsf=”http://www.roguewave.com/rwsf”
                     xmlns:ns=”http://www.roguewave.com/wsdl/PurchaseApprovalCpp.wsdl”
                     process=”ns:Process”/>
                   <service name=”PurchaseApprovalService”>
                     <interface.wsdl
                       interface=
               “http://www.roguewave.com/projects/PurchaseApprovalCpp.wsdl#wsdl.interface(PurchaseApproval
               CppPortType)”/>
                     <binding.ws
                       port=
               “http://www.roguewave.com/projects/PurchaseApprovalCpp.wsdl#wsdl.endpoint(PurchaseApprovalC
               ppService/PurchaseApprovalCppPort)”/>
                     <binding.sca/>
                   </service>
                 </component>

                   <service name=”PurchaseApprovalCppService”
                     promote=”PurchaseApprovalCppComponent/PurchaseApprovalCppService”/>




WHITE PAPER                                                                       PAGE 26
                 <component name=”PurchaseApprovalCppComponent”>
                   <rwsf:implementation.cpp
                     xmlns:rwsf=”http://www.roguewave.com/rwsf”
                     library=”PurchaseApprovalCpp”
                     createMethod=”createPurchaseApprovalCppService”/>
                   <service name=”PurchaseApprovalCppService”>
                     <interface.wsdl
                        interface=
               “http://www.example.org/PurchaseApprovalCppCall/#wsdl.interface(PurchaseApprovalCppCallPort
               Type)”/>
                     <binding.ws
                        port=
               “http://www.example.org/PurchaseApprovalCppCall/#wsdl.endpoint(PurchaseApprovalCppCallServi
               ce/PurchaseApprovalCppCallPort)”/>
                     <binding.sca/>
                   </service>
                 </component>
               </composite>


      When.binding.a.Java.component.into.the.container,.a.<rwsf:implementation.java>.tag.would.be.used.instead,.
      and would utilize appropriate child elements to identify the jar file and classname as necessary. Everything
      else,.presuming.the.Java.component.implements.the.same.WSDL.contract,.of.course,.remains.the.same..
      Obviously,.in.order.to.make.this.a.reality,.several.elements.have.to.be.in.place..Most.critical,.standards.must.be.
      understood and adopted throughout the grid. If not, the various services will be entirely too difficult to talk to
      and.developers.would.spend.the.vast.majority.of.their.time.“bridging”.messages.from.one.service.to.another..
      This.is.essentially.what.has.already.been.done.in.the.non-SOA.IT.environment..Once.appropriate.standards.are.
      in.place,.the.grid.can.then.interoperate.across.a.variety.of.platforms.and.languages,.including.those.corporate.
      partners.still.developing.their.services.on.Java.or..NET.

      Also,.because.the.environment.changes.on.a.regular.basis,.the.services.must.rely.on.some.kind.of.layer.of.
      indirection.to.keep.them.isolated.from.the.environment.around.them..This.presents.an.obvious.conundrum..Any.
      non-trivial.service.is.going.to.need.to.communicate.with.other.services.or.external.resources.such.as.a.relational.
      database. Thus it needs to know how to find those resources in the environment around it.

      Within HydraSCA, this problem of configuration is handled through a concept called service abstraction, a
      key.aspect.of.SOA..A.component.(in.this.case,.a.service).declares.its.necessary.dependencies.(either.through.
      its API or through an external configuration system). For example, the service would declare its need for a
      database connection, usually identified by some human-readable name. When the component is loaded into the
      HydraSCA runtime, the runtime inspects the component’s declared dependencies, identifies the resources within
      the.current.environment.that.satisfy.these.requirements,.and.hands.them.to.the.component.via.a.method.call..
      The.component.thus.remains.entirely.decoupled.from.its.environment,.making.it.far.simpler.to.deploy.and/or.
      redeploy.services.into.different.environments.




WHITE PAPER                                                                           PAGE 27
                Because.the.components.in.an.SCA.ecosystem.remain.blissfully.ignorant.of.the.environment.around.them,.it.
                becomes.easy.to.assume.that.all.services.are.going.to.be.scattered.across.the.entirety.of.the.production.server.
                farm..This.assumption,.however,.carries.with.it.a.dangerous.problem..Service.messages.that.are.dispatched.from.
                one.server.to.another.carry.a.much.greater.performance.overhead.than.a.simple.traditional.method.call.within.
                the.same.process..This.performance.cost.of.going.out-of-process.can.be.the.difference.between.a.service.that.
                works,.and.one.that.doesn’t..

                Fortunately,.HydraSCA.understands.this.problem.and.offers.a.solution..Because.the.HydraSCA.container.has.
                near-perfect.knowledge.about.the.location.of.the.services,.it.can.optimize.the.inter-service.communication.
                by optimizing the placement of service resources. For example, when fulfilling a service dependency for a
                newly.discovered.service,.HydraSCA.can.choose.services.that.have.the.best.inter-service.communication.path,.
                perhaps.within.the.same.server.or.process..This.can.change.what.would.normally.have.been.an.expensive,.
                high-latency.transmission.of.data.across.the.network.into.a.fast,.low-latency.local.service.call.that.delivers.
                very high performance. HydraSCA thus offers significant flexibility in service deployment — something that is
                missing.from.many.other.environments..Using.HydraSCA,.developers.can.optimize.the.business.processes.that.
                need.high-speed/low-latency.processing.and.this.can.be.accomplished.without.violating.the.basic.principles.of.
                modularity.and.information.hiding.


           Summary
                When.C++.is.the.right.tool.for.the.job,.Rogue.Wave.Software.has.the.right.development.environment.to.get.the.
                job.done.right,.on.time,.and.within.budget..With.the.industry’s.most.trusted.foundation.for.C++.development.
                and.a.unique.solution.for.parallel.processing.of.business.applications,.Rogue.Wave.brings.a.complete.C++.
                development.solution.that.can.help.developers.meet.all.of.today’s.challenges.

                Benefits of the complete Rogue Wave development environment can include:

                    ». Developer.productivity.that.is.on.par.with.modern.managed.code.platforms

                    ». Extreme.performance.and.scalability.for.multi-core.platforms.

                    ». Extensive.portability.across.a.broad.range.of.CPU.architectures,.operating.systems,.and.databases

                To.learn.more.about.next.generation.developer.solutions.from.Rogue.Wave.Software.visit.www.roguewave.com.




      WHITE PAPER                                                                                  PAGE 28



USA 1-800-487-3217                  FRANCE +33 (0)1 30 09 78 78                   GERMANY +49 (0)6103 59340                   UK +44 (0)118 9360710
www.roguewave.com

Copyright © 2008, Rogue Wave Software, Inc. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. All other
trademarks are the property of their respective owners.

				
DOCUMENT INFO
Shared By:
Stats:
views:282
posted:3/5/2008
language:English
pages:29