<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Ha ha ha</div><div>This is funny, please stop!</div><div> </div><div>"typed while hacking!"</div><div><br>On 25 aug 2015, at 17:58, Ivan Carmenates Garcia <<a href="mailto:co7eb@frcuba.co.cu">co7eb@frcuba.co.cu</a>> wrote:<br><br></div><blockquote type="cite"><div>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="MS Exchange Server version rmj.rmm.rup.rpr">
<title>RE: [erlang-questions] I need some advices for a framework I'm doing</title>
<!-- Converted from text/rtf format -->
<p dir="LTR"><span lang="en-us"><font face="Calibri">Hi, </font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Well the good news here is that I am making it together with a system a am also doing so, it any problems present I will notice they quickly and at the same time</font></span><span lang="en-us"> <font face="Calibri">I will get feedbacks.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Regards documentation, that one of the thing a l</font></span><span lang="en-us"><font face="Calibri">o</font></span><span lang="en-us"><font face="Calibri">ve more, so it will be plenty of it, with a lot of examples and explanations.</font></span><span lang="en-us"><font face="Calibri"> Currently the code doc for any function and even examples of how to use them.</font></span><span lang="en-us"><font face="Calibri"></font></span><span lang="en-us"> <font face="Calibri">i</font></span><span lang="en-us"><font face="Calibri">.e.</font></span><span lang="en-us"> <font face="Calibri">this is a nice doc for one of the functions:</font></span></p>
<p dir="LTR"><span lang="en-us"></span><span lang="en-us"><font face="Consolas">%% -------------------------------------------------------------------</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% @doc</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% Makes a query to a database using a 'DBSession'.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% Returns a 'ResultData':</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% - 'ResultData' depends of 'result_format' Option.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% - 'result_format' could be one of 'raw', 'proplist', 'map'.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% - 'proplist' and 'map' result formats have the same</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 'ResultData' struct:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% {ok, Data} when using 'select'.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% {ok, Count} when using 'update', 'insert', 'delete'.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% {ok, Count, Data} when using 'update', 'insert' with returning.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% The only differences are:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 0 result</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">s</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 'map' -> no_data,</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 'proplist' -> [],</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 1 result:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 'map' -> a single map #{...},</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 'proplist' -> a list of proplist [[...]], (templ</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">ate</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas"></font></span><span lang="en-us"></span><span lang="en-us"> <font face="Consolas">c</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">omp</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">atible</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">)</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% N result</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">s</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 'map' -> a list of maps [#{...}, ...],</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 'proplist' -> a list of proplists [[...], ...],</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% 'raw' by the other hand is 'Backend' dependent.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% Example:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% {ok, #{id := Id}} = database_manager:query(DBSession,</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% Query, Params, [{result_format, map}]).</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% NOTE: 'map' is the default result format for 'query/3' function.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% NOTE: All result format has its pros and cons, 'raw' is the fastest</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% but uncomfortable to deal with, 'map' is the slowest but very</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% easy to deal with. So this is the performance order from</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% fastest to slowest 'raw' > 'proplist' > 'map'.</font></span><span lang="en-us"></span><span lang="en-us"> <font face="Consolas">'</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">p</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">roplist</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas">'</font></span><span lang="en-us"></span><span lang="en-us"><font face="Consolas"> can</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% be used to return directly to a template.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% @end</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">%% -------------------------------------------------------------------</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">-spec query(DBSession, Query, Params, Options) -></font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> ResultData | {error, Reason} when</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> DBSession :: db_session(),</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> Query :: string() | bitstring(),</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> Params :: [] | [any(), ...],</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> Options :: proplists:proplist(),</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> ResultData :: any(),</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> Reason :: term().</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas">query({Backend, Connection}, Query, Params, Options) -></font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> %% executes query/4 in the current 'Backend'.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Consolas"> Backend:query(Connection, Query, Params, Options).</font></span><span lang="en-us"></span><span lang="en-us"></span></p>
<p dir="LTR"><span lang="en-us"></span></p>
<p dir="LTR"><span lang="en-us"></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Anyone have more</font></span><span lang="en-us"> <font face="Calibri">suggestions</font></span><span lang="en-us"><font face="Calibri"> I could use?, thanks in advantage.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Regards,</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Ivan.</font></span><span lang="en-us"></span></p>
<p dir="LTR"><span lang="en-us"></span></p>
<p dir="LTR"><span lang="en-us"></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">-----Original Message-----<br>
From: Loïc Hoguin [<a href="mailto:essen@ninenines.eu">mailto:essen@ninenines.eu</a>]<br>
Sent: Monday, August 24, 2015 5:45 PM<br>
To: Ivan Carmenates Garcia; <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
Subject: Re: [erlang-questions] I need some advices for a framework I'm doing</font></span><span lang="en-us"></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">On 08/24/2015 10:20 PM, Ivan Carmenates Garcia wrote:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">> Hi everyone, I am making a little framework for cowboy, but in general </font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">> what I need is some advices regards final looking, i.e.:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">OK I am a bit lost on everything you explained so allow me to give some generic advice:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Make it work</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Start making apps with it</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Notice everything inefficient in how you now write apps</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Update your framework</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Repeat</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Practice makes perfect. Add a little of looking at how everyone else does things in the mix to get ideas; sometimes you will notice something is bad in your framework but have no idea how to make it better, that's why you need to look elsewhere. Sometimes the idea might come from a completely unrelated source.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">A few more things:</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Keep it simple and explicit</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Focus on the use cases that benefit the majority of users</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Choose good, short names</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">* Write a user guide when things stabilize</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">On the last point, you want the guide separate from code entirely because this forces you to think about how you really use it rather than just documenting functions or modules one after another. Think of it like writing a book, except the only role of this book is to explain to others *what* they can do with your framework and *why* they will do things that way.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Once you get there, you should have a pretty good product, and you'll most likely have gotten a ton of users along the way.</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Cheers,</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">--</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Loïc Hoguin</font></span></p>
<p dir="LTR"><span lang="en-us"></span><a href="http://ninenines.eu"><span lang="en-us"><font face="Calibri">http://ninenines.eu</font></span><span lang="en-us"></span></a><span lang="en-us"></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">Author of The Erlanger Playbook,</font></span></p>
<p dir="LTR"><span lang="en-us"><font face="Calibri">A book about software development using Erlang</font></span><span lang="en-us"></span></p>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>erlang-questions mailing list</span><br><span><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a></span><br><span><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br></div></blockquote></body></html>