Am fost impresionat de
The Pragmatic Programmer – From Journeyman to Master .
Nu este o carte de programare .NET – dar este o carte EXCEPTIONALA de programare
Iata cum incepe :
Programming is a craft. At its simplest, it comes down to getting a computer to do what you want it to do (or what
your user wants it to do). As a programmer, you are part listener, part advisor, part interpreter, and part dictator.
You try to capture elusive requirements and find a way of expressing them so that a mere machine can do them
justice. You try to document your work so that others can understand it, and you try to engineer your work so that
others can build on it. What’s more, you try to do all this against the relentless ticking of the project clock. You work
small miracles every day.
Daca nu ati citit-o, cumparati-o sau cereti cunoscutilor o copie. E o carte de referinta.
Din partea mea avind in vedere ca “The limits of language are the limits of one’s world.(Ludwig Von Wittgenstein) “(citat din aceeasi carte)
o sa scriu citeva tehnici din carte, alaturi de modalitati de a le realiza prin .NET
The Cat Ate My Source Code
Citat : “If the disk crashes—taking all of your source code with it—and you don’t have a backup, it’s your fault. Telling your
boss “the cat ate my source code” just won’t cut it.”
Comentarii : orice solutie de Source safe, backupuri
Software Entropy
Citat :”Don’t leave “broken windows” (bad designs, wrong decisions, or poor code) unrepaired. Fix each one as soon as it
is discovered. If there is insufficient time to fix it properly, then board it up. Perhaps you can comment out the
offending code, or display a “Not Implemented” message, or substitute dummy data instead. Take some action to
prevent further damage and to show that you’re on top of the situation.”
Comentarii : puteti face asa ceva si cu atribute pe cod sursa http://en.csharp-online.net/Attributes
Orthogonality
Citat :”Two or more things are orthogonal
if changes in one do not affect any of the others. In a well-designed system, the database code will be orthogonal to
the user interface: you can change the interface without affecting the database, and swap databases without changing
the interface.”
Comentarii :
Strongly Typed Dataset(http://msdn.microsoft.com/msdnmag/issues/04/12/DataPoints/),
3-tier development
Reversibility
Citat :
“But you said we’d use database XYZ! We are 85% done coding the project, we can’t change now!” the
programmer protested. “Sorry, but our company decided to standardize on database PDQ instead—for all
projects. It’s out of my hands. We’ll just have to recode. All of you will be working weekends until further
notice.”
Comentarii :
Pentru cazul de mai sus puteti folosi
NHibernate, de ex. sau orice alt
ORM (http://weblogs.asp.net/yreynhout/archive/2003/10/07/30798.aspx
)
The Power of Plain Text
E normal ca unele date de test sa fie in text – iar avind in vedere usurinta cu care .NET
(de)serializeaza(http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx)
in XML – e usor de facut.
Shell Games
Aici avem
power shell(http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx)
Power Editing
Nu mai zic nimic despre
IDE de VS Express – e free si destul de puternic.
Source Code Control
E normal de folosit pentru backup si revizuire de istoric aici standardul pina acum e SourceSafe … dar CVS si Subversion vin din urma puternic
Debugging
VS Ide face o treaba buna – fie in ASP.NET, fie in Windows Forms
Text Manipulation
Avem expresii regulate
pentru aceasta – pentru mine au fost de ajuns.
Code Generators
Sunt atitia ca mi-e greu sa decid. CodeSmith
desigur, apoi cautati pe Google http://www.google.com/search?q=code+generator+.net&start=0
Pe de alta parte, pentru compilare de cod in Runtime plecind de la fisiere avem compilatoare gata pregatite , vezi, de exemplu ,
csharpcodeprovider(http://msdn2.microsoft.com/en-us/library/microsoft.csharp.csharpcodeprovider.aspx)
si pentru generarea rapida avem
DynamicMethod Class (http://msdn2.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod(vs.80).aspx)
Design by Contract
Intr-o privinta , avem interfetele.Dar in ce priveste preconditiile si postconditiile, stam cam prost.Exista
Eiffel http://www.eiffel.com/products/eifaspnet/index.html care implementeaza WebService prin DBC … dar cam atit.
Dead Programs Tell No Lies
E usor in teorie – cu throw si definirea de
Exceptii (http://msdn2.microsoft.com/en-us/library/aa309092(VS.71).aspx)
Mai greu este de facut.
Assertive Programming
Avem debug.Assert pentru aceasta.
How to Balance Resources
Sfaturi generale referitoare la cine e raspunzator de ce resurse- mai ales de cele
care nu se “elibereaza” singure -handlere de fisiere, etc .
Va trebui sa cititi intreg articolul de
aici (http://www.bluebytesoftware.com/blog/PermaLink.aspx?guid=88e62cdf-5919-4ac7-bc33-20c06ae539ae)despre IDisposable
sau macar articolul pe scurt de
aici http://www.atalasoft.com/cs/blogs/stevehawley/archive/2006/09/21/10887.aspx
Metaprogramming
Puteti folosi
atribute pentru acest lucru (http://www.codeproject.com/csharp/dotnetattributes.asp) sau sa generati automat clase si sa le compilati la runtime( vezi mai sus CodeGenerators)
Workflow – vine in curind Windows Workflow Foundation (WF) http://wf.netfx3.com/
It’s Just a View
Despre evenimente in .NET s-au scris mult.
Gasiti rapid
aici o referinta usoara de utilizat http://msdn2.microsoft.com/en-us/library/system.eventhandler(VS.71).aspx
Blackboards
ramine de facut …se incumeta cineva?
Code That’s Easy to Test
folositi NUnit sau
Testele din VSTS
Inca o data , faceti rost de ea si cititi-o!
Ma bucur ca ti-a placut.
Legat de source control – cum poti sa spui ca "standardul pina acum e SourceSafe … dar CVS si Subversion vin din urma puternic"? Dupa mine VSS e o gluma proasta. SVN si Perforce sunt departe.
Zic ca e standard – nu din cauza ca e mai bun sau mai prost decit celelalte.Ci din motivul simplu al numarului de firme la care am fost si care il utilizeaza(90%)
Multumesc de info!