Giter Club home page Giter Club logo

code2doc's Introduction

code2doc project

Build statusd: Coverage Status

In a nutshell:

The main purpose of this project is to link or define documentation with code - this is done by code2doc-api. (Target language is currently Java only.)

With code2doc also a system documentation can be generated from code itself. This requires code2doc-api and other code2doc parts.

Base concept:

A specification (model) contains of

  • use cases
  • architectures
  • concepts ( anything leading to a use case - e.g. a story )
  • roles
  • constraints

Link or define documentation with code

A documentation project must be created. All documentation elements are defined there and is referenced by every other project. So code inside other projects can link to defined documentation elements by annotations of code2doc-api. For example:

@LinkToUseCase(UC_1_SHOW_USERS.class)

Generate a system documentation

When a system documentation shall be generated an additionally documentation output project has to be created which has documented projects and other code2doc libraries as dependencies. This output project is not part of the real project release but necessary for documentation creation/generation only. Code2Doc libraries provide a tool chain to generate documentation out of the box from the output project.

Showcases

There is a demo showcase available, containing of three projects:

Also code2doc itself is described by code2doc (but without annotations):

Advantages:

  • References can be found via IDE (e.g. eclipse)

    • Type hierarchy
      • e.g. find all existing use cases inside your projects
    • Call references
      • e.g. find all involved code parts for a dedicated use case
  • Documentation

  • link from code to WIKI

  • and/or define documentation in code itself

    • versioned by SCM (e.g. git)
    • bound to releases
  • generateable

    • out of the box
    • integrateable into build process
  • extendable

    • e.g. ExampleURLExtension for web based projects to decorate their example URLs automatically
  • Sustainable

  • code2doc-api is simple plain java...

code2doc's People

Contributors

de-jcup avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

code2doc's Issues

Automatic path resolving fails for pictures

As an feature when no slash is given on a resource the same path as of element is automatically used

de.jcup.testpath.UseCase1.java with example resource "test.html" searches automatically inside

de/jcup/testpath/teset.html

It works for HTML but not for PNG

Concept texts with linking to use cases?

What about concepts knowing use cases? And what about linking from text to use cases?

Currently only use cases know the concepts (reason was that a use case can simple removed and this has no effect to architecture it self)

Create an validator for internal linking

When internal links are possible (see #6)
we should create a validator for internal links too - otherwise only at rendering time a wrong code2doc://-link will trigger errors on rendering engines (like docbook4j - fo etc.)

Not added roles shall occure in document as "not allowed"

In use cases the setup is able to do:

setup.addRole(Role r)
setup.addRole(Role r, Constraint c);

  • because Roles are elements so all must be wellknown following must be possible:
    On generation time it is clear which roles are NOT allowed for the use case. These rols shall be marked in documented as not able to do the operation!

Locale null is set locale on generation

Currently locale=null means default language (like in resource bundles).

while defining content in a setup this okay. But inside generation getContent() should use not null but setDefaultLocale instead (and this could be used by generator)
so we could remove getContent(Locale) completely!

Advantage: no more changes necessary for freemarker templates - thiese must only use content...

EntityModelPictureCreator

Also it would be possible to write extensions for this.

Idea would be like:

code2doc-extension-utils
=> EntityModelPictureCreator.createClassDiagramPictureFor(YourProject.class);

see also #20

Links to Issue tracking system

In some projects the original concepts are done in tracking systems like JIRA.

Maybe it would be nice to have a semantic part like
setup.addLinkToIssue(#18) ?

We have done this before for wiki entries
(setup.setWikiURL(..) )

Ordering of elements in document

Ordering output of elements in rendered document must be alphabetical ascending

e.g.
UC_1.class
UC_2.class
UC_3.class

must always have this ordering.
UC_1, UC_2, UC_3 !

Roles not supported by use case should occure in document too

e.g.

setup.addRole(role1,constraint1);
setup.addRole(role2)

--> should result in output:

role1 constraint1
rolw2 (no constraints)

Following roles are not allowed for this use case: role3, role4, role5, role6.

But this feature should be configurable (param.set("code2doc.usecase.show-unsupported-roles","true")

Refactor internal implementation parts

Currently e.g. Specification impl is being very ugly implented - needs to be refactored.

Every impl should have a dedicated hashcode equals (and maybe a to string impl)

Support multiple constraints for roles

currently a use case can only be setup with

setup.addRole(role)
setup.addRole(role, constraint)

it must be also possible to do
setup.addRole(role, constraint1, constraint2, ..)

API and templates must provide this

Enable html markup files to contain also images

currently when you got an image and you want it inside your described text you must divide
text into different files and add it into use case def...

e.g.
content().addTextResource("resource1.html").addPictureResource("picture1.png").addTextResource("resource2.html").

very ugly to use...

Extenson: AutoSnapshot example url pictures

Write a extension to do auto scnapshots for use cases where example url is set!

/**
 *  @return path or <code>null</code> if no snapshot can be created for given object
 *
 */
public String createExampleURLSnapshot(Object  object)

This should be an abstract implementation so only dedicated file names etc. are possible. The handling itself (e.g. using Selenium-Test-APi to get snapshots must be done in projects itself!)

A snapshot file renderer should do the internal parts like add to to model etc.

Architecture should have setup.setBigPictureResource(...)

Should be Like in UseCase:

protected void doSetup(UseCaseSetup setup){
        setup.setExamplePictureResource(...)
}

=>

protected void doSetup(ArchitectureSetup setup){
        setup.setBigPictureResource(...)
}

Purpose is to have a dedicated position in document for such kind of pictures.
(A big picture should always give you straight forward view of the architecture)

see also:
#20
#21

Preparation for multiple markup support done by one markup decorator

This is similar to #31 - but the allowed file format will be only html. It should prepare for other markups too.

Something like a Registry for file supports should be available

TextResourceRegistry.register(".html",  new DocbookHTMLMarkupSupport());

So e.g. addTextResource("name.html") is allowed but not ("name.txt").

BigPictureResourceExtension

code2doc-core:
=>BigPictureResourceExtension
... iplementation could use EntityModelPictureCreator(#21) (or any other API...) a dedicated library

Needs at least implementation of #19

error handling freemarker does cause invalid xml

Currently when an error happens we got a error log entry, an outpt error marker entry instead of correct one... and also and xml comment about the error.

the comments are using -- which is not allowed inside xml comments itself

on the other side it makes no senso to add comments when its also inside the ouptut.

So remove the comments.

Missing descriptions should be removed

Currently a missing description does result in

  • showing headline (always)
  • showing a standard text for not defined description

but content elements have always a content where the content can be described more precise.
So when no description is set it does not matter

=> when no description is set

  • no headline of description
  • no standard text for missing description

Missing features in code2doc

Discussion about missing features in code2doc

This is a discussion issue about missing features in code2doc. In lack of a forum all issues labeled with "discussion" are used to handle this kind of messaging.

👍

Code2DocExtension

Via Code2DocExtension projects should be able to support additional information.

E.g. "ExampleURLExtension" -> builds example urls automatically by project information.

Extend a link to have linking in document

Currently <<ahref='...'>linktext supports only normal hyperlinks.

It would be very convenient to have something like

<a href='code2doc://package1.subpackage2.ConceptClass.class'>linktext
<a href='code2doc://package1.subpackage2.UseCaseClass.class'>linktext
<a href='code2doc://package1.subpackage2.ArchitectureClass.class'>linktext
<a href='code2doc://package1.subpackage2.RoleClass.class'>linktext
<a href='code2doc://package1.subpackage2.ConstraintClass.class'>linktext

Docbook xml - remove unnecessary empty lines

The freemarker templates currently doing many unnecessary empty lines on output.

One of top reasons (or maybe the only one) is that macro calls are always handled as a line - even when no output is done at all (e.g. on debug logging).

This should be improved - so output of xml is more pretty.

Readable interfaces for custom generation

Currently Specificaiton is representing a write only interface, so no unnecessary getters are available (does not confuse...)

But for custom generators there must be something like
ReadableSpecification

or maybe simple : SpecificationModel ?

Anyway.. the interface should only support read methods (as currently used by the FTL types directly to specification impl). Normaly only these calls must be transfered to interfaces.

This is a little bit familiar with #35

Simplify api and usage

Currently its too difficult/verbose to describe documentation via code.

It should be much simpler. Also the describing of text should be done nearly only via markdown or asciidoctor (TBD).

Sorting of tech info table not alphabetical

Tech info table in output pdf is not sorted by title name

e.g.
Technical information - my use case
Technical information - my use case (group1)
Technical information - my use case (group2)

Content grabber extension

What about a wiki content grabber? or any other project content grabber?

Some projects could define their content already in a wiki - its very easy to use, smooth and normally has wyswig editors etc.

So the idea would be to make an Code2DocExtension available for projects where they could provide
wiki content.

Would this be nice?

Missing resource fails in freemarker not in explicit runtime exception

ERROR main - resource not found for resource path:myTasks.png

does result only errors in log but no explicit runtime exception.
Instead only freemarker template does result in error:

FreeMarker template error:
The following has evaluated to null or missing:
==> transformer.transformToFile(useCase.examplePictureResourcePath) [in template "macro/usecase.ftl" at line 55, column 45]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.