File: TODO.rst

package info (click to toggle)
offlineimap 7.2.3%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,232 kB
  • sloc: python: 7,945; sh: 515; makefile: 79
file content (123 lines) | stat: -rw-r--r-- 4,333 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
.. vim: spelllang=en ts=2 expandtab :

.. _coding style: https://github.com/OfflineIMAP/offlineimap/blob/next/docs/CodingGuidelines.rst

============================
TODO list by relevance order
============================

Should be the starting point to improve the `coding style`_.

Write your WIP directly in this file.

TODO list
---------

* Better names for variables, objects, etc.


* Improve comments.

  Most of the current comments assume a very good
  knowledge of the internals. That sucks because I guess nobody is
  anymore aware of ALL of them. Time when this was a one guy made
  project has long passed.


* Better policy on objects.

  - Turn ALL attributes private and use accessors. This is not
    "pythonic" but such pythonic thing turn the code into intricated
    code.

  - Turn ALL methods not intended to be used outside, private.


* Revamp the factorization.

  It's not unusual to find "factorized" code
  for bad reasons: because it made the code /look/ nicer, but the
  factorized function/methods is actually called from ONE place. While it
  might locally help, such practice globally defeat the purpose because
  we lose the view of what is true factorized code and what is not.


* Namespace the factorized code.

  If a method require a local function, DON'T USE yet another method. Use a
  local namespaced function.::

    class BLah(object):
        def _internal_method(self, arg):
            def local_factorized(local_arg):
                # local_factorized's code
            # _internal_method's code.

  Python allows local namespaced functions for good reasons.


* Better inheritance policy.

  Take the sample of the folder/LocalStatus(SQlite) and folder/Base stuffs. It's
  *nearly IMPOSSIBLE* to know and understand what parent method is used by what
  child, for what purpose, etc. So, instead of (re)defining methods in the wild,
  keep the well common NON-redefined stuff into the parent and define the
  required methods in the childs. We really don't want anything like::

    def method(self):
        raise NotImplemented

  While this is common practice in Python, think about that again: how a
  parent object should know all the expected methods/accessors of all the
  possible kind of childs?

  Inheritance is about factorizing, certainly **NOT** about **defining the
  interface** of the childs.


* Introduce as many as intermediate inherited objects as required.

  Keeping linear inheritance is good because Python sucks at playing
  with multiple parents and it keeps things simple. But a parent should
  have ALL its methods used in ALL the childs. If not, it's a good
  sign that a new intermediate object should be introduced in the
  inheritance line.

* Don't blindly inherit from library objects.

  We do want **well defined interfaces**. For example, we do too much things
  like imapobj.methodcall() while the imapobj is far inherited from imaplib2.

  We have NO clue about what we currently use from the library.
  Having a dump wrappper for each call should be made mandatory for
  objects inherited from a library. Using composed objects should be
  seriously considered in this case, instead of using inheritance.

* Use factories.

  Current objects do too much initialization stuff varying with the context it
  is used. Move things like that into factories and keep the objects definitions
  clean.


* Make it clear when we expect a composite object and what we expect
  exactly.

  Even the more obvious composed objects are badly defined. For example,
  the ``conf`` instances are spread across a lot of objects. Did you know
  that such composed objects are sometimes restricted to the section the
  object works on, and most of the time it's not restricted at all?
  How many time it requires to find and understand on what we are
  currently working?


* Seriously improve our debugging/hacking sessions (AGAIN).

  Until now, we have limited the improvements to allow better/full stack traces.
  While this was actually required, we now hit some limitations of the whole
  exception-based paradigm. For example, it's very HARD to follow an instance
  during its life time. I have a good overview of what we could do in this area,
  so don't matter much about that if you don't get the point or what could be
  done.

* Support Unicode.