New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete generation of abstract in php #26

Closed
Nava2 opened this Issue Aug 26, 2015 · 15 comments

Comments

@Nava2
Member

Nava2 commented Aug 26, 2015

Originally reported on Google Code with ID 76


class X
{
abstract;
}

Or,

abstract class X
{

}

The first syntax is suggested even though it is against the convention in other languages.
We already can declare a class as 'singleton'.

Doing this would require also changing UmpleOnline to allow marking a class as abstract.
There are metamodel and code generation implications.


Reported by @umple on 2011-06-24 13:41:07

@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Reported by @umple on 2011-06-24 15:46:05

  • Labels added: contribSought
@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

I'm looking into this currently. My plan is to go for the first method for the Umple
syntax. That way it follows how "singleton" and "immutable" are done. Consistency
is important I think here.


Reported by @EmperorJordan on 2012-03-16 01:50:53

@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

The abstract keyword is in place and working correctly. Simply doing the following:

class Student
{
abstract;
}

Will make the class "student" an abstract class such that if you were to generate Java
code the class would be "public abstract Student".

The only thing left right now is two fold, as I see it:

  1. This only works for Java code generation currently, other languages will need the
    implementation which should be a jet-template change (the jumpjet)

  2. Checks to ensure instantiation of an abstract class are impossible. It was mentioned
    by Andrew that this would be solved if the native language compilers (javac for Java,
    or gcc for C++) would bubble up the errors.

If time permits I will have this solved before the end of term (next week), if not
I'll simply solve it afterwards as I'm more than comfortable continuing onwards.


Reported by @EmperorJordan on 2012-04-01 03:28:28

@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Reported by @umple on 2012-06-14 21:47:38

  • Status changed: Started
@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Reported by @umple on 2012-06-15 15:12:19

  • Status changed: MostlyDone
  • Labels added: Diffic-Easy
@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Reported by @umple on 2012-09-27 19:41:51

@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Reported by @umple on 2013-06-19 12:51:17

  • Owner removed
  • Labels added: Priority-VHigh
  • Labels removed: Priority-High
@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Reported by @umple on 2013-09-12 15:08:50

  • Labels added: ucosp
@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

See also issue 321


Reported by @umple on 2013-09-17 19:41:04

@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Reported by @umple on 2013-09-20 14:53:19

  • Owner changed: greg.hysen
@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

This needs completion / verification in other languages


Reported by @umple on 2013-12-13 15:55:56

  • Owner removed
@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Verification for C++:

virtual methods are properly added for 'abstract' methods.

Ruby:

This a point of argument. In Ruby, there are two camps for abstract methods:

  • Define a method that throws an exception and fails quickly
  • Do not define the method and let the runtime fail and throw a NotImplementedError.

I think the better approach is the latter since we are generating code, better to fail
hard and fast with a better error.

PHP:

PHP matches with the defined behaviour.

TextUML:

This is not properly generated, the output has no notion of abstract: http://abstratt.github.io/textuml/docs/structure.html#classifiers
TextUML has no notion of functions, so that is not relevant here.

ECore:

Supports the abstract keyword

PapyrusXMI:

I was having trouble finding documentation, but if this is accurate: http://wiki.eclipse.org/MDT/UML2/Introduction_to_UML2_Profiles#Creating_Stereotypes
We are not supporting it.

yUML:
I don't think yUML supports abstract methods

JSON:
There is no key for abstract in the produced JSON

Internal Umple Implementation:
The abstract keywords are lost when reproducing the umple language features.


Reported by @Nava2 on 2015-01-17 19:23:41

@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Opened Issue 567 to deal with Ruby issue


Reported by @Nava2 on 2015-01-17 21:15:10

@Nava2

This comment has been minimized.

Member

Nava2 commented Aug 26, 2015

Kevin, I didn't get an abstract class in PHP when using the simple example:

class Student {
    abstract;
}

We would expect:

abstract class Student
{

  //------------------------
  // MEMBER VARIABLES
  //------------------------

  //------------------------
  // CONSTRUCTOR
  //------------------------

  public function __construct()
  {}

  //------------------------
  // INTERFACE
  //------------------------

  public function equals($compareTo)
  {
    return $this == $compareTo;
  }

  public function delete()
  {}
}

But we get:

class Student
{

  //------------------------
  // MEMBER VARIABLES
  //------------------------

  //------------------------
  // CONSTRUCTOR
  //------------------------

  public function __construct()
  {}

  //------------------------
  // INTERFACE
  //------------------------

  public function equals($compareTo)
  {
    return $this == $compareTo;
  }

  public function delete()
  {}
}

So the class isn't marked as abstract in PHP. Individual methods declared with the
abstract keyword are generated correctly in PHP though.


Reported by @CraigBryan on 2015-02-07 17:26:35

@TimLethbridge TimLethbridge changed the title from Add ability to declare a class as abstract to Complete generation of abstract in various generators Jan 15, 2016

@TimLethbridge TimLethbridge changed the title from Complete generation of abstract in various generators to Complete generation of abstract in php Sep 13, 2016

@TimLethbridge

This comment has been minimized.

Member

TimLethbridge commented Sep 13, 2016

It seems php needs changing only

@katcavers katcavers self-assigned this Jan 20, 2017

@katcavers katcavers closed this Jan 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment