Opinions requested on my blog post about primitive obsession.

So, I just finished the first draft of an article on the benefits of avoiding primitive obsession.  I'd like some feedback on the article. <shameless>Also, posting this message is a good way to promote my blog.</shameless>Any feedback is very welcome. Either using the comment system, or by following up on this thread.  Comment system is preferred (think of it as a followup-to header).<http://virtualinfinity.net/wordpress/program-design/2007/10/28/primitive-obsession/>Thanks,Daniel.P.S.  If anyone has an opinion, positive or negative, about my "advertising" my blog-posts in this manor, feel free to let me know here.  I don't want to be classified as a spammer, and I feel that I contribute enough to this community that the occasional unsolicited message is appropriate.  Let me know if you feel otherwise.-- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
0
Daniel
10/28/2007 7:23:37 PM
comp.lang.java.programmer 52490 articles. 0 followers. Post Follow

8 Replies
393 Views

Similar Articles

[PageSpeed] 4

On Sun, 28 Oct 2007 12:23:37 -0700, Daniel Pitts<newsgroup.spamfilter@virtualinfinity.net> wrote, quoted or indirectlyquoted someone who said :>P.S.  If anyone has an opinion, positive or negative, about my >"advertising" my blog-posts in this manor, feel free to let me know >here.  I don't want to be classified as a spammer, and I feel that I >contribute enough to this community that the occasional unsolicited >message is appropriate.  Let me know if you feel otherwise.the big advantage to your way, is you can modify your essay based onthe feedback.  If you do it via posts, your errors sit there foreverto mislead others.So I figure anything more that a couple of paragraphs should be postedas html.-- Roedy Green Canadian Mind ProductsThe Java Glossaryhttp://mindprod.com
0
Roedy
10/28/2007 11:00:48 PM
On Sun, 28 Oct 2007 12:23:37 -0700, Daniel Pitts
<newsgroup.spamfilter@virtualinfinity.net> wrote, quoted or indirectly
quoted someone who said :

><http://virtualinfinity.net/wordpress/program-design/2007/10/28/primitive-obsession/>

I have been lobbying since the 1970s  for units of measure as a built
in feature to create a friendly language for engineers.  

If you have both British and ISO measure in the same program, SO many
errors happen because of invalid assumptions about measure.  Even with
pure ISO, powers of 10 errors are easy to make.  

With declared units of measure you can have:
1. dimensionality consistency checks.
2. automatic unit conversion.

Units of measure are NOT classes. They are compile time modifiers to
primitives.  You could think of them as generics for primitives.

see http://mindprod.com/jgloss/unitsofmeasure.html
-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
0
Roedy
10/28/2007 11:05:58 PM
Roedy Green <see_website@mindprod.com.invalid> writes:>Units of measure are NOT classes. They are compile time modifiers to>primitives.  You could think of them as generics for primitives.  They can be used in Fortresshttp://research.sun.com/projects/plrg/Fortress/overview.html  Language Specificationhttp://research.sun.com/projects/plrg/fortress.pdf  JVM-based interpreter for a subset of the languagehttp://fortress.sunsource.net/
0
ram
10/28/2007 11:22:28 PM
On Oct 29, 10:05 am, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> On Sun, 28 Oct 2007 12:23:37 -0700, Daniel Pitts
> <newsgroup.spamfil...@virtualinfinity.net> wrote, quoted or indirectly
> quoted someone who said :
>
> ><http://virtualinfinity.net/wordpress/program-design/2007/10/28/primit...>
>
> I have been lobbying since the 1970s  for units of measure as a built
> in feature to create a friendly language for engineers.  

I understand completely :-)

Before I moved into the IT world, I spent many years in the
metal and engineering trades, converting between Metric and
Imperial units on a daily basis.

> If you have both British and ISO measure in the same program, SO many
> errors happen because of invalid assumptions about measure.  Even with
> pure ISO, powers of 10 errors are easy to make.  

Indeed.

> With declared units of measure you can have:
> 1. dimensionality consistency checks.
> 2. automatic unit conversion.
>
> Units of measure are NOT classes. They are compile time modifiers to
> primitives.  You could think of them as generics for primitives.

I don't see why the couldn't be represented as classes.
Units can be viewed as an abstraction to measurement types.

I haven't used AutoCAD in a while, but I'm reasonably sure that they
worked with units in such a way - You just specify the unit type and
begin drawing.

--
Chris

0
Chris
10/29/2007 4:37:51 AM
On Oct 29, 12:05 am, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> On Sun, 28 Oct 2007 12:23:37 -0700, Daniel Pitts
> <newsgroup.spamfil...@virtualinfinity.net> wrote, quoted or indirectly
> quoted someone who said :
>
> ><http://virtualinfinity.net/wordpress/program-design/2007/10/28/primit...>
>
> I have been lobbying since the 1970s  for units of measure as a built
> in feature to create a friendly language for engineers.

And that's why people have developed frink. http://futureboy.homeip.net/frinkdocs/

It didn't take them 30 years of lobbying. Just some Java coding.

> If you have both British and ISO measure in the same program,

ISO? Do you mean SI? ISO doesn't do units.

> If you have SO many
> errors happen because of invalid assumptions about measure.  Even with
> pure ISO, powers of 10 errors are easy to make.
>
> With declared units of measure you can have:
> 1. dimensionality consistency checks.
> 2. automatic unit conversion.

>From an interactive  Frink session (first line after an empty line is
the input, followed by Frink's response):

Frink
Copyright 2000-2007 Alan Eliasen, eliasen@mindspring.com
http://futureboy.us/frinkdocs/
Enter calculations in the text field at bottom.
Use up/down arrows to repeat/modify previous calculations.

var m is mass = 10 pounds
45359237/10000000 (exactly 4.5359237) kg (mass)

m = 11 pounds
498951607/100000000 (exactly 4.98951607) kg (mass)

m = 11 meters
BasicContext:  Cannot set symbol m, ContextFrame threw exception:
  Constraint not met--value must have dimensions of mass

m = 1 kg
1 kg (mass)

m -> pound
100000000/45359237 (approx. 2.2046226218487757)

10 volt
10 m^2 s^-3 kg A^-1 (electric_potential)

20 amp
20 A (current)

10 volt * 20 amp
200 m^2 s^-3 kg (power)

10 volt * 20 amp -> watt
200

10 volt * 20 amp -> meter
 Conformance error
   Left side is: 200 m^2 s^-3 kg (power)
  Right side is: 1 m (length)

var p is power = 10 volt * 20 amp
200 m^2 s^-3 kg (power)

p = 10 watt
10 m^2 s^-3 kg (power)

0
Hunter
10/29/2007 6:58:17 AM
Roedy Green wrote:> I have been lobbying since the 1970s  for units of measure as a built> in feature to create a friendly language for engineers.  The Measures and Units API (JSR-275) seems to be the answer to your efforts.See introductory article:<http://www.javaworld.com/javaworld/jw-10-2007/jw-10-jsr275.html>As the article states, there is still no decision on inclusion of the JSR-275 API in Java 7.  Up to now, there is also no mention of 'javax.measure' package in official list of Java 7 packages (http://download.java.net/jdk7/docs/api/).  So, my guess is that we should wait a bit longer for that...  Hopefully, intermediately we may use mentioned in the article the reference "draft" implementation from the JScience project (http://jscience.org/).piotr
0
Piotr
10/29/2007 10:48:37 AM
On Sun, 28 Oct 2007 23:05:58 GMT, Roedy Green<see_website@mindprod.com.invalid> wrote, quoted or indirectly quotedsomeone who said :>If you have both British and ISO measureoops British and SI measure.-- Roedy Green Canadian Mind ProductsThe Java Glossaryhttp://mindprod.com
0
Roedy
10/29/2007 12:23:04 PM
On Sun, 28 Oct 2007 21:37:51 -0700, "Chris ( Val )"<chrisval@gmail.com> wrote, quoted or indirectly quoted someone whosaid :>I don't see why the couldn't be represented as classes.>Units can be viewed as an abstraction to measurement types.If you make them a something like generics for primitives, they havezero run time extra overhead.  This is important forcomputation-intensive engineering programs.-- Roedy Green Canadian Mind ProductsThe Java Glossaryhttp://mindprod.com
0
Roedy
10/29/2007 12:24:39 PM
Reply:

Similar Artilces:

java.lang.ExceptionInInitializerError: java.lang.ArrayIndexOutOfBoundsException
Hi, I am new to DB2. I am getting this error while loading the DB2Driver. I don't have any idea about where i might have gone wrong. please help me. Below is the stack trace. Stack Trace: java.lang.ExceptionInInitializerError: java.lang.ArrayIndexOutOfBoundsException at COM.ibm.db2.jdbc.app.DB2Driver.SQLAllocEnv(Native Method) at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:245) at COM.ibm.db2.jdbc.app.DB2Driver.<clinit>(DB2Driver.java:130) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Cla...

java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460)
Hi All I am having the torque3.1.jar and postgresql-7.4. I have compiled the new jdbc driver called as postgresql.jar and have placed it in the lib directory from where the ant scripts catch the jars. Whenever i try to access through torque gestList = BaseGestlistPeer.doSelect(new Criteria()); this error arises java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460) at org.postgresql.jdbc2.ResultSet.toTimestamp(ResultSet.java:1653) at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java...

Post Requests in java servlet
All, The first time I make a request to my servlet this calls the doGet method which builds a page using XML and XSLT depending on the identity and Authorisation the user has. A form comes back to client and when submitting this form the doPost method is called which provides several responses the correct one being a page which allows the user to make some further selections and submit which will then call the doPost method again. Consequently there is a lot of logic in the doPost method. I understand that I could have more than one servlet but ideally I would like to have some sort of cont...

java.lang.Set with elements of type java.lang.Set
Roughly I do something along the lines of: Set set = new HashSet(); Set elem = new HashSet(); set.add(elem); // now we change the elem and add it again to the set elem.add(some object here); set.add(elem); I found out the hard way that 'set' may now contain 'elem' either once or twice, the reason being that 'elem.add()' changes the hashCode of elem such that it is not noticed that it is in 'set' already on the 2nd 'set.add()'. Question: What I would actually want is an IdentityHashSet() set = new IdentityHashSet() but this does not...

to use import java.lang.* or import java.lang.Math or none at all?
Hi guys, i knew that by default all java.lang classes will be imported by the compiler during compilation. but, to make it easier for the computer, should i specify which class i really will be using? does this action will boost the performance during compilation and runtime or not a matter at all? the answer to this post will definitely affect my programming style in the future when i'm considering "to import or not to import"... hmm,,, thanks in advance. JPractitioner wrote: > i knew that by default all java.lang classes will be imported by the > compiler during com...

Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
I downloaded jdk-6u7-solaris-sparcv9.tar.Z and installed it by these commands: # zcat jdk-6u7-solaris-sparc.tar.Z | tar -xf - # pkgadd -d . SUNWj6rtx SUNWj6dvx SUNWj6dmx # /usr/jdk/instances/jdk1.6.0/bin/sparcv9/java -version Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object # ls /usr/jdk/instances/ jdk1.5.0 jdk1.6.0 # uname -a SunOS sun1 5.10 Generic sun4u sparc SUNW,Sun-Blade-2500 Please help to fix the error. Thanks. TsanChung wrote: > I downloaded jdk-6u7-solaris-sparcv9.tar.Z and installed it by these > commands: > # zcat jdk-6u7-so...

NEW JOB POSTING: Java Programmer
******** 2 Positions please when submitting your resume indicate which postion you're applying to (1 or 2) ********* Title: Java Programmer (Position 1) Location: Palo Alto, CA (Bay Area) Length: 3 Months (with good possibility for extension) Type: W2-Contract Only Pay Range: DOE Description The candidates will be working on a project -- it&#146;s a query and browse system for the client&#146;s global data warehouse. The system is going through major design refinement and has deliverables in Q4. Required - Minimum 6 years experience in...

NEW JOB POSTING: Java Programmer
******** 2 Positions please when submitting your resume indicate which postion you're applying to (1 or 2) ********* Title: Java Programmer (Position 1) Location: Palo Alto, CA (Bay Area) Length: 3 Months (with good possibility for extension) Type: W2-Contract Only Pay Range: DOE Description The candidates will be working on a project -- it&#146;s a query and browse system for the client&#146;s global data warehouse. The system is going through major design refinement and has deliverables in Q4. Required - Minimum 6 years experience in...

NEW JOB POSTING: Java Programmer
******** 2 Positions please when submitting your resume indicate which postion you're applying to (1 or 2) ********* Title: Java Programmer (Position 1) Location: Palo Alto, CA (Bay Area) Length: 3 Months (with good possibility for extension) Type: W2-Contract Only Pay Range: DOE Description The candidates will be working on a project -- it&#146;s a query and browse system for the client&#146;s global data warehouse. The system is going through major design refinement and has deliverables in Q4. Required - Minimum 6 years experience in...

2008 computers.lang for java.programmer
jwehnf iuwhhttp://www.freewebs.com/thuiss/http://indianfriendfinder.com/go/g906725-pmem ashik wrote:Sub: 2008 computers.lang for java.programmerYou have nothing of value to anybody here. Pleasestop wasting our bandwidth.Further, please don't become the latest in a long line of perennial spamming f*ckw*t morons who infestthis usenet newsgroup.-- Andrew Thompsonhttp://www.physci.org/Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1 Andrew Thompson wrote:> ashik wrote:> > Sub: 2008 computers.lang for java.programmer> > You have nothing of...

Another java.lang.OutofMemoryError posting
I get the workspace error java.lang.OutOfMemoryError often doing fairly different tasks using 7.0.4.352 (R14) Service Pack 2 both on an Athlon XP and dual-Opteron Gentoo linux machine. There have been many postings about this error. I've tried the solution on the mathworks site (-XX:ThreadStackSize=8192 in java.opts) as well as trying several different Java VMs using the MATLAB_JAVA environment variable, but the problem persists. This frontend is excellent and if I could figure out this particular issue with MATLAB, it would be a great help. I'm wondering if others have tried other s...

Error occurred during intialization of VM java/lang/NoClassDefFoundError: java/lang/Object
Good day to all, I have installed the j2se/netbeans binary bundle on red hat 9. I can run everything perfectly as root but when I try to compile with any other user I get: Error occurred during intialization of VM java/lang/NoClassDefFoundError: java/lang/Object When I saw this it seemed like a permissions problem but I checked the permissions and everything seemed fine. All users have execute permissions of javac and java. I have read other threads dealing with the same or similar problem but have not reached any solution yet. I would appreciate if anyone that has run into this type o...

CheckBox in Column of JTable: Exception: java.lang.String cannot be cast to java.lang.Boolean
Hello, I have discovered a hidden error. My project was working for awhile, but then I started to get the below error. My error comes from the fact that I'm using a checkbox in a jtable, and I'm using the below "getColumnClass". Thank you, compile: run: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean at javax.swing.JTable$BooleanRenderer.getTableCellRendererComponent(JTable.java:5412) at javax.swing.JTable.prepareRenderer(JTable.java:5735) at javax.swing.plaf.basic.BasicTableU...

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
Hi, I'm trying to use the httpclient within Jython (see http://jakarta.apache.org/commons/httpclient/ for more information on the httpclient). My Jython version is: Jython 2.1 on java1.4.2_04 (JIT: null) My Java version is: java version "1.4.2_04" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode) My CLASSPATH includes: jdom.jar xerces.jar jython.jar jt400.jar log4j-1.2.8.jar commons-httpclient-2.0.jar When I just try to perform the import statements from example code I get the error pasted below....

Web resources about - Opinions requested on my blog post about primitive obsession. - comp.lang.java.programmer

Category:Wikipedia requested photographs in Durham County, North Carolina - Wikipedia, the free encyclopedia ...
Category:Wikipedia requested photographs in Durham County, North Carolina - Wikipedia, the free encyclopedia ...

The article requested cannot be found! Please refresh your browser or go back. (CP,20120705,,-1,AR).
postandcourier.com delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and ...

Somali refugee deported after claims she rejected the abortion she requested
The Somali refugee who says she was raped on Nauru and asked for an urgent abortion in Australia has been returned to the island, with claims ...

Nathan Tinkler says $53,000 in illegal donations was for federal Liberal party as requested by former ...
CONTROVERSIAL mining magnate Nathan Tinkler has &#173;explained his role in $53,000 in &#173;illegal donations to the NSW Liberals by telling ...

Cardinal George Pell says he will give evidence to commission into child sexual abuse if requested
Serial child sex offender and paedophile priest Gerald Ridsdale says he never asked George Pell to support him when he first faced court over ...

Bombardier drops requested injunction against strikers
Bombardier and Unifor officials spent hours in the Thunder Bay courthouse on Wednesday coming to an agreement on picket line protocol as 900 ...

404 - Requested Page Not Found
Canadian news and headlines from around the world. Live breaking news, national news, sports, business, entertainment, health, politics and more ...

404 - Requested Page Not Found
CTV News - Edmonton - Breaking news, local headlines and top stories from Edmonton and Alberta, Canada and around the world. Sports, Weather, ...

Fort Hood shooting suspect had requested leave, army says
Army investigators havereleased a more detailed timeline of last week's fatal shootings at Fort Hood, describing an eight-minute rampage in which ...

B.C. Teachers Strike 2014: Mediation Requested By Union
VANCOUVER - With no sign of a deal on the horizon, British Columbia's unionized teachers called Thursday for mediation in hopes an independent ...

Resources last updated: 1/24/2016 10:31:21 AM