Marius Gheorghe

On building software. And the other stuff in between.



Moved to CodePlex

02 March 2011

Moved all my OSS projects from BitBucket to CodePlex. Here's the profile page159 with links to all projects. Source control is Mercurial for everyting. And speaking of Mercurial, TortoiseHG 2.0 was released todays and looks very nice.

 


Building my own

10 February 2011

It's nice to be a developer. If no one builds the app i want i can just build it myself. And this is exactly what i have done for Windows Phone 7. Here are my current projects (OSS) :

 

News for Hackers - a client for HackerNews (code located here159)

 

Searcher - a simple app that allows you to search using multiple search engines (code located here160)

 

Unfortunately i can't publish them to the official WP7 marketplace (because i can't create a developer account from Romania) but feel free to try them if you have developer unlocked phone.

 


How to download xaps from the WP7 marketplace

01 February 2011

I have decided to publish this hoping that MS takes more seriously the WP7 marketplace security. I stumbled upon this while debugging another app with Fiddler and having Zune started. Basically, as far as i could tell, Zune pulls all the UI data unecrypted from MS server formatted as atom feeds. Worse is that the actual app download is also done without at least being authentificated.

Basically , let's see how we can get the Adobe Reader xap file.  The first query should be a search :

http://catalog.zune.net/v3.2/en-US/apps?q=adobe%20reader&clientType=WinMobile%207.0&store=zest&orderby=downloadRank 

This will return a feed with details for all apps who match the search criteria (in this case the search for Adobe Reader returns 2 applications).

From this we only have to grab the app id (which is a guid). With this guid we have to request the full app details :

 

http://catalog.zune.net/v3.2/en-US/apps/{productId}?clientType=WinMobile%207.0  

Obviously replace {productId} with the actual id. This will return another feed with app details and between those details we find the actual URL directly to the xap file


 

Microsoft, please change this.

 


MS should do something about the Marketplace reviews

21 January 2011

See this post160 about the current situation with the WP7 Marketplace comment and scoring system. As developers we should have the option to answer the reviews. And comments with factual errors about the app functionality should be deleted.


How not to do error handling

14 January 2011

In this case MetroTwit160





The ctor throws a exception, they show a dialog and clicking OK just shows another instance of the same dialog again. And basically the app can't start anymore


HackerNews OSS project for WindowsPhone 7

17 December 2010

115

I really like HackerNews but the WP7 browser is not really the best way to enjoy the site content. So i cooked up NewsForHacker, a OSS app that will hopefully make HN more enjoyable on a WP7 device.

Unfortunately i can't publish the app on Marketplace (can't create a dev account from Romania) so if you think you can help with this, please contact me.


IronPython and Ruby failure

25 October 2010

So it's official now.  Even if Jason Zander tries to put a positive spin of it for me it's pretty clear that the dynamic language experiment has ended at MS (at least for now). I would venture to guess that overall lack of interest, lack of  tools support and no way to monetize this killed IronPython/Ruby. 

There's always Boo i guess.

 


Seesmic for Windows Phone 7 now available in the WP7 Marketplace

18 October 2010

Grab it and send me your impressions. 

 

 


Windows Phone 7 development

20 August 2010

Not much time for blogging lately. Sigh. Anyway, from my previous post it should be clear that i am working on a WP7 project. The app i am working on should be up in the marketplace at the end of October when the phones will be released.

Here are a couple of comments related to WP7 development :

- don’t treat it as a toy. If you approach the platform with the “desktop developer” mindset you will fail. Hard.

- think a lot about usability when designing the UI of a mobile app.

- understand the app lifecycle and the various performance tradeoffs.

- it’s Silverlight 3 with phone specific additions. You can use some stuff from Silverlight toolkit but don’t count on too many things working out of the box. Look into panorama & pivot controls. They are very useful in a lot of UI scenarios.

- the “runtime” (compact CLR + Silverlight) is pretty fast. For “regular” stuff you’ll never need to worry about performance.


Clue about my latest development whereabouts

04 August 2010

Here's a clue about my latest development whereabouts


Bad experience with extension methods

12 July 2010

Had some bad experience with a OSS library in the context of extension methods. 2 rules were broken:

- the logic of a very important type in that library was implemented with extension methods.

- the extension methods were declared in DIFFERENT namespaces (!!!).

 

That, frankly, is just dumb. Extension methods are used for extending types for which you don’t have the code. Even if you break this rule remember to put the extension method in the same namespace of the extended type so that when somebody is importing the namespace of that type it has access to ALL extension methods automatically.


Tip to start VS2010 faster

07 June 2010

Add “/nosplash” as a command line argument to VS2010. This shaves off a few second from the loading time .


Working with Fiddler on localhost

11 May 2010

Change “localhost” to “127.0.0.1.” (notice the dot after 1). This should do the trick.


Haiku OS show remarkable improvement

11 May 2010

Just tried the latest Haiku release. Great stuff. Even in VirtualBox this stuff is super fast (reminds me when i first tried BeOS 10 years ago). Haiku is a remarkable OSS feat.

 

Get it from here


Debug this

06 May 2010

 

var container = new Dictionary<int, List<Tuple<int, string, int, Dictionary<int, string>>>> ();

I'm sure it's very fun to debug the code which is using this data structure.


The daily WTF

05 May 2010

I enjoy reading TheDailyWTF everyday because that site represents best the real world. And darn, from a developer perspective, we live in a bad bad world 


VPBO – View Presenter Business Object

25 April 2010
View Presenter BusinessObject (aka VPBO) VPBO (for short) is an attempt to describe a pattern for layer structure and interaction inside of a system. It's like MVP but with a few tweaks. Notice that depending of the system, the entry point can be either the View ( in a regular ASP.NET WebForms app the request is routed to the view) or the Presenter ( in Windows Forms, WPF we call the presenter which instantiates the view).

Here's a diagram of interaction :

1. View . Responsibilities :
- describe the UI (obviously).
- basic control validation.

2. Presenter - the most important piece of the diagram. Responsibilities :
- invoke the business object(s) and get the data required by the view. Remember there is no model so you may need to invoke multiple business objects.
- data caching could be implemented here if it's necessary.
- using the view instance set the data in the view's controls.
- do logical data validation.
- pass to data back to BO to persist it.

3. Business Object. Responsibilities :
- logic goes here.


How is this different from MVP/different stuff ?
- first of all notice that there is no Model. Nor there is a interface that the View must implement. This means less code to write/change and worry about.

- from my point of view, with VPBO i'm trying to describe a way for a nice layered system implemented with the least amount of code.

- some stuff are missing compared with MVP: there isn't a way to test UI.

- should the presenter contain any kind of logic ? It can contain "logic" pertaining to his associated view. No business logic. Also this logic should be written without referencing UI controls so it can be unit tested.

- the presenter can be best described as a orchestrator. Get the BO data, display it, validate it, pass it back to BO.

- if the view is complex you are encouraged to create a master presenter along with multiple smaller presenter which handle specific UI functionality.The view knows only abour the master presenter. This represents a better way to mitigate complexity. Because "rich" UI requires a ton of code, moving that code from view to presenter(s) is a better way to mitigate complexity.

- the interaction between view and presenter can, basically, be "described" with 2 methods : Display and Save. Add more methods depending on your UI requirements. Also note that defining a interface is strictly optional.

 

Small sample using WPF here


Moved to bitbucket

20 April 2010

I have decided to move my OSS projects to bitbucket.org to ease up on collaboration. I ended up choosing bitbucket because of Mercurial which is a nice DVCS (although TortoiseHg is not yet as nice as TortoiseSVN).


How many versions of CLR are out there ?

19 April 2010

Official versions are :

- the desktop/server version that everyone knows.

- CoreCLR - the Silverlight version.

- the version from .NET Compact framework  (which runs on windows mobile phones, Xbox 360 etc)

- the version implemented in the .NET Micro framework.

 

The more the merrier, i guess.


Use Gmail as a SMTP server

18 April 2010

You can use Gmail as SMTP server to send emails. When i launched Topi last week i decided to use Gmail instead of the mail server of the hosting company (since Gmail is much more reliable). To configure it you can simply drop this into web.config  (replace test with actual account data):

<system.net>
    <mailSettings>
        <smtp deliveryMethod="Network" from="test@gmail.com">
            <network host="smtp.googlemail.com" port="587" defaultCredentials="false" userName="test@gmail.com" password="test"/>
        </smtp>
    </mailSettings>
</system.net>

 

Make sure you use port 587 because it won't work with the other one. Also i decided to use log4net to receive logging data for email so, since log4net Smtp appender doesn't support TLS authentification, i have added this to Microruntime.


Topi is live

14 April 2010

My latest project is now live. Topi is a microblogging platform for the romanian market. It was a single man effort (except for some graphic design which was made by my wife) and i'm happy with the result.

So, if you speak romanian and you're interested in a Twitter like service, then please also look at Topi.

 


More protected

07 April 2010

You can't alter a page's viewstate with a instance variable  because it's protected. I hate the fact that if MS employees cannot think of a good reason why something should be public , they make it protected.  More context here .


I'm back

07 April 2010

Happy to be back. That's all.


Model Viewer Presenter. Take 3

17 December 2009

In the past months i have been implementing in my projects MVP Passive View. You can find the description here. It works pretty good (in Windows Forms and Silverlight projects) and , from my point of view, it's far better than the "other" MVP implementation because the view remains without any logic responsability.

Here's how i implement it. Basically for each view action there is a associated method in the presenter.

public class OrderViewPresenter
{
  private OrderViewDialog dialog = null;

   public OrderViewPresenter(OrderViewDialog d) 

  { 
dialog = d; 
  } 


  public void DisplayData()
 {
//invoke the Order Business Object and load the order
Order o = .......
d.textBoxOrderDate = o.OrderDate;
 }


 public void CreateNewOrder()
 {
//create the new order base on the dialog data
 }

}



No branching. You're kidding...right ?

14 December 2009

In real world you get to see a lot of WTF code. A lot. And then you stumble upon things like this. It looks like Flickr doesn't do branches , has only trunk and it pushes the trunk code into production a few times a day. For any software developer that's a giant WTF moment. It simply cannot be a good ideea. 

Funny thing is that i met people who used to think that's a good ideea. I bet that when the next guy comes along will point that blog post to me and say : "But look at Flickr guys. It works for them" .  Sigh...

 


Heartstone trilogy

10 December 2009
queen of oblivion


Thumbs up. Worth reading.

Coders at work

25 October 2009


Good stuff. I enjoyed Joe Armstrong interview the most. The only nitpick i have is that the author didn't insisted more on "development tools". From my point of view a programmers is partially "defined" by the tools is using so it was a little disappointing to see that they talked so little about this.Recommended.

Duct tape ? No no no

30 September 2009
Joel's latest piece takes the cakes as being the crappiest piece of advice. It's pretty fucked up to read development advices about Netscape developers. That's the Netscape who had a crappy codebase and crappy product (see a relation between those two ?).
Don't duct tape any code today. DO not be a "event handler programmer". Think about the future

Documentation error in EntityFramework

15 September 2009

Here's the description for entityCollection.Load(MergeOption.OverwriteChanges);

 "Objects are always loaded from the persisted store. Any property changes made to objects in the object context are overwritten by the store values."

 

Wrong.

If you add an item to the entity collection and then call Load(MergeOption.OverwriteChnages), you will STILL find that item there. To get data from database, you'll need to do :

entityCollection.Clear();

entityCollection.Load(MergeOption.OverwriteChanges);

 


Thoughts on code : Documenting a business software system

27 August 2009

So, first of all, how would a GOOD documentation would  help us ? What would we gain from it ? Well :

- new people could be brought to speed very easely. No need to chaperon them while they understand the system, no need for different programmers to each explain to the new guy a small piece of the system.

- easy maintainance.

- remove dependency from the people who designed/understand the system.

 

Here's my take on what and how this should be done.


- document the initial requirements of the project.

- the "core" of a business system is the database schema . That's the most important thing which should be documented.  SqlDoc is a great tool for this. If you can't afford it then use a simple text editor. But DO document the schema of the database.

- document all the business procedures and requirements of the system. Some businesses have some pretty wacky procedures and requirements (if you worked with a financial system for instance, you probably already know that). Gather all these procedures and requirements and document them. Make sure the documentation is "tied" to the documentation of the database schema.

- create a entity relationship diagram.

- the most important advice of all : be explicit. Do not use shortcuts in the name of the database columns and do explain the specific business terms.

 


The last wish review

19 August 2009


Funny thing....the intro movie from The Witcher is actually based on the first chapter of the book. Good stuff. The book is composed of a few short stories interwoven together. It's okeish but nothing great. I hope the saga will be better  (although it will take some years until it will be translated in english....the second book in the serie was written in 1995 and it will be released in english in 2010).

 


Thoughts on code : Comments

16 August 2009

My thoughts about code comments :

- code and API comments are 2 different things and should be treated differently. 

Code comments :

- most of the time "method" comments should NOT be necessary.  Code should be written using guidelines that specify long and meaningfull names to all types. Hence if the method is called GetAvailableUsers then what's the point in adding a comment like "Gets the available users"?  The method name already tells the person who's reading the code what is does.

- comments should ONLY explain the WHY (why is the code doing this thing in this way ?). We can find the HOW just by reading the code.

- comments should be added only when there is need for them. There is no point in commenting everything (most people hate "green noise" when they read code).

- some people use comments hoping to "fix" badly written/broken code. This is SOOO wrong.  Documenting a mistake will not make it better. Consider refactoring the code and removing the comment.

- comment rot is very bad. When you refactor a piece of code, DO remove the unnecessary  comments.

- do NOT create a file header (with the name of the person who created the file, creation date etc etc). These stuff can be easely inferred from source control.  


API Comments :

- code samples are much more important than comments.  It's much more simple for the API user to have a sample on how to achieve a certain thing then to try figuring for himself by reading the API comments.


Netscape's Code Rush

12 August 2009

Interesting documentary about the first days of the Mozilla project.

Few things jumped (back) to mind :

- Microsoft was beeing sued for making a free product. Oh...the irony.

- Netscape Navigator was pretty crappy compared to IE (4). Using IE4 in Win98 was a MUCH better experience than using Netscape.

- try to imagine the browser landscape today if Ms wouldn't have abbandoned IE after winning the Netscape battle.

- kind of ironic to see that a corporation opened the code to save itself, failed to do so (AOL buy Netscape sealed the deal) but , years later, there is a company which makes money from Netscape's code (yeah..i know....most of the code is rewritten but you get the point).


Architecting Applications for the Enterprise

11 August 2009


It's a pretty good reference book. Sometime it feels like it rehashes POEAA but overall the content is ok. The only exception is the Data Access chapter which could have simply been replaced with "Use a ORM".

360 top JRPGS

30 July 2009

Here my personal top of JRPGS  on the 360 :

1. Lost Oddysey

By far the best one on the platform. It's a massive release (spanning 4 DVD) and takes around 30 hours to complete. The best feature of the game it's the writing (both the storyline and the little stories you find through the game). Related to the little stories......it's pretty weird to have a 28GB game on a HD system and say that the best time you have in the game is simply squinting to read pieces of text. The combat is kind of annoying (standard turn based jrpg fare) but again the writing more than makes up for all the game shortcomings.

2.Tales of Vesperia

This one is a game from the tales series by Namco. Pretty good overall, with some "strong" connections between the party members and some genuine funny writing. The overall story arc is not that interesting. I liked the graphics style (cell shading) and while the quality doesn't reach Eternal Sonata's level , it is quite good.

 

3.Eternal Sonata

Gorgeous cell shaded graphic and THE best battle system (it's real time in a "arena") in any JRPG. These 2 are the best elements of this game. The quirky setting also helps....the game is based on the last hours in the life of Chopin. The storyline is not that interesting unfortunately.

4. Infinite undiscovery

The only good part of this game is the battle system (it's real time on the same map as exploring). Unfortunately the characters are not that interesting and neither is the story.

5. The last remnant

Again a interesting battle system (it's a little more tactical than the rest and it's based on the idea of controlling multiple units) is the only good part of this game.

 

6. Star Ocean : The last Hope

From my point of view the worst game so far....uninteresting plot, cliche characters, worst checkpoint position in the history of JRPGS and the list goes on. Avoid this one.


Disappointed by Silverlight support in Visual Studio

10 July 2009

I've started working on a pet project in Silverlight a few days ago (using VS 2008). And frankly there are quite a few problems with Silverlight itself and support for it in Visual Studio :

- the designer is useless. Basically there is NO designer support (meaning drag and drop) for both Silverlight 2 and 3 in Visual Studio 2008. 

- no *proper* SOAP  Web Services support. Instead web services are invoked using WCF backward compatibility model and, here is the kick, are async ONLY. Async calls would make sense if Silvelight didn't have threads.....but since it has threads, why the heck am I forced to call everything aysnc ?!  Also SOAP headers are not properly supported  event though these guys say otherwise.

- still not enough controls.


AOP. Not really a fan

24 June 2009
I'm not a fan of AOP. I think that in a well design (layered) system there shouldn't be any "cross cutting concerns". Each layer should deal with his responsibility/es. Security is always given as a example of "cross cutting concern".  But i disagree with this.....security is a top level "concern". There's no point in checking credentials/access rights  AT every level of the application.  Not to mention that usually the security features of a application usually permeate to the UI level (as an example.....if the user has the option to edit a record...if it doesn't have the rights to edit it you simply disable the button. If don't let him type and then go 2 layers below to check for rights and then you show a error message....that's bad UI).

Security should really be enforced in the "entry point" layer of the system (be it UI or service).


EntityFramework - the good, the bad and the ugly

24 June 2009

Well,  i have been working with EF for a while and here are a few impressions :

the good :

- has UI (designer) tool for (automatic) mapping.

- offers support for advanced mapping (unfortunately in the first version only if you edit manually the xml mapping file).

- full LINQ integration (by far the biggest advantage).

 

the bad :

- on the persistence front,  it has support only for the "big brother" (in this case ObjectContext) which manages entity state and persist them. It doesn't offer a API to do "manual" operations. This makes it very awkward to use in ASP.NET (where most likely you'll have a ObjectContext per request and the entity state can't be tracked down automatically). From my point of view this is by far the biggest disadvantage of the API.

- support only for SqlServer.....i think it will be a while until we can use with something else.

- the MetadataWorkspace used for querying mapping data is a bit hard to use (this is especially bad considering that the first version of EF doesn't support POCO persistence).

 

the ugly:

- the VS  designer. I hate that crap. It gets unusable with many entitites and it generates all the code in a single file (nightmare for source control).

Plus it's  integrated in VS ( and in this case this IS a BAD thing).


Could Moblin shake the netbooks OS market ?

26 May 2009

I was reading the ArsTechnica's hands on with the Moblin platform and it really does like it could shake up a little the netbooks market. As a plus, leaving aside the fact that is backed by Intel, this is a project that tries to do something different (from a UI perspective) and could gain some traction.

We'll see if it can steal some marketshare fromWin 7/XP.

 

 


More games

18 May 2009

 

Resident Evil 5

I was pretty disappointed by this one actually. The Resident Evil series is defined by 2 important attributes : survival horror and clunky controls. In RE5 they decided to remove

the “horror” part and make a straight action game but they kept the clunky  controls. From a gameplay perspective RE5 is JUST a HD copy of RE4. The problem is that, while in RE4 the horror bits set up the atmosphere, RE5 looks like a shallow, broken (because of the controls) (HD) copy without those bits.

  

Wolverine

Over the top violence, silly storyline, great cut scenes and  a lot of bugs. Did i mentioned the over the top violence ? Must try.

 

 

Velvet Assassin

A good old stealth game set in WW2 played from a 3rd person perspective.

Pros :

- the atmosphere  is really great.

- graphics (really nice…especially the dark/light interplay).

- good stealth based gameplay ( i really missed this from the days of good old Thief)

Cons :

- use of firearms (the fact that you can use firearms and also the fact that aiming is a PITA )

- the last level can’t be played in stealth mode and the game simply turns into a crappy shooter.

- bad placement for checkpoints .

 

Conclusion : if you like stealth games then this is a must try.


efbog

07 May 2009

efbog - the Entity Framework Business Object Generator is the project i mentioned  a while ago. Basically it generates DataBlock like business objects for Entity Framework. The project's page is here


Better software with 2 simple rules/patterns

05 May 2009

I'm talking about :

- DRY (Don't Repeat Yourself) - a common source of bugs in any project is duplicated code. Code which does the same thing with different implementations. The easiest way to fix this is to enforce a certain project structure : for instance in a business application all entity related task must be implemented in a single class/place/system ( call it the repository pattern, call it business object, called it whatever it tickles your fancy ...).

- SOC (Separations of concerns) - SOC is the process of designing a system in which the functionality is segregated in clearly independent (and orthogonal )  layers. This might sound more familiar by the name of some popular SOC patterns : MVP (Model Viewer Presenter) and MCV (Model Controller Viewer).  Failure in implementing a/any form of SOC results in fragile, brittle, hard to maintain (and extend) software.


Opera's homepage today

28 April 2009

Looks like the Opera browser is 15 today. Go and check out their site for a throwback on how the web looked like 10-15 years ago. It's almost friggin amazing how much the web evolved...


DataBlock. Stick a fork in it….it’s done.

23 April 2009

  This is a post long overdue. I regularly get mail about DataBlock's future so i’m happy to say that (remaining bugs aside) …folks stick a fork in it cause it’s done.  I consider that i have achieved with DataBlock what i set out to do : a small, lean, separation of concerns enforced, easy to deploy, simple API  O/RM. The only thing that is missing now would be LINQ integration (unfortunately that’s a pretty big undertaking and i don’t really have time for this now….at least as a open source. If somebody is interested to sponsor this then contact me).

  So  i guess it’s safe to say that, while bugs will be fixed, no new features will be added.  A related project that i am planning is adding DataBlock business objects like API to Entity Framework. But that’s another story…


Learn XNA 3.0

07 April 2009

I have became pretty interested in game development lately (as a hobby)  and so i've started learning XNA. The first step was to read "Learn XNA 3.0" which is a pretty good book on the subject (although the XNA API could have been explained a little more thoroughly).


Latest Resharper build

31 March 2009

Wowed by the latest beta performance improvements i have installed it. While it is a bit snappier when loading a big solution, Resharper’s auto completion is hopelessly broken in this beta (it crashes a lot throwing a LookupWindow related exception….yeah yeah….i have reported it). I’m anxiously expecting the final release but frankly i am beginning  to think that no matter how great this tool is, some part(s) of it will always be broken (until now the loading time for big solutions was almost unbearable).


Crappy markup

30 March 2009

The ASP.NET menu control is spiting out some truly crappy markup. It fails to work on IE8 (in standard mode), Safari, Chrome and Opera. Time to replace it with CSS+JS equivalent.


Nice accessibility feature

20 March 2009

I noticed that the newly released IE8 has a nice accessibility feature. Basically  in the current URL the domain name is “painted” with another color making it very easy to spot.

Little little things :)


Silverlight 3 beta is out already

18 March 2009

Looks like the Silverlight team is on a roll. Silverlight 3 beta is already here


Haxe – the metalanguage

18 March 2009

Haxe is a pretty interesting idea. Basically a language who’s compiler can spit out source code in JS/PHP/Flash/C++ . In theory this is very interesting, in practice it looks like you’ll end up writing a “solution” in (at least) 2 languages……the logic in Haxe and the things unsupported by Haxe libraries (like UI toolkit) in “other” language.

 

Somehow related, Parrot 1.0 is out (slashdotted now).


On REST and SOAP

10 March 2009

     Despite what any REST fan would say, from the perspective of a OOP guy, SOAP makes much more sense. The invoked “complexity” of SOAP over REST is simply perceived complexity. If tools “shield” you from SOAP complexity then is SOAP complex ? The reality is that SOAP and REST accomplish the same thing but they operate on different levels . In SOAP case you have objects, methods, exceptions etc. In REST’s case you have a HTTP request and HTTP error codes (and yeah…it’s much nicer to get a SoapException describing the problem than to “remap” different error codes in your head for each request).

    From the perspective of the guy who must expose the service is much simple to “define” complex interactions with SOAP. Even the basic entity interaction (CRUD) is not so simple with REST because you’ll always need to expose multiple ways (with associated parameters) for GET (GetOrderByDate, GetOrderByCustomer, GetOrderByStatus etc). Even worse is exposing business logic errors with HTTP error codes.

So, i think that REST is fine for very simple “interactions” , for everything else go SOAP.



I'm Marius Gheorghe, a software craftsman. This is my personal blog, opinions are entirely mine, blah blah.


Contact me :
Mail : gmarius@gmail.com

Twitter : @mariusgheorghe

LinkedIn