![]() |
|
OODP Review. Monday, July 31, 2006 I took a three hour mini-course on OO Design Principles. Now, go brush up on your OODP and more of its acronyms. 1) Polymorphism: behavior that varies depending on the function's class being invoked. 2) Hierarchy: a) Inheritance - allow a subclass to access members of the parent class. b) Aggregation - objects can contain one or more objects of another object. 3) Encapsulation: hide/reaveal particular details of a class. 4) Abstraction: hide the details of an subclass. 5) Objects/Classes: collection of characteristics that describe something whether it is abstract or tangible; object is an instance of a class. SRP (Single Responsibility Principle): a class should be responsible for only one thing. DRY (Don't Repeat Yourself): self explanatory, don't copy/paste. LSP (Liskov Substitution Principle): "Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it." DIP (Dependency Inversion Principle): "High level modules should not depend upon low level modules. Both should depend on abastractions. Abstractions should not depend of details. Details should depend on abstractions." OCP (Open Closed Principle): Classes, methods, functions "should be open for extension, but closed for modification." ISP (Interface Segregation Principle): "Clients should not be forced to depend upon interfaces that they do not use." CCP (Common Closed Principle): "Classes within a released component should share common closure. If one need to be changed, they all are likely to need to be changed. What affects one, affects all." ADP (Acyclic Dependency Principle): The dependency structure for released component must be a Directed Acyclic Graph. There can be no cycles." SDP (Stable Dependency Principle): "Dependencies between released components must run in the direction of stability. The dependee must be more stable than the depender." SAP (Stable Abstraction Principle): "The more stable a component is, the more it must consist of abstract classes. A completely stable category should consist of nothing but abstract classes." RREP (Reuse/Release Equivalency Principle):"The granularity of reuse is the same as the granularity of release. Only components that are released through a tracking system can be effectively reused." If you want to read more about any of these, go check out ObjectMontor. They have a lot more documents and articles there to read. I hope I'm not missing any important ones, if so add some to the list. 1 comments I When, You Lose. Thursday, July 27, 2006 (9:46:28 AM) Joseph: dang you for not bringing your tie fighter so spidey could fight it (9:48:30 AM) Thomas: lasers > web. (9:50:33 AM) Joseph: they're toys (9:50:43 AM) Joseph: we're not going into real reality (9:50:59 AM) Joseph: i'm not saying the REAL spiderman vs. a REAL tie fighter (9:51:05 AM) Joseph: i'm saying my toy vs yours (9:51:06 AM) Thomas: yeah, b/c real reality...there is such a thing of spiderman and tie fighters. (9:51:09 AM) Joseph: mine would SO when (9:51:14 AM) Thomas: SO WHEN? (9:51:15 AM) Thomas: haahaha (9:51:19 AM) Joseph: hahahaha (9:51:22 AM) Joseph: exactly 2 comments Encoding Help Needed. Wednesday, July 19, 2006 Here's the plan: There's an XML file that contains plain text data. [Attempt 1]: Use PHP and some simple parsing to convert the data to look pretty. [Results]: Crazy characters like "Joan Miró" and "peoples’" [Attempt 2]: Use C# to parse the XML and output the file. [Results]: Crazy characters like "Joan Miró" and "peoples’" After a bunch of research, I found that the TextWriter class can encode the file: TextWriter tw = new StreamWriter("fileName" + ".txt"); TextWriter tw = new StreamWriter("fileName" + ".txt", false, Encoding.Default); TextWriter tw = new StreamWriter("fileName" + ".txt", false, Encoding.ASCII); TextWriter tw = new StreamWriter("fileName" + ".txt", false, Encoding.UTF8); All of them didn't work. I've been using Ultra Edit for a while and it can do multiple file conversions. So I give it a try...ASCII to Unicode, UTF-8 to Unicode, UTF-8 to ASCII, Unicode to ASCII, DOS to UNIX, UNIX/MAC to DOS. It all comes down to set the C# encoding to Encoding.Default and then converting the file from UTF-8 to ASCII. There's no other way. It sucks. Any suggestions? UPDATE This was what I originally had at the top of the XML file. <?xml version="1.0" encoding="utf-8"?> This was what I now have at the top of the XML file. <?xml version="1.0" encoding="utf-16"?> I also had to change the TextWriter initialization from: TextWriter tw = new StreamWriter("fileName" + ".txt"); to: TextWriter tw = new StreamWriter("fileName" + ".txt", false, Encoding.Default); Thanks, Abhi and kashif for the input. BTW: "PHP assumes your XML is in ISO-8859-1!" Even if you have it set as UTF-8. This is also why PHP isn't going to work for these files, BOO. If there is a real PHP solution, let me know. We're also trying another approach using a third party PHP DB interface. 4 comments Hidden Fields Really Hidden? Thursday, July 13, 2006 I guess the developer didn't really understand how hidden fields really behaved. 1. Right click, View Source. 2. Awesome. I saw all the values in raw text. <INPUT TYPE="HIDDEN" NAME="s_id" VALUE="[usernName]"> <INPUT TYPE="HIDDEN" NAME="ControlSessionID" VALUE="[actualSID]"> <INPUT TYPE="HIDDEN" NAME="url" VALUE="http://[serverLocation]"> <INPUT TYPE="HIDDEN" NAME="RootName" VALUE="/"> <INPUT TYPE="HIDDEN" NAME="DataConn_ConnectionString" VALUE="Provider=[providerName];Data Source=[sourceName]"> <INPUT TYPE="HIDDEN" NAME="Library" VALUE="[libraryName]"> <INPUT TYPE="HIDDEN" NAME="DataConn_RuntimeUserName" VALUE="[userName]"> <INPUT TYPE="HIDDEN" NAME="DataConn_RuntimePassword" VALUE="[password]"> <INPUT TYPE="HIDDEN" NAME="Development_Mode" VALUE="N"> <INPUT TYPE="HIDDEN" NAME="ViewableLocations" VALUE="All"> <INPUT TYPE="HIDDEN" NAME="ViewableRegions" VALUE="All"> 1 comments Project BBOM, Part 3? Wednesday, July 12, 2006 After the migration of my first project, I have become the owner of the mess, awesome. I'm trying to convince the manager to let me scrap it and rewrite it. I'm currently fixing a bug that has been there for...ever. Here's what I run into trying to find the source of the bug. [ASP Page] 805 lines; last updated in 2003! lol. [lines 105-112] If (isempty(postavailable)) then postavailable = "true" End if If (postavailable = "true") then postavailable = true Else postavailable = false End If [randomly spread through the code, more than 50 times] If (postavailable) then //set variable to a value, each time a different variable... Else //set a variable to " " End If 0 comments |
![]()
Recent Posts Reading Material: Writing Secure Code. No Right Click? Use Shift + F10. Hurricane Ike Recovery. CI in SD Conference. Microsoft ArcReady Event. University of Houston Alumni Organization. Arrested Development - Great Show! NYTimes.com - Double Click a Word, Try It. Secure Vantage Technologies is Hiring. SqlException: Invalid object name. Archives May 2005 June 2005 July 2005 August 2005 September 2005 October 2005 November 2005 December 2005 January 2006 February 2006 March 2006 April 2006 May 2006 June 2006 July 2006 August 2006 September 2006 October 2006 November 2006 December 2006 January 2007 February 2007 March 2007 April 2007 May 2007 June 2007 July 2007 August 2007 September 2007 October 2007 November 2007 December 2007 January 2008 February 2008 March 2008 April 2008 May 2008 June 2008 July 2008 August 2008 September 2008 October 2008 |
| copyright 2006-2008 | thomasnguyen.com |
![]() |