[talk] Python
Edward Capriolo
edlinuxguru at gmail.com
Mon Apr 18 10:06:12 EDT 2016
You are stuck with List/ArrayList/Concurrent Access Violations beneath this.
List vs ArrayList should not matter. If the developer uses the generic type
it should imply to the reader that the specific type does not matter.
ArrayList vs Vector. Any implementation should work the same way..***
Concurrent Access Violations
Now this is interesting. I feel as if we were talking recently on list as
to does some resolv.conf type library in mac or BSD is/was thread safe. I
do agree that thread safety is probably the largest case of "implied"
across the board.
Now here be the dragons. Threading bugs are very subtle, you have to assume
the user understand happens-before, happens-after, atomicity, readers see
writes, keywords like volatile. This is one of the harder bits to document.
If the user does not know the memory model of the application the
programmer would have to document it everywhere which would be annoying. .
IE if you are doing servlet programming you should know that there are
multiple threads executing on the same class so using class variables in
the request scope is wrong. You should not have to mark every class
variable as //DONT USE IN REQUEST SCOPE.
I am no python guru but I assume these same issues exist. You *the user of
the documentation* have to know if this is a copy-on-write list etc. Just
because changing it will never throw ConcurrentModifiicationException does
not mean your code is safe/better. Arguably it could be worse, like a user
is modifying a list another component assumes is a fixed size.
I actually ask what a ConcurrentModificationException is on interviews.
This shows if the developer has ever done any meaningful concurrent
programming. Also there is no one correct answer. The simple answer is use
a synchronized list, but that is the most performance heavy, maybe a mutex
or a shared lock is the right answer, but maybe a concurrent list is the
answer, but that means if can change as you are iterating it, what does
that mean for downstream code?
On Mon, Apr 18, 2016 at 5:16 AM, Sujit K M <kmsujit at gmail.com> wrote:
> Including both mails. I don't know whether it permits email courtesy. But
> I wanted to reply to both your mails.
>
> My general conclusion is the way you look at it. I am someone very new to
> python < 1 year. I am much more
> of a Java Guy. But my conclusion is, every resource has its own utility,
> you can write test cases for your data
> and more importantly code your tests, there is the un-chartered water. I
> feel a test case is the most important.
> But coding your test cases is not the way but write code using test cases
> is what I have been taught with.
>
> On Sun, Apr 17, 2016 at 10:13 PM, Edward Capriolo <edlinuxguru at gmail.com>
> wrote:
>
>> It is not the fault of the language the lacking of documentation, it is a
>> lacking of the developers that use it. Java has (and has had since the
>> beginning) an inbuilt system called java-doc which generates markup in
>> comments into documentation.
>>
>>
>> https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html
>>
>
>
> Again something worthless of document. I have found StringUtils to be most
> commonly implemented framework in any
> product. Also Just blindly saying this is the reason this field is there
> or values it can take is certainly not acceptable
> to anyone. One looking at the Java doc should be able to get the crux of
> the matter, I should be able to write a test case
> with it. and also agree most people don't read the entire api and also
> there is a lot of illiteracy among developers.
>
>
>>
>>
>> I have some interesting prospective on documentation:
>>
>> 1) Documentation in code is almost impossible to keep accurate. In many
>> cases most things you two to document internally like "clear box"
>> documentation, hurts readability and is so difficult to keep in sync with
>> actual code.
>>
>
> I would like to know when there is tester, a documentation person there
> why cannot they look at what is being pushed
> out to a large set of people some naive, some professional, some
> unethical. Is it not a part of their duty. I for instance
> have not seen any change in Generics that were introduced in Java 1.3 till
> now and also there are a lot of deprecated
> classes methods etc which are used by people. Infact there is way remove
> compiler warnings for deprecated such.
>
>
>>
>> 2) Who is the documentation for. Inside a method to authenticate with
>> oauth, what do you document the entire oauth protocol? What the application
>> is supposed to do?
>>
>
> This is what I exactly want. I have seen tonnes of oauth classes in Java,
> How many give a error code description for example or a future
> processing message, say your email is locked for example. These are not
> yet developed simply because there is no initiative from the
> so called guru's of the language. I have worked on products that do this
> exactly written in Java.
>
>
>>
>> 3) People don't read anyway. I have written 2 books on Cassandra and
>> Hive. At my work we use both. In addition to the books I have ALSO field
>> out our internal wiki with site specific information.
>>
>>
> That is pathetic.
>
>
>> Do you really read docs? If people did, STACKOVERFLOW would not be a run
>> away success! No one reads anything they just want the star trek computer /
>> google to answer any question they dont know instantly, and they dont want
>> to have to care about how anything works.
>>
>>
> Very sad for these people living by the sword is what I call this.
>
> On Sun, Apr 17, 2016 at 11:17 PM, Edward Capriolo <edlinuxguru at gmail.com>
> wrote:
>
>> Also what you think is "readable" also is mostly about what you are
>> familiar with. Many people claim lisp like languages are very readable
>> because there is only "one form". However I find it difficult to grok
>> code-as-data.
>>
>> As it relates to the present conversation, I find languages with no
>> explicit types confusing.
>>
>> Take this:
>> def delete(mylist, item):
>>
>
> I find it better since I don't have to know mylist implementation
>
>
>>
>> VS.
>>
>> void delete(List<Integer> item, Integer item)
>>
>
> You are stuck with List/ArrayList/Concurrent Access Violations beneath
> this.
>
>
>>
>> Mostly because in larger code bases if there is no direct test calling
>> the method it may be hard to understand exactly what types the arguments
>> are.
>>
>> You could argue that Clojure has a nice solution here. They allow type
>> less coding, however typing can be applied as an optimization. Clojure
>> also makes documentation a 1st class citizen by making documentation part
>> of the language rather than some afterthought like text inside /* */ that
>> may or may not follow a specific format.
>>
>> I generally hate reading other peoples code and doing code reviews.
>> Provide me clear interfaces and unit tests, I dont want to go over code
>> like a CP 1 teacher.
>>
>
>> Once someone deployed something that I code reviewed. It crashed and
>> burned, and when I got there case about it they said, "Well you reviewed
>> it!"
>> Like somehow me looking at something for 1 hour that took someone else 1
>> week to write was going to find the hidden bugs. I told him, I'm not going
>> to review any more, I'm not your crutch. You are just going to have that
>> won't fail.You are going to have to write unit tests or do manual testing
>> to find edge cases. If i spend all day review code and finding other
>> peoples bugs I wont have time for my work.
>>
>
> I agree with you. But as it Turns out I Do this quite a lot, because some
> one else wants it. I just posted to mailing list to know what is the
> reason, I find reviewing Python Easy.
>
>
>>
>> On Sun, Apr 17, 2016 at 11:58 AM, Sujit K M <kmsujit at gmail.com> wrote:
>>
>>>
>>> I agree with whole of the comments except for the one below.
>>>
>>>> when you tackle a task, like java, there's just a ton of libraries that
>>>> you can leverage off of...
>>>>
>>>
>>> You would find tonnes of packages in Python too. But Java for instance,
>>> In my job, Where I deal
>>> with services, I find people to be suffering from an IN/OUT Syndrome
>>> where in all the work they
>>> carry out is to map an
>>> input/configurations/database/configurations/partial output and repeat.
>>> This according to me is bad.
>>>
>>> The other thing I find difficult with Java is that these tonnes of
>>> libraries, have documentation which
>>> is not worth a penny or useful. I mean does Apache for instance provide
>>> performance issues as a
>>> part of documentation. I find testers who also should have a part in
>>> documentation, not doing this.
>>> Un-Chartered waters I guess.
>>>
>>>
>>>
>>>>
>>>>
>>>> On 4/17/2016 10:07 AM, A. Jesse Jiryu Davis wrote:
>>>>
>>>> I agree — Python is designed with the philosophy that "readability
>>>> counts" and it is successful at that. Python code is some of the most
>>>> readable of any programming language. The language also has disadvantages,
>>>> of course, but its clarity is unsurpassed.
>>>>
>>>> On Sun, Apr 17, 2016 at 9:30 AM, Sujit K M <kmsujit at gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I found python projects to be very good from an code review
>>>>> perspective.
>>>>> What I found is Python Language makes it simple to without an IDE
>>>>> simpler
>>>>> code to review. I find Java Projects to be the most difficult to do
>>>>> code review.
>>>>>
>>>>> What is the general view on this? Or is it one of my hallucinations?
>>>>>
>>>>> Regards,
>>>>> Sujit K M
>>>>>
>>>>> _______________________________________________
>>>>> talk mailing list
>>>>> talk at lists.nycbug.org
>>>>> http://lists.nycbug.org/mailman/listinfo/talk
>>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> talk mailing listtalk at lists.nycbug.orghttp://lists.nycbug.org/mailman/listinfo/talk
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> talk mailing list
>>>> talk at lists.nycbug.org
>>>> http://lists.nycbug.org/mailman/listinfo/talk
>>>>
>>>
>>>
>>> _______________________________________________
>>> talk mailing list
>>> talk at lists.nycbug.org
>>> http://lists.nycbug.org/mailman/listinfo/talk
>>>
>>
>>
>
> _______________________________________________
> talk mailing list
> talk at lists.nycbug.org
> http://lists.nycbug.org/mailman/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nycbug.org/pipermail/talk/attachments/20160418/549d891c/attachment-0001.html>
More information about the talk
mailing list