Showing posts with label Musings. Show all posts
Showing posts with label Musings. Show all posts

Saturday, June 7, 2014

Double or triple negatives are hard to parse. Highfalutin and all that stuff

I have difficulty understanding the phrase "Not Unless." Less is negative, Un is negative, Not is negative

Sometimes I double parse the meaning of a sentence when it has the phrase "Not Unless" in it, and wondering if the speaker really intended that meaning when explaining things, or if he really just meant "Unless." It still makes me pause (giving myself enough time to parse the speaker's message) when hearing "Not Unless"



I knew well the word irregardless though, I knew that it's a wrong word. The word regardless would suffice, no need to prefix it with "ir"


I think the phrase "Not Unless" could benefit from the usage of a comma in between them. Or just use No and Unless with a well-placed pause between them



Confusing:

Q: "Are you going to make it to the party?"
A: "Not unless there are a lot of people there."



The meaning is clear:

A: "No, unless there are a lot of people there"

The answer is very clear, non-ambiguous. The answer may sound a bit blunt, but it's not ambiguous



Or avoid the double negative at all, it's instantly clear:

A: "If there are a lot of people there"



The rule of the thumb here is we should only hear the phrase "Not Unless" when something is being answered. If someone is using "Not Unless" while explaining something, the message can be confusing


Sometimes the usage of the phrase "Not Unless" is highfalutin. So there. I'm not the only one who feel that:

Question:

Is this use of 'not unless' correct?
If we travel in distant land, still uncharted on the map, and find a new mountain, can we say that we invented the mountain? Not unless we were insane.

I thought Not means we cannot, so this is really "We cannot (=Not) (say it was invented) unless we were insane.
or should i have said "not unless we are sane"?

can someone explain this to me?

Answer:

In theory it is correct but it is a horrible example of proper English, American or other former colony. The author is trying to impress him/her self with their ability to use words.



Note to self: When someone says Not Unless, mentally convert it to If. They might mean Unless though, so mentally convert it to If Not. Bummer

Sunday, July 10, 2011

Start embracing the five pillars of maintainable software: ORM, the MVC pattern, unit testing, mocking, IoC.

An advice to Microsoft toolchain users. Embrace what they churn out these past years. ASP.NET MVC, Entity Framework, Code-first EF(i.e. model-centric coding, not to be confused with designer), jQuery(not made by Microsoft, but now has a blessing from them). They deliver nice technologies way very late, it's a disservice to your skillset if you will not quickly learn these enabling technologies. Microsoft is already late, don't let yourself be late with Microsoft's latest technology.


MVC
MonoRail 2003 vs ASP.NET MVC 2007

ORM
NHibernate 2004 (Hibernate 2001) vs Entity Framework 2008


See? how long before Microsoft "legitimizes" certain technologies to the eyes of many Microsoft tools-using devs. And what's the year now? 2011. Hiding in the cave?


Use 21st-century techniques Don't lag behind, leave ASP.NET use ASP.NET MVC, leave ADO.NET use ORM and don't use sp-centric programming, not everyone are going gaga over sp, look at your Java counterpart devs, their DBA trusted them on touching the base tables, binding the ORM directly to tables, could it be that Java devs are DBA-grade application developers? and as such are more amenable and trusted on using ORM, hmm.. :-)


Start embracing the five pillars of maintainable software: ORM, the MVC pattern, unit testing, mocking, IoC.

Friday, June 3, 2011

Don't bikeshed

Let's not bikeshed during development. If you see some systems that uses GUID, it has a rationale why it is chosen. Don't outright dismiss/demean the design just because the system uses GUID as primary key. Try to grok why certain decisions are made as such.


I can hazard a guess that those Microsoft developers(Microsoft employees) doesn't bikeshed and didn't spent an inordinate amount of time on what field type to use for primary keys when they are designing Microsoft Dynamics ERP, Microsoft CRM, Microsoft Sharepoint. All those mentioned products uses GUID for primary keys. They have made a decision that the advantages far outweighs the disadvantages. And if Microsoft uses GUID for primary keys on an ERP-type of product is not confidence-inducing enough to those who are reluctant to use GUID as primary key, I don't know what could.


Another bikeshedding is debating whether LastModifiedDate is nullable or not. Trivial choices such as this won't go wrong either way. And if populating the non-nullable date column is a hassle on initialization(i.e. INSERT), just put GETDATE() as the default value on that column. Debating this decision rigorously have reminded me of the quote: "The minute you start to strategize too much, the more you start to think you're in control of your own fate. And you're not, really." Which reminded me of another technology, ah.. the list of things that can be blogged is endless :-) Do things in moderation.



And suggesting to use an integer type instead of GUID, this might lead you to fall into a dangerous trap that you will naturally assume things are slow just because the system uses particular data types (e.g. GUID), then you will be reluctant to know the real deep reason why things are slow.



And to prove that the choice of field type is not the major factor on causes of system bottleneck, here's an anecdote, I optimized a query that took 222 seconds; then optimizing it again, it became 71 milliseconds; then tried another approach but suprisingly is slower, 399 milliseconds; then tried another approach, the sweet spot, 37 milliseconds. I used varchar for GUID, Postgresql prior version 8.4 don't have a native(uses 16 bytes) GUID then, I used GUID to roll my own replication, I had an unenviable job to implement a system to make a selective replication based on business rules, and using GUID as primary keys for tables perfectly fits the bill. I digress. Here's the optimization I've done on a system that uses varchar'd GUID. http://stackoverflow.com/questions/3177038/why-the-most-natural-queryi-e-using-inner-join-instead-of-left-join-is-very


Don't bikeshed.

Tuesday, May 31, 2011

Learn to put up with Visual Studio, it's not perfect. Nothing is

An anecdote:

In VS, click Project (next to File,Edit,View), select Properties

then in Application tab (you'll notice you're already in 3.5), select the Target Framework to 2.0, then compile (it will error). then put it back again to 3.5, then compile again, the error will disappear

i think it is just a small glitch in Visual Studio, just fool the IDE :-)

Stupid if you may ask.

source: http://stackoverflow.com/questions/205644/error-when-using-extension-methods-in-c/383517#383517

And when clicking Update Service reference is a no joy undertaking; sometimes you have to remove the service reference, and then re-add it again. Sometimes you have to restart Visual Studio to make things take in effect, ah.. the dev's life! :-)

Another anecdote(from me, a colleague experienced it too), the first time one installed a nuget on his/her Visual Studio, his/her Visual Studio will become very slow. So when the colleague installed nuget on his Visual Studio for the first time, he noticed Visual Studio became very slow; and even he restarted Visual Studio, it's still very slow, I told him to restart his computer. Voila! his Visual Studio became snappy again.


First refuge of those who easily give up: http://stackoverflow.com/questions/205644/error-when-using-extension-methods-in-c/338452#338452

When it comes to choosing a jQuery component, don't be a sheeple

Sharing my same sentiment. Should selectively download which jQuery UI is needed on application, so far we only use datepicker, tab, accordion, dialog, draggable(for dialog need), resizable(for dialog need too). --> http://www.redfrogconsulting.com/love-jquery-hate-the-jquery-ui.php


Too many bloat on jQuery UI, there's an exploding, bouncing, clip, shake, pulsate animation in jQuery UI to name a few, you don't need them, there's also: droppable, position, progress bar, etc, you also don't need them.


Selectively download which ones you need, jQuery UI customizable download is user-friendly anyway, just uncheck then check which ones you need



If few years down the road and the whole jQuery UI become too bloated (say almost 300+ KB) to the point that it is heavier than your own content, I would call it far from being a standard. We're not sheeple folks, we don't need to put up with their boatload of bloat they're injecting in their jQuery components, especially if we don't use them. Let's be happy that we can selectively download (jquery-ui-1.8.12.custom.tab+accordion+datepicker+dialog+draggable+resizable.min.js) which ones we need on jQuery UI website; if there's no customized download facility on jQuery UI website, jQuery UI could receive flaks more than it deserves, and everybody will quickly find other jQuery components that is more lightweight than jQuery UI. Selectively choosing which jQuery UI you only need is the standard, downloading the whole package is silly.


jQuery Tools vs jQuery UI 14 KB(jQuery Tools) vs 209 KB(jQuery UI). jQuery Tools has the only most commonly used features a web program need, thus cutting down the bloat.

And the father(John Resig, see comment #5 of last link) of jQuery weigh in:
jQuery UI Tabs is only 6KB minified and gzipped, jQuery Tools Tabs is 1.5KB minified and gzipped – and that’s saying nothing of the features supported by both plugins.



See jQuery Tools in action


Download jQuery Tools. For future projects :-)