Kommentarer til: Programming vs. Flow steps http://serverdude.dk/?p=212 Yet another personal wordpress blog on programming, books, life, and other weird things Wed, 27 Feb 2013 20:23:46 +0000 hourly 1 https://wordpress.org/?v=6.0.7 Af: serverdude http://serverdude.dk/?p=212&cpage=1#comment-1317 Wed, 27 Feb 2013 20:23:46 +0000 http://serverdude.dk/?p=212#comment-1317 Fixed the issue – thanks for the heads up.

This is actually far better feedback than I imagined.

As I wrote – it was not to bash dotCMS, I’ve seen similar code elsewhere, I’ve written similar code. I simply think that the code depicts a common issue in the programming world – especially the incremental deterioration of an 8 year old code base. Well, deterioration may be the wrong terms.

I looked briefly at the Eclipse source code – they too have some less than optimal convoluted classes.

Previous blog posts call out Martin Fowler’s code as the start of big balls of mud.

]]>
Af: Will Ezell http://serverdude.dk/?p=212&cpage=1#comment-1316 Wed, 27 Feb 2013 16:25:37 +0000 http://serverdude.dk/?p=212#comment-1316 ServerDude:

Great post and you are absolutly correct regarding proper delegation vs procedural code. dotCMS is a huge project and if you dig you will find many warts – the UtilMethods you mention is from 2002 (uggh). That said, we happy that you can examine the code and as an open source project welcome the visibility that comes along with that.

Our newer classes are implementing a better pattern – see the WorkflowFactoryImpl. This code does a getInstance() that returns a different class based on the DB type running. This is a much cleaner pattern than a bunch of IF statements.

Let us know what else you find,

Will

]]>
Af: Jorge Urdaneta http://serverdude.dk/?p=212&cpage=1#comment-1315 Wed, 27 Feb 2013 14:20:26 +0000 http://serverdude.dk/?p=212#comment-1315 Hi,

the method getStatusIcons has some html tags inside the strings. it looks like you didn’t quote them here in your post. So they seems to only add empty strings.

For the rest I see your point here. It would be interesting to have te resources to rewrite our legacy of 8 years of code so we don’t have different patterns arround.

We have been trying to fight with that db pattern. See for example a recent rewritten part (workflows). We started creating a class with all the querys and then subclasses for every db that can modify the base querys where needed. See

Base class:
https://github.com/dotCMS/dotCMS/blob/master/src/com/dotmarketing/portlets/workflows/business/WorkflowSQL.java

Oracle subclass
https://github.com/dotCMS/dotCMS/blob/master/src/com/dotmarketing/portlets/workflows/business/OracleWorkflowSQL.java

Postgres
https://github.com/dotCMS/dotCMS/blob/master/src/com/dotmarketing/portlets/workflows/business/PostgresWorkflowSQL.java

MsSQL
https://github.com/dotCMS/dotCMS/blob/master/src/com/dotmarketing/portlets/workflows/business/MSSQLWorkflowSQL.java

MySQL
https://github.com/dotCMS/dotCMS/blob/master/src/com/dotmarketing/portlets/workflows/business/MySQLWorkflowSQL.java

So, we agree with you and we’re working hard everyday to make the right patterns in the code. Still there is a ton of old code hard and expensive to rewrite. Hope we will do it before we need to support another DB manager 😀

]]>