Register a component without an aspect to show the baseline behaviour.

← Design Patterns and Idioms · Ref: Q1120

Register without 'with aspect of' for direct access:

  register DirectWorker() as Worker

No proxy, no interception -- method calls go straight to the implementation. Use aspects only when you need cross-cutting behaviour.

See Q1115 for aspect basics. See Q1110 for register/inject.

Example

defines module qa.designpatterns.noaspect

  defines component

    Worker as abstract
      doWork()
        <- rtn as String: "abstract"

    DirectWorker is Worker
      override doWork()
        <- rtn as String: "direct result"

  defines application

    NoAspectApp
      //No aspect — direct access
      register DirectWorker() as Worker

  defines program

    NoAspectDemo() with application of NoAspectApp
      stdout <- Stdout()
      worker as Worker!
      result <- worker.doWork()
      stdout.println(result)

Common mistakes

E50001 — No need to invent a placeholder aspect — 'with aspect of NoAspect()' references an undefined aspect that fails to resolve; simply omit 'with aspect of' for direct registration. See ek9 -h E50001 for details.

Incorrect:

register DirectWorker() as Worker with aspect of NoAspect()

Correct:

register DirectWorker() as Worker
Other ways to ask this
  • I want to see how a component behaves without any aspect wrapping
  • Show the difference between registering with and without an aspect
  • Given a service, register it directly without 'with aspect of'
  • Demonstrate a plain component registration for comparison with aspect examples

Coming from another language?

Spring: @Service without @Aspect is the default. EK9: register without 'with aspect of' is the default.

Keywords: baseline, plain, no aspect, direct, registration