code-generation

Seriously, should I write bad PHP code? [closed]

爷,独闯天下 提交于 2019-12-20 08:21:03
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm doing some PHP work recently, and in all the code I've seen, people tend to use few methods. (They also tend to use few variables,

Is Pex (Test generation) really useful tool?

风格不统一 提交于 2019-12-20 08:18:13
问题 Yes, it is possible to generate tests on boundary values for functions like "Sum" or "Divide". Pex is a good tool here. But more often we create tests on business behaviour. Let's consider example from classic Beck's tdd book: [Test] public void ShouldRoundOnCreation() { Money money = new Money(20.678); Assert.AreEqual(20.68,money.Amount); Assert.AreEqual(2068,money.Cents); } Can this test be generated? No :) 95 % of tests in my projects check business logic, and can not be generated. Pex

How build a JOOQ custom generator?

守給你的承諾、 提交于 2019-12-20 07:34:13
问题 I have a specific Postgre schema that gathers all tables that defines types, like Status(name, description) where values could be OPEN, Open item status , CLOSED, Closed item status , etc. We need to fetch all these tables and generate enums based on them to later use it within our app. So, these enums should look like: enum Status { OPEN("Open item status"), CLOSED("Closed item status") ... } We decided to use JOOQ which looks pretty interesting, but we cannot find documentation/examples to

Replace ** with Math.pow in SymPy

最后都变了- 提交于 2019-12-20 03:28:07
问题 I have a SymPy expression in Python and I would like to copy and paste it into a Java source code. Problem is that there’s a different notation for exponentiation: Java uses Math.pow(a,b) ; Python uses a**b . So my question is: Is there a way how to print the SymPy expression in the “Java format”? 回答1: SymPy has several code printers that are intended specifically for such a purpose. While there is no Java code printer, there is one for Javascript. I cannot say whether Java and Javascript are

Code Generator for wrapper classes

ぃ、小莉子 提交于 2019-12-20 03:13:08
问题 Do you know of a tool that generates wrapper class based on another class? EDIT: By wrapper class I mean a class which wraps all exposed(public, protected) properties methods events so that you can put any logic in the middle. My concrete purpose is use it to verify the behavior of the wrapped class. 回答1: You could use T4 templating and write your own logic... http://msdn.microsoft.com/en-us/library/bb126445.aspx http://www.hanselman.com/blog

Java UML Automated generation for NetBeans 7.0 [closed]

血红的双手。 提交于 2019-12-20 02:11:20
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I need to make UML diagrams of my project. How could I do it in NetBeans 7.0? The program or plugin has to do it automatically. 回答1:

Effect of unused methods and properties on library or executable

雨燕双飞 提交于 2019-12-19 20:00:11
问题 I'm playing around with creating a source code generator for C# (.NET). Will generating properties or methods that never get called cause my code to run slower? How about inserting "using" statements for libraries that don't get used? I'm assuming the compiler is smart enough not to build in the unused "using" statements, but there is no way for it to know about properties and methods since they could be inserted for external applications to use. 回答1: The compiler is already smart enough to

run automatically t4 templates

风格不统一 提交于 2019-12-19 15:05:15
问题 I would like to know if is possible to run a T4 template when saving a other file, example run my .tt file after/on saving a xml file I forgot to mention that my IDE is VS2010 回答1: Yes, it is possible. Here is how. 来源: https://stackoverflow.com/questions/3948248/run-automatically-t4-templates

Generating code — is there an easy way to get a proper string representation of nullable type?

做~自己de王妃 提交于 2019-12-19 10:07:15
问题 So I'm building an application that is going to do a ton of code generation with both C# and VB output (depending on project settings). I've got a CodeTemplateEngine, with two derived classes VBTemplateEngine and CSharpTemplateEngine. This question regards creating the property signatures based on columns in a database table. Using the IDataReader's GetSchemaTable method I gather the CLR type of the column, such as "System.Int32", and whether it IsNullable. However, I'd like to keep the code

Generating code — is there an easy way to get a proper string representation of nullable type?

时光怂恿深爱的人放手 提交于 2019-12-19 10:07:07
问题 So I'm building an application that is going to do a ton of code generation with both C# and VB output (depending on project settings). I've got a CodeTemplateEngine, with two derived classes VBTemplateEngine and CSharpTemplateEngine. This question regards creating the property signatures based on columns in a database table. Using the IDataReader's GetSchemaTable method I gather the CLR type of the column, such as "System.Int32", and whether it IsNullable. However, I'd like to keep the code